Allocating non-contiguous free space to an existing partition
I can't figure out how to add all the "/dev/sda3" space to my /dev/sda1/ .. I tried everything, but /dev/sda1/ can't go over 5.26GB.
Solution 1:
Unfortunately, gparted does not support online resizing of partitions. Thus, if you don't have advanced knowledge of Linux, you should boot from a Linux CD (e.g. the Ubuntu install CD/USB) and run gparted from there.
The easiest way then is to move the swap partition out of the way:
- right-click on /dev/sda5, Select swapoff (if applicable)
- delete /dev/sda5 (it doesn't contain any data, so don't worry)
- delete /dev/sda2
- re-create /dev/sda2 using right-click->New
- set the "Size" to 1792 MB, the "Free space following" to 0 and the "Create as" to "Extended Partition"
- then, re-create /dev/sda5 inside /dev/sda2
- set "Size" to the maximum available (~1792MB) and set the "File System" to "linux-swap".
- Finally, you can right-click on /dev/sda1, select "Resize/Move" and resize it
After you've rebooted, you should also update the UUID of the new swap partition. Do this:
sudo swapoff /dev/sda5 # this might give an error message which you can ignore
sudo mkswap -U`grep -E '^UUID.+swap\W+sw' /etc/fstab | cut -d= -f2 | cut -d' ' -f1` /dev/sda5
It should return Setting up swapspace ...
and some numbers, and a UUID.
Then you can re-enable the swap:
sudo swapon -a
Solution 2:
I am not 100% sure I remember exactly, but try first to move the swap
partition so that the unallocated space is shown next to sda1
, then it should be possible to enlarge that partition.
Solution 3:
If you have /dev/sda2
or a swap
partition immediately after /dev/sda1
, then you'll need to shrink and move them to the right so the free space is shown between /dev/sda1
and the other partitions.
Just note that this can take, for a 1TB HDD, over 10 hours to complete if there is a lot of data.