what to do when you put your (K/X/Ed)Ubuntu onto a single partition but are now running out of space? Simple, export either your /home or /usr directories or both.
How you ask? Simple, just follow the steps below.
- Partitioning - Using gparted (either as a live cd or the one you may have on your system already) you partition your hard disk the way you want to. I prefer the former, as you may be certain that nothing is mounted and you are not in any danger of ruining your data. Having said that, there is no reason why you should screw it up with the distro version if reasonable care is taken. In this example I will assume that you created two extra ext3 partitions, one for /home (say /dev/hda7) and one for /usr (say dev/hda8). If you used the live CD your system may complain that it cannot successfully run fsck while booting. Ignore its whinging and carry on - you are about to fix it.
- Mount Points - OK, you're up again. For you to be able to mount those newly created partitions you have to create mount points (directories) and include them into your fstab. Let's create the mount points first:andCode:sudo mkdir /new_homeCode:sudo mkdir /new_usr
- fstab 1 - First we have to find out the relevant UUIDs for the newly created partitions hda7 and hda8. To do so, open a shell and typeto get the new UUIDs. Now for the fstab. I like vim but you can use your favourite editor open your /etc/fstab in root mode (sudo). Add the following lines to your fstabCode:sudo blkidSave your fstab and mount the new partitionsCode:# /dev/hda7 UUID=the_code_you_got /new_home ext3 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2 # /dev/hda8 UUID=the_code_you_got /new_usr ext3 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2andCode:mount /dev/hda7Code:mount /dev/hda8
- Copying - First we want to export your home folder (incl. all different users) to its new_home You should switch to your current home directoryand copy everything across to your new homeCode:cd /home.Code:sudo cp -a * /new_home
- Check - OK, the hardest bit is done. It is not a bad idea before wiping your original home to check that what you have done is actually working. So let's tell the system that /dev/hda7 is going to be your /home partition. Again, you need to edit your fstab and adjust the followingto readCode:# /dev/hda7 UUID=the_code_you_got /new_home ext3 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2Now reboot and pray If your system boots up fine you should change your fstab back again to readCode:# /dev/hda7 UUID=the_code_you_got /home ext3 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2and reboot again.Code:# /dev/hda7 UUID=the_code_you_got /new_home ext3 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2
- Delete - OK, you're back to your old, clogged system. It is time to delete your old /home and create some space! To do so open a shell andfollowed byCode:cd /home. Once this is done change your fstab again to readCode:sudo rm -R *and reboot.Code:# /dev/hda7 UUID=the_code_you_got /home ext3 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2
- Repeat steps 4 to 6 if you need to free up more space and export your /usr directory as well.