|
Just Beginning
Introduction Is Ubuntu for You?* Which Ubuntu to pick? Installing Ubuntu inside XP Plan Partitions Download and Burn Ubuntu Burn ISO from Mac Install Desktop CD Ubuntu Install Alternate CD Ubuntu* Modest Specs Where's the Terminal? Password in Terminal Install Software Extra Repositories* File Permissions Security in Ubuntu Next Steps Beyond the Basics Playing Around Troubleshooting * Off-site link |
Create a separate home partition in Ubuntu
Introduction Important Disclaimers
Requirements
I'm using the example of a Ubuntu live CD and GParted, but you can very well use QTParted on Knoppix or DiskDrake on PCLinuxOS.
Making the new partition sudo apt-get update && sudo apt-get install gparted ntfsprogs
Then, press Alt-F2 and type gksudo gparted
In GParted, find the partition you want to resize in order to make room for your upcoming /home partition. In this case, I'm resizing /dev/hda5, but your partition may be different. Be sure to keep track of the names of your partitions--these names are very important (/dev/hda1, /dev/hdb1, /dev/sda2, etc.). Right-click on the partition and choose the Resize/Move option.
Choose the new size you want.
Then, in the new empty space, right-click and select New.
Choose to create the partition as Filesystem ext3.
When you're satisfied with your new partition layout, click Apply Once the changes have been applied, make note of the partition name of your new partition and then quit GParted. Now, in my example, my original partition that I shrunk was /dev/hda5, and it created a new partition called /dev/hda7, and my /home folder lives on /dev/hda1. It's very important that you substitute in your own appropriate partition names for the ones I'm using--you most likely will have only two partitions you're dealing with--the one you shrunk and the newly created one.
Using the new partition sudo mkdir /old
sudo mount -t ext3 /dev/hda1 /old sudo mkdir /new sudo mount -t ext3 /dev/hda7 /new
Now we're going to back up the /home directory on the old partition and move it to the new partition:
cd /old/home find . -depth -print0 | sudo cpio --null --sparse -pvd /new/ sudo mv /old/home /old/home_backup sudo mkdir /old/home Yes, one of those lines looks really complicated--please type it as is--or, if you're unsure of your typing skills, copy and paste it into the terminal. Believe me--the command is necessary.
Next, we're going to specify to use the new home partition as /home:
sudo cp /old/etc/fstab /old/etc/fstab_backup
sudo nano /old/etc/fstab
You'll then be taken to the nano text editor. Add in this line: /dev/hda7 /home ext3 nodev,nosuid 0 2
Then save (Control-X), confirm (Y), and exit (Enter) After you reboot, you should be now using your new /home partition.
If you find that you are running out of room on your old partition and you're pretty confident everything is working as it should be, then go ahead and delete the backup of home: sudo rm -rf /home_backup
What if it doesn't work?
Boot up the live CD, go to a terminal, and type: sudo mkdir /recovery
sudo mount -t ext3 /dev/hda1 /recovery sudo cp -R /recovery/home_backup /recovery/home sudo cp /recovery/etc/fstab_backup /recovery/etc/fstab Then, reboot.
|