[plug] User diskspace upgrade

Brian Tombleson brian at paradigmit.com.au
Tue Mar 26 13:24:53 WST 2002


Hi David,

BEFORE ANYTHING ELSE: I strongly recommend that you thoroughyl read man/ifno
on man(1), tar(1), mount(8), rm(1) and fstab(5)

From: "David Broadway" <djnitrous at hotmail.com>
>All users home directories are located on the main patition with the system
files.
>But I'm wanting to add in a second hdd just for the users diskspace.
>After installed the hdd (in to the computer)
>1. Is there much to setup to make sure the hdd will be mounted everytime on
bootup?

edit /etc/fstab and add a line similar to the following AFTER you read 'man
fstab' and adjust parameters accordingly:
/dev/hdb1 /home ext2 defaults    0       2

Don't activate this (reboot or umount/mount) until you've got the rest
sorted out.

>2. Whats the best why to move all the users folders/files permissions as
well on to the newly
> mount second hdd?

Hmm .. I've done this before with the /usr partition which taught me most of
the considerations that hard way (especially when you lose most of your
$PATH :-)

You want to make sure you copy the existing /home dir to a new location on
the new drive (eg, mount the new drive as /home2).  Then use tar because it
has good support for maintaining permissions and file ownership.  Assuming
/home and /home2 appropriately, use something like the following (one line,
probably wrapped by the email client):

tar -cpsSl --same-owner --atime-preserve --ignore-failed-read -f - /home/* |
(cd $BACKUP; tar -xvvpsS --same-owner --atime-preserve -f -)

At this point, you should have a copy of /home/ in /home2/ with all
appropriate permissions and ownership.  You just need to swap the mounts.

After editing /etc/fstab as per above, a reboot will mount your new drive to
/home and everything will work fine - except that you've lost all the drive
space under the original /home.  I'd recommend leaving it there initially
and check that everything works correctly.  If it does, then do the
following:
umount /home
rm -fr /home/*
mount /home

>I'm guessing I may have to mainly or every just make a script to change all
the users
> HOME DIR's to point at the new area where they will be!

Err .. generally not a good idea because a lot of programs/installers assume
/home/* for user's and program's home directories and not necessarily check
the /etc/passwd file or the $HOME references.

Hope this helps somebody (and even David).  I'd be interested if I've missed
any safety features or there's an easier way to do it?

Regards,
Brian.




More information about the plug mailing list