Re: Moving /home
- From: The Ghost In The Machine <ewill@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 10 Jun 2007 10:06:26 -0700
In comp.os.linux.setup, zeno
on Wed, 06 Jun 2007 18:46:27 -0000
Thanks for your suggestions, however, I'm not sure about the
First off, I am NOT now an administrator nor are their other users on
my system. No need for explications.
How to move /home dir, which is now a sub-dir of root, to a separate
partition? To be able to upgrade/alter system without affecting main data.
First, do you have a partition?
I can make one.
 mv /home /home.old
 mkdir /home
 chmod 755 /home
From where do I issue this command? The new partition? Or from / ?
Root; at this point you've not prepped the new partition yet.
 edit /etc/fstab, adding a line similar to the following.
/dev/hdax /home ext3 noatime 1 1
/dev/hdax is the new partition location.
/home is the directory you wish to mount during bootup.
ext3 is the filesystem type.
It is possible /etc/fstab may not be using /dev/hdax, but
hopefully the comments are clear in that case.
I'm running Ubuntu 6.06 which seemed a good way to get the feet wet,
except Deb is different. There is an
/etc/fstab file. Okay, is this where we go after creating /dev/
hdax: ? In that case, the previous command:
$ mv /home /old.home is not done? Or is that an alternative to the
If you want your partition mounted at bootup you generally
have to put it into /etc/fstab as described above. (There
are alternatives such as mounting it in /etc/init.d/local,
but, since editing /etc/fstab is so simple, unless one has
removable devices or other special requrements, there's
usually not much point.)
 mkfs.ext3 /dev/hdax
(This, BTW, is the prep part. Partitioning using fdisk simply allocates
This prepares the partition for mounting, by writing out
(erasing, if there's already stuff on it!) blocks in
special locations (one of them's called the superblock)
and generally ensuring things are emptied/readied.
 mount /dev/hdax /home
And here's the actual mount. During bootup /etc/fstab is read,
and this mount automatically done.
 At this point you have some options, depending on how much data you
have and your paranoia.
(a) mv /home.old/* /home
This is the simplest but can be problematic if there's
an error. mv is smart enough to do a copy/delete,
however, if the destination is not on the same
partition as the source -- which is the case here.
(b) cp -rp /home.old/* /home
This doesn't handle symbolic links all that well.
(c) (cd /home.old; tar cf - .) | (cd /home; tar xpf -)
This complicated-looking command is two tar commands end to end.
(d) cd /home.old; tar czf /somewhere/backup/directory/home.dir.tgz .
cd /home; tar xzf /somewhere/backup/directory/home.dir.tgz
This is (c) with compression and an explicit file as an
intermediary. The file is of course a backup of your home directory
at that point in time.
Looking forward to clarification.
"Woman? What woman?"
Posted via a free Usenet account from http://www.teranews.com
- Re: Moving /home
- From: zeno
- Re: Moving /home
- Prev by Date: Re: filesystem 100% full, but files do not occupy the space
- Next by Date: Re: "no valid devices were found on which to create new filesystems"
- Previous by thread: Re: Moving /home
- Next by thread: Awesome