moving /home

Mike McCarty mike.mccarty at sbcglobal.net
Mon Dec 5 19:18:03 UTC 2005


Anil Kumar Sharma wrote:
> Pl, allow me to clarify, in fact I was doubtful while writing it but instead
> dashed -
> There is nothing like /dev/sda1/home     I thought, it would be obvious (my
> mistake), actual writeup should have been

I've been following this exchange, but refraining from participating,
as I do not consider myself a guru WRT Linux. However, I see what
seems to be quite a bit of vagueness about what exactly is happening,
both from a conceptual and a procedural standpoint.
Perhaps I can clarify...

Tools should not be looking in "/home/username" to do things. They
should look in $HOME, or in /etc/passwd, or similar to find your
home directory. Your home directory can be *anything*. You may share
a home directory with another user, for example. This is not so
uncommon. So, /home is not a "reserved" location. It is, however,
a *recommended* location.

Now, if you want to move /home to another disc or partition, there
is absolutely no need to delete the old /home at all. All that
is needed is to move it to a new name, say /oldhome or /homesave.

That said, you *do* need a /home, but it needs to be an empty directory.
This empty directory will be used as a mount point for the new
home. This is so the paths everything you have now set up will still
work. If you didn't want to preserve this, you could simply mount
/dev/sde1 *anywhere*, and use useradd to modify your account
preferences, and be done.

I don't know why you are creating a directory named home on your new
disc. If you do that, and mount /dev/sda1 onto the mount point /home,
then your copied files will show up as /home/home/username/...

ISTM that what you need to do is...

Your very first step should be to create a backup set which is verified
to work in case of a disaster, so you can recover your machine.
Until you have done this, take no further steps. Your mileage
will *not* vary.

Then...

Create a partition on your new disc, which may be the whole disc,
associated with /dev/sda1, and do a mkfs on it. Create a temporary
mount point, let's say /newhome. Then mount /dev/sda1 onto the
temporary mount point. Then copy /home... to /newhome...
preserving ownership and date information. Then rename /home to
/homesave or whatever, create an empty directory /home, and edit
/etc/fstab to mount /dev/sda1 onto /home.

Reboot, and you should be home free (so to speak).

If there is a problem, and you can't log in, then log in as
root, edit /etc/fstab back the way it was (I prefer to save
a backup copy as /etc/fstab.bak or similar) and remove /home,
then rename /homesave to /home.

If there is no problem, then after a few days, when you feel
comfortable, *then* remove /homesave and the files below it.

[snip]

Mike
-- 
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!




More information about the fedora-list mailing list