I have a Ubuntu 12.04 VM that was partitioned with only 15gb of space that we need to expand. The VM is running on ESXi 6.0.

I've tried booting into a Ubuntu Live CD and using gparted to expand the partition but I'm running into issues because when I boot into the CD it inserts itself as /dev/sda2 and a swap of /dev/sda5. As a result, I'm not able to expand /dev/sda1 using the available space which is now below /dev/sda5.

I tried moving the space to be beside /dev/sda2 and /dev/sda5 but no matter what I do I'm not able to get it to expand /dev/sda1.

Below is a screenshot of things in gparted.


Any help would be greatly appreciated. Thanks in advance.

  • Move the linux swap to right of unallocated and then resize your main partition. – Raphael Oct 9 '15 at 15:54
  • That doesn't seem to work. I can move the unallocated space to the left of the swap but only if I make it part of sda2 and then it still won't let me move it to the left of sda2 since it is now part of that. – Windows Ninja Oct 9 '15 at 16:02
  • What if you delete the swap and then recreate it? It might be needed for you to relink the swap later but thats a very easy thing to do. – Raphael Oct 9 '15 at 16:07

You need to disable swap. Do it in gparted by right-clicking the swap partition and using the context menu. Or run in terminal

sudo swapoff -a

Then you will be able to move all partitions.

  1. Expand sda2 right.
  2. Move sda5 right.
  3. Shrink sda2 moving its left side right.
  4. Expand sda1.
  • This seems like it should be so simple but it won't let me do that. I have swap disabled and when I try to move sda2 right it won't let me. I can add the unallocated space to expand sda2 but it won't let me move it to the left of sda2. – Windows Ninja Oct 9 '15 at 16:10
  • OK. First expand sda2, then move sda5 right. Then move left side of sda2 right. You will have unallocated between sda1 and sda2. – Pilot6 Oct 9 '15 at 16:13
  • It won't let me do that now because the unallocated space is located inside of sda2 so I can't move it to the right of space that is within it. – Windows Ninja Oct 9 '15 at 16:14
  • You can't move unallocated space. You can move partitions. I updated my answer. You need to move sda5 inside sda2 first. – Pilot6 Oct 9 '15 at 16:16
  • Your updated answer might be working. I'll let you know in just a minute. – Windows Ninja Oct 9 '15 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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