Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

I have added some RAM to my netbook. I'd like to save an option to hibernate my computer, so I have to increase my SWAP from 2GiB to 4GiB.

My /etc/fstab looks like this:

UUID=57b6e4ca-86f6-440d-8d45-2295a86a946b /               ext4    errors=remount-ro 0       1
/dev/mapper/sda6_crypt /home           ext4    defaults        0       2
/dev/mapper/sda5_crypt none            swap    sw              0       0

My /etc/crypttab looks like this:

sda5_crypt UUID=17ec5831-e49e-4eb0-aa63-05101038a85c none luks,swap
sda6_crypt UUID=2a01b2a0-e954-4a97-9202-6cdbc0152e73 none luks

Appreciate any help.

share|improve this question

Try booting on a Live CD or Live USB stick. Then choose "Try Ubuntu without installing it". When you get to the desktop, launch the app called Gparted.

In this application, you will be able to change the size of the partitions, including the swap one. But the latter one requires you first to right-click on the swap partition line and select "Swap off". Then you will be able to make your changes.

share|improve this answer
Note that gparted will see the encrypted partitions as an "unsupported format" and won't be able to resize them. – thomasrutter May 16 '12 at 23:01
Ah… My mistake, then. – Agmenor May 17 '12 at 3:12

Because the partitions are encrypted, it's not possible to resize them using the normal tools such as parted/gparted. This is because the actual partition on disk is not a valid file system, but just an encrypted block, which appears like a string of seemingly random data.

You can delete them and totally recreate them. If you only need to resize your swap, and to do this you don't need to resize any other (encrypted) partition, then trashing and re-installing it is going to be easy. But I assume that's not the case, as not many people will just leave unallocated space on the drive should they want to increase the swap partition (unless you're able to expand it into your un-encrypted root partition?). Otherwise you may be able to recreate your swap and home partitions, and copy across your files from an external drive. You will probably need to be familiar with cryptsetup and the way luks works. Otherwise a clean install is in order.

A common configuration with LUKS is to use LVM on top of it, which gives you a much easier way of resizing partitions inside your encrypted block - because LUKS means you have multiple partitions inside the same block, you don't need to resize the container to resize the partitions inside. If you are going to resort to a clean install, the alternate installer CD makes setting up a LUKS partition with LVM on top of it easy.

Most online tutorials you'll find about resizing a LUKS partition are actually about resizing LVM volumnes inside of one instead.

share|improve this answer
I have unencrypted ROOT partition which I have already shrinked. Then I have moved Unallocated space to extended partition. Now I have – khaard May 17 '12 at 9:05
I have shrinked / partition and moved unallocated space do extended partition. Now I have: unallocated space (2g), encrypted swap (2g), encrypted /home (290G). All within extended partition. Problem is I cannot find any tutorial about creating encrypted swap partition after installation and without using /dev/random to generate random keys. I've get used with entering passphrases twice. Encrypted swap With random keys would make hibernation impossible. BTW I have used Alternate CD to create LVM and LUKS. At this moment due to my huge data amount /home reinstall is not an option. – khaard May 17 '12 at 9:15
up vote 0 down vote accepted

There is no way to enlarging encrypted swap partition. The solution is to reinstall the system with setting up new partition.

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.