I want to increase the size of Linux-swap partition after installing ubuntu(not during the ubuntu installation wizard).

enter image description here

I want to increase /dev/sda9 partition from 9.31GB to 16 GB.Please help me.

  • possible duplicate of Ubuntu 12.04 increase swap – Warren Hill Oct 28 '13 at 15:07
  • 2
    @WarrenHill, that's not a good dup candidate since this question clearly shows the current partition layout with free space at the end and the other one doesn't, so it was generically answered with "add a swap file". – psusi Oct 28 '13 at 15:19
  • For a clearcut explanation see this askubuntu.com/a/389067/202806 – Avinash Raj Dec 14 '13 at 2:50

Your swap partition is a logical partition, which lives inside the extended partition ( /dev/sda2 in your case ). To expand it, you need unallocated space after it, but inside the extended partition. You have unallocated space after the extended partition, so you have to expand the extended partition to move the unallocated space into the extended partition, then you can expand the swap partition.

In order to resize a partition, it must not be mounted ( the key icon shows it is mounted ). You will need to right click on the swap partition and choose to unmount/swapoff so you can expand it. Since your root partition is also a logical partition though, you will not be able to unmount it, and thus, leave the extended partition unlocked so you can resize it, so you will need to do this from the livecd instead.

  • can i do it from gparted livecd. – Avinash Raj Oct 28 '13 at 17:49
  • @AvinashRaj, sure, you just have to not be running from the hard disk. – psusi Oct 28 '13 at 20:16
  • is there no need to add the swap file? – Avinash Raj Oct 29 '13 at 3:30
  • i tried according to your method (boot into the gparted livecd and resize the dev/sda8 partition,and created 10 Gb of unallocated space just below dev/sda8 partition.Then click on the swap partition and tries to increase it,but the unallocated space was not shown while resizing linux-swap partition.What can i do?plz help. – Avinash Raj Oct 29 '13 at 5:50
  • @AvinashRaj, I said you need to resize sda2, not sda8. – psusi Oct 29 '13 at 14:34

You'll need to reboot into a Live environment (CD, USB, etc) so that the partitions aren't mounted when you try to resize them.

From there it's just a case of loading up Gparted (it seems you're good friends already) and scaling up.


Like @Oli Says you need that partition be unmounted to resize it. So, you can use a pendrive for some minutes to help in this situation.

First follow this tutorial to create a swap partition in your pendrive. Then, unmount your original swap partition and resize with any tool like gparted or fdisk.

Good Luck!


Go to this link How to increase swap space? In this link all the different cases of available unallocated spaces available are well explained

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.