Increase the /home partition without losing the data

I have a 320 GB harddrive with three partitions / , /home and swap. What I want to do is change the size of swap which now is 8 GB to 5 GB and append that 3 GB to my /home partition. I have searched through the web for this but don't seem to find a proper way to increase my home partition. Can anyone help ? By the way, I know how to decrease size of swap I just need the proper way to append that unallocated 3 GB of space to my /home partition without loosing the data. Thank You

enter image description here

gparted

enter image description here from live-usb i can't increase my /home size


Solution 1:

You will need Ubuntu or Gparted live CD for this. Boot from live CD and run gparted. If swap and home partitions are adjacent to each other then you can simply shrink your swap partition and extend the home and that will do. To do this first right click on the swap partition, if you see a swapof option then click it. enter image description here

This will make ubuntu to stop using swap and enable the resize/move option for this partition. Now again right click on the swap partiton and click on resize/move.

enter image description here

A new dialog will appear where you can select the new size for your partition and select whether the free space appears to left or right of the swap partition. Enter the new values and click the Resize/Move button.

enter image description here

Now you can resize your home partition in a similar manner to use the freed space. Just make sure the partition is unmounted, then right click on the partition in gparted and select Resize/Move. From the dialog that appears extend your home partition to use the available space and click on the Resize/Move button. Now the new sizes of the partitions can be seen in the gparted main window. The changes are NOT APPLIED to the disk at the moment. Once again look at the partitions and their sizes. If you are satisfied then go to Edit menu and click on Apply All Operations. A confirmation dialog will appear asking if you are sure, if you are click yes and the changes will be applied to the disk.

If you / partition is between swap and home then you will need to shrink the swap, move / partition to left and then extend the home partition.

NOTE: Normally things go smoothly i.e without any problem but sometime they don't and therefore it is important that you backup your data before making any changes to your harddisk. Its better to be safe than sorry. Best of luck.

Solution 2:

Partitions cannot be fragmented, i.e. those cannot be split up in chunks. You have to follow these steps:

  1. Move the swap (sda6) to the end of the extended partition (filling the unallocated space)
  2. Expand the size of /home (sda5) with the new unallocated space.
  3. Apply these operations

When messing with partitions, I always make a backup using Clonezilla to an external HDD in case something goes wrong.