Moving Raspian

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
I am using Raspian Jesse and have a 120GB SSD Ext4 partition that I would
like to use for part of the OS. How do I move things to the SSD and what can
be moved?

--
Ben  aka cMech

---
We've slightly trimmed the long signature. Click to see the full one.
Re: Moving Raspian
On Sun, 23 Apr 2017 12:24:13 +1200, Ben Ritchey wrote:

Quoted text here. Click to load it
If I'm setting up Linux on a HDD or SDD id normally use these partitions,  
named for the part of the filing system goes on each:

/boot - holds GRUB and the system image(s) - somewhere between 500MB
        and 1GB is fine

swap  - traditionally RAM * 2

/     - contains root, /bin, /usr/bin, /var. /tmp  and /opt 50GB is about
        right

/home - where all the user directories go. Occupies the rest of the disk.

      - I also use a small (4GB) encrypted partition for storing
        sensitive stuff, but thats just me.

      - some distros (Fedora) mount a transient RAM partition as /tmp

FWIW I've recently set up three machines (two laptops and a desktop)  
using this scheme one laptop and the desktop have 500GB HDDs and the last  
laptop has a 128 GB SSD. All are running Fedora and all are running at  
least as fast as I expected.

The obvious (and easiest) bits to put on a separate disk would be /home  
and the swap area, leaving everything else on the SD card. Or you could  
leave only /boot on the SD card and move everything else to the SDD

Your choice: what are you thinking of putting on the SSD? and why? Bear  
in mind that its going to be connecting through a USB socket anyway, so  
won't be blindingly fast.


--  
martin@   | Martin Gregorie
gregorie. | Essex, UK
We've slightly trimmed the long signature. Click to see the full one.
Re: Moving Raspian
* An ongoing debate between Martin Gregorie and Ben Ritchey rages on ...

 >> I am using Raspian Jesse and have a 120GB SSD Ext4 partition that I
 >> would like to use for part of the OS. How do I move things to the
 >> SSD and what can be moved?

 MG > If I'm setting up Linux on a HDD or SDD id normally use these
 MG > partitions, named for the part of the filing system goes on each:
 MG > /boot - holds GRUB and the system image(s) - somewhere between 500MB
 MG >         and 1GB is fine
 MG > swap  - traditionally RAM * 2
 MG > /     - contains root, /bin, /usr/bin, /var. /tmp  and /opt 50GB is
 MG > /home - where all the user directories go. Occupies the rest of the
 MG >       - I also use a small (4GB) encrypted partition for storing
 MG >         sensitive stuff, but thats just me.
 MG > The obvious (and easiest) bits to put on a separate disk would be
 MG > /home and the swap area, leaving everything else on the SD card. Or

That's what I was thinking :)

 MG > Your choice: what are you thinking of putting on the SSD? and why?

Originally I wanted to decrease the access/activity on the SD card to prolong  
it's life and since I have had nothing but failures trying to build anything  
more than a 16GB system on the SD card, it would give me more room .  
I've tried 32GB and 64GB cards to no avail :( My Pi doesn't like it! lol


.- Keep the faith, --------------------------------------------------.
|                                                                    |
|    Ben  aka cMech  Web: http|ftp|binkp|telnet://cmech.dynip.com    |
|                  Email: fido4cmech(at)lusfiber.net                 |
|              Home page: http://cmech.dynip.com/homepage/ |
`----------- WildCat! Board 24/7  +1-337-984-4794  any BAUD 8,N,1 ---'

... So many musicians are grasshoppers with little thought of the future.

Re: Moving Raspian
On Sun, 23 Apr 2017 14:44:49 +1200, Ben Ritchey wrote:

Quoted text here. Click to load it
That makes sense.

I'm not sure to what extent /home is high activity. Bits are for me, but  
then I'm a C and Java developer and active projects surely count as  
fairly high activity with files being edited and every few minutes a  
compile replacing all the binaries. I don't know what the activity  
pattern would be for non-developers, but I'd guess that its more a case  
of adding new files at a lower rate.

The other area to look at is what's going on in /var, especially /var/log.

Of course, if you run database(s) and/or local web-sites and an MTA, by  
default these often store their data in /var, so you can either put that  
in its own partition on the SSD or you can either:

- symlink those data stores to parts of /home
  - PostgreSQL defaults to putting its datastore in /usr/lib/pgsql
    - I replace pgsql with a symlink to /home/postgres

- change their configuration  
  - Apache bases its web pages in, IIRC, /var/lib/html but my config
    file says its base directory is /home/http/html

I suppose which way to go for this stuff depends on the way you
think about such things: in my case I wanted to localise the data I care  
about in /home because that makes backups easier and because, by putting  
it all on the one partition I can do a clean install AND keep my data  
untouched by not reformatting/reinstalling the /home partition. For the  
full rationale of this approach, see:  
            
http://www.libelle-systems.com/free/linux/easier_upgrades.html

- my website.


--  
martin@   | Martin Gregorie
gregorie. | Essex, UK
We've slightly trimmed the long signature. Click to see the full one.
Re: Moving Raspian
* An ongoing debate between Martin Gregorie and Ben Ritchey rages on ...

 MG > I'm not sure to what extent /home is high activity. Bits are for me,

Me either and I do all my dev under Wins :)

 MG > but then I'm a C and Java developer and active projects surely count

Assembly and PowerBasic

 MG > The other area to look at is what's going on in /var, especially
 MG > /var/log.

Yes, I thought about var! So if I copy var to the ssd, delete var then symlink  
var to the ssd var folder, will that work?

 MG > http://www.libelle-systems.com/free/linux/easier_upgrades.html

Thanks, I'll go peruse that. Since my last post I D/L'd an SD card tester and  
found out my two 32GB cards were bad, so that's part of the problem lol


.- Keep the faith, --------------------------------------------------.
|                                                                    |
|    Ben  aka cMech  Web: http|ftp|binkp|telnet://cmech.dynip.com    |
|                  Email: fido4cmech(at)lusfiber.net                 |
|              Home page: http://cmech.dynip.com/homepage/ |
`----------- WildCat! Board 24/7  +1-337-984-4794  any BAUD 8,N,1 ---'

... All truly great thoughts are conceived while walking. - Nietzsche

Re: Moving Raspian
On Sun, 23 Apr 2017 19:08:56 +1200
snipped-for-privacy@f68.n93.z1.binkp.net (Ben Ritchey) wrote:

Quoted text here. Click to load it

    Yes, but making a filesystem on the SSD and mounting it would be
better.

--  
Steve O'Hara-Smith                          |   Directable Mirror Arrays
C:>WIN                                      | A better way to focus the sun
We've slightly trimmed the long signature. Click to see the full one.
Re: Moving Raspian
* An ongoing debate between Ahem A Rivet's Shot and Ben Ritchey rages on ...

 >> Yes, I thought about var! So if I copy var to the ssd, delete var
 >> then symlink var to the ssd var folder, will that work?

 AS >         Yes, but making a filesystem on the SSD and mounting it would
 AS > be better.

The partition is ext4 and already mounted, I would have to symlink to it :) but  

thanks for the info :)


.- Keep the faith, --------------------------------------------------.
|                                                                    |
|    Ben  aka cMech  Web: http|ftp|binkp|telnet://cmech.dynip.com    |
|                  Email: fido4cmech(at)lusfiber.net                 |
|              Home page: http://cmech.dynip.com/homepage/ |
`----------- WildCat! Board 24/7  +1-337-984-4794  any BAUD 8,N,1 ---'

... We write more, but learn less.

Re: Moving Raspian
On Mon, 24 Apr 2017 02:39:54 +1200
snipped-for-privacy@f68.n93.z1.binkp.net (Ben Ritchey) wrote:

Quoted text here. Click to load it

    In that case yes the symlink will work for you, it used to be  
common practice to have /var and /home as symlinks to corresponding
directories under /usr.

--  
Steve O'Hara-Smith                          |   Directable Mirror Arrays
C:>WIN                                      | A better way to focus the sun
We've slightly trimmed the long signature. Click to see the full one.
Re: Moving Raspian
On Sun, 23 Apr 2017 19:08:56 +1200, Ben Ritchey wrote:

Quoted text here. Click to load it
You might want to take a look at the developer tools that come as  
standard with every Linux: tools like grep and awk are very useful for  
one-off jobs. For instance, I wanted to look at a series of numbers (used  
for serialisation) in a collection of 59 source files and list them,  
sorted by number so I could visually check that there were no duplicates.  
This did it:

grep -r serialVersionUID *.java | awk -e '{print $8, $1}' | sort -k1

Grep selects the lines containing the number, awk built a line from it  
containing the filename and serial number, and sort ordered the lines by  
ascending serial number.

But I digress...

Quoted text here. Click to load it
Yes, that's exactly how you'd do it.
  
Quoted text here. Click to load it
Yes, that would have an effect!

I think the trick is to buy SD cards from reputable sellers and only buy  
brands that are known to own flash fabs. I prefer Sandisk but Samsung  
should also be OK. Toshiba also own a fab but I don't know their flash  
brand name(s).


--  
martin@   | Martin Gregorie
gregorie. | Essex, UK
We've slightly trimmed the long signature. Click to see the full one.
Re: Moving Raspian
On 24/04/17 12:25, Martin Gregorie wrote:
Quoted text here. Click to load it

be careful. At boot you may need to write to /var before you actually  
have /home mounted. and that's  also a possibility if you boot into  
single user mode.

Personally I suspect you should think about all the options carefully.



Quoted text here. Click to load it


--  
Religion is regarded by the common people as true, by the wise as  
foolish, and by the rulers as useful.

We've slightly trimmed the long signature. Click to see the full one.
Re: Moving Raspian
On Mon, 24 Apr 2017 13:57:26 +0100, The Natural Philosopher wrote:

Quoted text here. Click to load it
That shouldn't be a problem - if he's symlinking it in effect the  
original root directory hasn't moved and the fstab entry won't have  
changed. Since the symlink is a permanent pointer to a directory in a  
partition in the other disk, the part of the var structure that got moved  
will be available as soon as the contents of fstab have been used to  
mount all disks and partitions.

That said, if the OP is now moving the whole of /var rather than just  
/var/log as was initially discussed, I'd be inclined to repartition the  
disk and put /var in its own partition and modify fstab to mount it.
    
Quoted text here. Click to load it
+1
  


--  
martin@   | Martin Gregorie
gregorie. | Essex, UK
We've slightly trimmed the long signature. Click to see the full one.
Re: Moving Raspian
On 23/04/17 23:43, Martin Gregorie wrote:
Quoted text here. Click to load it
/var/www...here.

Quoted text here. Click to load it
Reasonable approach. I just back up everything tho.

Lost of tweaks in /etc /usr/local /usr/share/...
Then when I upgraded I can raid all that for stuff to get back to where  
I was before I upgraded.



Quoted text here. Click to load it


--  
"I guess a rattlesnake ain't risponsible fer bein' a rattlesnake, but ah  
puts mah heel on um jess the same if'n I catches him around mah chillun".


Re: Moving Raspian
On Mon, 24 Apr 2017 03:04:45 +0100, The Natural Philosopher wrote:

Quoted text here. Click to load it
Thats easy:  

  mv /usr/local /home/local    # once to get the directory structure which
                               # is empty in a new install
  ln -s /home/local /usr/local # now backing up /home gets /usr/local too
                               # If you're using Oracle Java, do the same
                               # with /usr/java too

Each time I manually change anything in /etc I make copies of the changed  
files in my main user directory, i.e. new stuff in /etc/profile.d and
mods to /etc/ssh/ssh_config and /etc/ssh/sshd_config. Also a list of the  
packages I've added to the basic installation (CVS, git, PostgreSQL,  
ImageMagik...) structured as an executable script.



--  
martin@   | Martin Gregorie
gregorie. | Essex, UK
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline