Gparted - How to move partition to extend the size
I want to extend the sda1 to take the full unallocated size:
The steps are as the following:
Move sda2 to the right
Increase the size of sda1 to fill the space
But the thing is, I didn't get how to do so! Any help?
Solution 1:
- Boot a live system (for example boot from a usb stick).
- Resize sda2 all the way to the right.
- Move sda5 all the way to the right inside sda2.
- Resize sda2 from the left to the right.
- 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
Solution 2:
Updated answer. Since I wrote the following I've noticed that according to the screenshot, your swapspace is not in use. If it were in use it would show as mounted. Since it is not being used (cannot be benefited from) you may as well first delete the swapspace (sda5) and then the extended partition. This will free up still more space and make the task of expanding the primary partition much easier.
--- original answer --- Generally speaking you cannot resize the partition you are booted from for the simple reason that before you can resize or move a partition, you must unmount it, and if you could unmount it, your system would stop working.
First backup your data if you have a brain. I've read too many sob stories here not to recommend this first.
Boot to external media such as a portable external hard drive to which Ubuntu is installed, rather like the Mubuntsticks self-booting flash drives (pen drives) I keep promoting as a solution. Alternatively you can use a bootable ubuntu live CD/DVD or Ubuntu installation boot flash drive of you have one.
Now, provided you are ready, moving the second partition to the right involves selecting that partition, right clicking, select resize move, and make sure the space after it is ZERO. After you do that, you should be able to resize the primary partition, provided it is not mounted.