how can I move my /home directory to a brand new hard drive?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I've seen syg00's posts before and his advice should be taken above my own. Really. But let me point out in case it isn't clear, that it isn't enough (as far as I know) to have a home directory on the new partition, but in fstab /home needs to be empty and be the mount point of the new partition (/dev/hda /home etc.) Sorry if this was obvious.
Also if you use cp -a make sure that there aren't any hard or symbolic links that are missed.
1) partition the new drive and format the partition. (done)
2) create a temporary mount point for the partition: mkdir /mnt/home.
3) mount the new partition: mount /dev/sdb1 /mnt/home
4) copy your current home directory to the new partition. You can use 'cp -Ra' (recursive copy), but I prefer to use tar: ( tar cf - /home ) | ( cd /mnt/home ; tar xvfp - )
5) rename /home to something else. If anything goes wrong with the first four steps, all you need to do is name it back to /home.
6) unmount /mnt/home. You can now delete temporary directory /mnt/home. It has served it's purpose.
7) edit /etc/fstab to make an entry for /home: /dev/sdb1 /home ext3 (or whaterver) <boot parameters>
8) reboot, and /home should now be in it's own partition. Check it over. Compare it to the renamed /home (probably run md5 of diff to compare them). If all is well, you can now delete the renamed home directory.
Last edited by bigrigdriver; 03-03-2008 at 08:46 PM.
1. I succesfully copied files over after a manual mount. I renamed /home to /homebackup and edited fstab but on reboot it does not find the new /home directory. I think I messed up my fstab entry. Here is my current /etc/fstab - /home does not mount. This is on a centos 5 box.
1. If you renamed /home to /homebackup, then you no longer have the mount point that the mount command is looking for. You need to create this with "mkdir /home". After that if you run "mount /home" it should mount properly, and come back up on reboot.
2. The 5% for root is for after the drive is 95% full. It will report to you that it is 100% full and stop normal users from writing to it even though it is only 95% full. This is to allow the root user to have time to fix the drive after it is full before it becomes critical and to allow daemons to keep logging. It probably isn't necessary for /home. It is controlled with the -m option for mke2fs.
From "man mke2fs":
Specify the percentage of the filesystem blocks reserved for the
super-user. This avoids fragmentation, and allows root-owned
daemons, such as syslogd(8), to continue to function correctly
after non-privileged processes are prevented from writing to the
filesystem. The default percentage is 5%.