Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

enter image description here gparted screenshot 1

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.

share|improve this question
up vote 7 down vote accepted

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
share|improve this answer
All worked but the last bit with the UUID is it necessary? I'm on a VM. g@g-ubuntu-64:~ $ sudo swapoff /dev/sda5 swapoff: /dev/sda5: swapoff failed: Invalid argument – George Katsanos May 10 '13 at 10:07
The swapoff command may indeed fail, that's not a problem. If you don't update the UUID, you won't have any swap space, which can cause problems. Also, hibernation will not work - I don't know if it's relevant for you or if hibernation would work in VM in the first place. – Stefan Seidel May 10 '13 at 12:59
I have an annoying message at boot, I'd like to have swap, what's the alternative to the swapoff command? – George Katsanos May 10 '13 at 14:16
ah ok swapoff wasn't needed. Thanks! – George Katsanos May 10 '13 at 14:43
Good answer, that's what I would do too. But, excuse me for asking, what's the point in having the swap inside an extended partition that only contains it and nothing more? – Sekhemty May 12 '13 at 20:28

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.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.