Size: 2355
Comment:
|
Size: 3781
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
=== Why this guide is superior to the others === I wrote this guide simple because I found some flaws in the other guides that I read, and I wanted to record my findings for future reference. I'm posting (and updating a bit) here for the benefit of others. Here are the benefits of this guide: * Partition and setup fstab first There are guides that use mount commands to do the initial partition mounting, and then setup fstab after you have moved your /home. If you mess up your fstab, then when you reboot, your system will loose track of your /home files. Setting up fstab first, and using sudo mount -a avoids this problem. * Use rsync to move the files There is lot's of debate of which command to copy your files to the new /home partition. This debate stems from a time in the past when cp was not able to do it properly. cp was not designed to be a powerful backup tool. cp has had improvements since, but why not use [[rsync|rsync]], a tool that is designed for backups like moving your /home, and much more. = The Guide = |
|
Line 3: | Line 11: |
** Setup Partitions ** This is beyond the scope of this page. You can probably use the ubuntu live cd, and gparted (somewhere under the system menu). Memorize or write down the location of the partition, something like /sda3 or /hda3. Its been suggested to use either ext2 or ext3 over vfat. Using vfat is not supported and may fail, since vfat does not support permissions. |
== Setup Partitions == This is beyond the scope of this page. [[HowtoPartition|Try here]]. Memorize or write down the location of the partition, something like /sda3 or /hda3. Its been suggested to use either ext2 or ext3 over vfat. Using vfat is not supported and may fail, since vfat does not support permissions. |
Line 7: | Line 15: |
** Setup Fstab ** gksu gedit /etc/fstab Add a line for your partition, maybe something like the following line: <pre> |
== Setup Fstab == Use your favourite editor to edit fstab, like: gksu gedit /etc/fstab Add a line for your partition; something like the following line: {{{ |
Line 13: | Line 21: |
</pre> | }}} |
Line 15: | Line 23: |
You should replace the ?'s with the UUID of the intended /home partition The UUID can be found by running these commands: cd /dev/disk/by-uuid/ ls -l |
You should replace the ?'s with the UUID of the intended /home partition, and the location should be a temporary one (/media/home is assumed in the rest of the guide). The UUID can be found with: {{{ blkid }}} |
Line 21: | Line 30: |
{{{ | |
Line 22: | Line 32: |
}}} | |
Line 26: | Line 37: |
** Copy /home to the New Partition ** sudo rsync -aS /home/. /media/home/. |
== Copy /home to the New Partition == {{{ sudo rsync -axS --exclude='/*/.gvfs' /home/. /media/home/. }}} The --exclude prevents rsync from complaining about not being able to copy .gvfs, but I believe it optional. Even if rsync complains, it will copy everything else anyway. ([[http://ubuntuforums.org/showthread.php?t=791693|See here for discussion on this]]) |
Line 30: | Line 44: |
** Make the Switch ** | == Make the Switch == Here is the point of no return. If the previous two steps worked, you should have no troubles. |
Line 32: | Line 49: |
{{{ | |
Line 33: | Line 51: |
}}} | |
Line 35: | Line 54: |
{{{ | |
Line 36: | Line 56: |
}}} | |
Line 41: | Line 62: |
{{{ | |
Line 42: | Line 64: |
}}} | |
Line 43: | Line 66: |
** After a reboot ** If everything is working, it should work after a reboot, but a reboot is the ultimate test. This guide has you move your /home to /old_home. If anything doesn't work, simply move that back, and take out any additions to your fstab. If everything IS working, you can delete /old_home, of course. |
Reboot to ensure that currently running programs use the new /home |
Line 46: | Line 68: |
** Technical Notes and Resources ** | == After a reboot == If everything is working, great, you can delete /old_home. If things aren't working, you can undo by moving your /old_home back to /home, and delete the line you added to fstab. = Technical Notes and Resources = |
Line 48: | Line 74: |
Line 49: | Line 76: |
Line 50: | Line 78: |
http://ubuntuforums.org/showthread.php?t=791693 |
Why this guide is superior to the others
I wrote this guide simple because I found some flaws in the other guides that I read, and I wanted to record my findings for future reference. I'm posting (and updating a bit) here for the benefit of others. Here are the benefits of this guide:
- Partition and setup fstab first
There are guides that use mount commands to do the initial partition mounting, and then setup fstab after you have moved your /home. If you mess up your fstab, then when you reboot, your system will loose track of your /home files. Setting up fstab first, and using sudo mount -a avoids this problem.
- Use rsync to move the files
There is lot's of debate of which command to copy your files to the new /home partition. This debate stems from a time in the past when cp was not able to do it properly. cp was not designed to be a powerful backup tool. cp has had improvements since, but why not use rsync, a tool that is designed for backups like moving your /home, and much more.
The Guide
Setting up /home on a separate partition is beneficial because your settings, files, and desktop will be maintained if you upgrade/reinstall/use a different distro. This works because /home has a subfolder for each user's settings and files. Also, fresh installs for linux typically like to wipe whatever partition they are being installed to, hence the need to put /home on a different partition.
Setup Partitions
This is beyond the scope of this page. Try here. Memorize or write down the location of the partition, something like /sda3 or /hda3. Its been suggested to use either ext2 or ext3 over vfat. Using vfat is not supported and may fail, since vfat does not support permissions.
Setup Fstab
Use your favourite editor to edit fstab, like: gksu gedit /etc/fstab Add a line for your partition; something like the following line:
UUID=???????? /media/home ext3 nodev,nosuid 0 2 (identifier ) (location ) (format) ( some options )
You should replace the ?'s with the UUID of the intended /home partition, and the location should be a temporary one (/media/home is assumed in the rest of the guide). The UUID can be found with:
blkid
Finally, mount the partition with:
sudo mount -a
Check that you can copy files over, at least as root (ie with sudo).
Copy /home to the New Partition
sudo rsync -axS --exclude='/*/.gvfs' /home/. /media/home/.
The --exclude prevents rsync from complaining about not being able to copy .gvfs, but I believe it optional. Even if rsync complains, it will copy everything else anyway. (See here for discussion on this)
Make the Switch
Here is the point of no return. If the previous two steps worked, you should have no troubles.
Rename your /home directory:
sudo mv /home /old_home
Re-create a /home directory with:
sudo mkdir /home
Edit fstab so that your new home partition actually points to /home, by changing /media/home to /home
and finally, remount the partition with:
sudo mount -a
Reboot to ensure that currently running programs use the new /home
After a reboot
If everything is working, great, you can delete /old_home. If things aren't working, you can undo by moving your /old_home back to /home, and delete the line you added to fstab.
Technical Notes and Resources
Rsync was chosen over cp and find|cpio because it seemed to maintain permissions.
http://ubuntu.wordpress.com/2006/01/29/move-home-to-its-own-partition/