Re: Moving /home

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.

[1] mv /home /home.old
[2] mkdir /home

[3] chmod 755 /home

From where do I issue this command? The new partition? Or from / ?

[4] 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
following steps?

[5] mkfs.ext3 /dev/hdax

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.

[6] mount /dev/hdax /home

And here's the actual mount. During bootup /etc/fstab is read,
and this mount automatically done.

[7] 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.


Zeno (Geoffrey)


Relevant Pages

  • mounting drive
    ... When I use the df command it shows that 90% of /dev/hdd2 is full. ... mount /dev/hdb3 /mnt ... then I edited my fstab file just the line regarding /oldmnt/5.5 ... Ie. /usr looked like it was mounted to the correct partition ...
  • Re: Accidentally moved /libexec/
    ... If /tmp resides on its own partition, ... So mount /tmp and copy the file: ... The "make" command produces, ... If "make install" doesn't work correctly, ...
  • Re: Basic setup
    ... I was not sure if the command ... you'll need ntfs-3g package and mount it alike any other partition ... In fact it is a FAT partition. ... sudo: /etc/sudoers is mode 0551, ...
  • Re: dd and cp -a
    ... I redid /sdb5 with another ext3 file system and I can mount it to /mnt on this computer. ... Command: p # you enter the "p" part at the end ... - Check the partition you just made: ... Cpio will preserve any hard and soft links it finds and will also ...
  • Re: After system didaster how to prepare / save most important data ?
    ... mount a partition of the external drive to /mnt. ... sudo cp -a /home /mnt ...