We exclude the VirtualBox and Partitioning part which is obviously straight forward step and easy to figure out. But here's a brief anway.
1. In Virtual Media Manager, create a new storage type (.vdi)
2. Use a GPart bootable CD (independent environment partitioner) or login and use GPart in existing guest OS and partition the new storage. e.g. Ext3 FS
3. Complete the partitioning process and proceed to terminal
Go to Applications > Accessories > Terminal to launch the terminal.
Mount /dev/hda1 and /dev/hdb1 (change the partition device names to the ones appropriate for your setup):
sudo mkdir /old
sudo mount -t ext3 /dev/hda1 /old
sudo mkdir /new
sudo mount -t ext3 /dev/hdb1 /new
sudo mount -t ext3 /dev/hda1 /old
sudo mkdir /new
sudo mount -t ext3 /dev/hdb1 /new
cd /old/home
find . -depth -print0 | cpio --null --sparse -pvd /new/
sudo mv /old/home /old/home_backup
sudo mkdir /old/home
find . -depth -print0 | cpio --null --sparse -pvd /new/
sudo mv /old/home /old/home_backup
sudo mkdir /old/home
The 2nd command works for me, if it doesn't for you, you might need to preface the commands with sudo in case one of the other users has subdirectories manually marked as unreadable to the user making the move.
sudo find . -depth -print0 | sudo cpio --null --sparse -pvd /new/
sudo cp /old/etc/fstab /old/etc/fstab_backup
gksudo gedit /old/etc/fstab
gksudo gedit /old/etc/fstab
/dev/hdb1 /home ext3 nodev,nosuid 0 2
For editing, i use vim, there's other choices like gedit etc...
After you reboot, you should be now using your new /home partition.
If you are confident everything is working as it should be, then go ahead and delete the backup of home:
sudo rm -rf /home_backup
The below issue never happened for me, but do take note of it.
(extracted from http://psychocats.net/ubuntu/separatehome)
What if it doesn't work?
If you reboot and are unable to log in because of some errors having to do with the $HOME/.dmrc file and/or .ICEauthority file, this may help.Boot into recovery mode (if you don't know how to do this, go to this section of another tutorial).
Once in recovery mode, type
chown -R username:username /home/username
chmod 644 /home/username/.dmrc
chmod 644 /home/username/.ICEauthority
exit
chmod 644 /home/username/.dmrc
chmod 644 /home/username/.ICEauthority
exit
Once you've exited recovery mode, resume the normal boot and log in.
If, for some reason, no matter what you try, the separate /home doesn't work, that's why we have a live CD, so we can fix things.
Boot up the live CD, go to a terminal
sudo mkdir /recovery
sudo mount -t ext3 /dev/sda1 /recovery
sudo cp -R /recovery/home_backup /recovery/home
sudo cp /recovery/etc/fstab_backup /recovery/etc/fstab
sudo mount -t ext3 /dev/sda1 /recovery
sudo cp -R /recovery/home_backup /recovery/home
sudo cp /recovery/etc/fstab_backup /recovery/etc/fstab
Most of the text were adapted and snapshots taken from http://psychocats.net/ubuntu/separatehome.
No comments:
Post a Comment