I have a problem with expanding partition size in Linux. I tried Gparted, but I can't resize because un-allocated space does not appear.


In the above picture, it shows my primary and extended partitions. I want to extend "sda2".

  • 1
    I'm not entirely sure about it, but I think you can only extend the partitions which are closest to the the unallocated space, in your case the Extended one, but I could be mistaken. – Itai Ganot Dec 28 '17 at 11:53

You need unallocated space after or before a partition to extend into.

To do this, you can simply move sda4, then sda3 further down the drive. This will create unallocated space after sda2. Then, you can extend sda2's partition into the newly "unallocated" space.


@Itai Ganot is correct. You can only grow a partition if there is adjacent unallocated space immediately after the partition.

Disable swap, delete the swap partition, then grow the Extended partition, then grow the sda3 partition and filesystem, then re-create swap.



  • right-click on the swap partition (/dev/sda6), do "swap off"
  • that enables the resize/move for the swap partition. Use the resize/move to shift the swap partition up (to the end of the unallocated section)
  • use the edit-menu to complete that pending action.
  • right-click on swap partition, do "swap on"
  • resize /dev/sda5 by selecting it, using the resize/move dialog
  • finally, use resize2fs /dev/sda5 to extend the filesystem...

If you wanted to increase space in one of the other ext4 partitions (sda2 or sda3), you would have to first shrink the extended partition, moving that to provide unallocated space next to them. That's more steps...


Unfortunately this is not easy, and indeed I believe that earlier posts are wrong in 1 crucial way.

/dev/sda4 is an extended partition with 2 partitions in it. The first thing you need to do is delete BOTH of these partitions. Deleting the linux-swap partition is not a major, and can be done by simply turning off swap and deleting it (swapoff -a) - however /dev/sda5 may provide a bigger challenge.

Without knowing more about your setup, its not possible to advise exactly, however if it is mounted and part of your tree, copy the data from it into a temporary directory, then umount it and move the data from the temporary space to where it belongs (Luckily there is not much data there).

You need to do a similar thing to move the contents of /dev/sda3 into /dev/sda2.

Once you have removed the contents of /dev/sda3 and sda5, and removed swap, you can delete these partitions, and recreate a larger partition for /dev/sda3. You probably also want to create a swap file or a swap partition. Once you have created the swap area, format it with mkswap /dev/sdX or mkswap /path/to/file. You also need to go to /etc/fstab and remove / update the mounts as appropriate.

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.