Ubuntu – Gparted – How to move partition to extend the size

gpartedmountpartitioningrootswap

I want to extend the sda1 to take the full unallocated size:

enter image description here

The steps are as the following:

  1. Move sda2 to the right

  2. Increase the size of sda1 to fill the space

But the thing is, I didn't get how to do so! Any help?

Best Answer

  1. Boot a live system (for example boot from a usb stick).
  2. Resize sda2 all the way to the right.
  3. Move sda5 all the way to the right inside sda2.
  4. Resize sda2 from the left to the right.
  5. Resize sda1 all the way to the beginning of sda2.

Apply after each single step in this case. Changing size on the right hand side will go fast, changing size on the left hand side will take way more time.


Make sure to have a backup. If you don't have one, the closest point in time is always the best point in time to make one. Especially when changing partitions.

You can make one within the live sessions or you can use the opportunity of being in a live session to copy your entire HDD to an external HDD. Do the latter one only if you have a lot of storage space on your external HDD. You can use this command:

dd if=/dev/sda bs=8M | gzip -9 > /yourExternalHddMountPoint/folder/image.gz

9 is the best compression. A lower number will make the process faster but will take more storage space on your external HDD.

If you choose to copy your HDD rather than backing up you files, you can always take the entire HDD back to the previous state with this command (in a live session, of course):

cat /yourExternalHddMountPoint/folder/image.gz | gunzip -d -c | dd of=/dev/sda bs=8M
Related Question