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

on my machine running 11.04, I somehow managed to remove the partition which was used as swap, while I was repartitioning the hard drive. I then turned off swap and tried to reconfigure it with a different partition. (I had wanted to do that anyway.) "/etc/fstab" contained the following line:

/dev/mapper/cryptswap1 none swap sw 0 0

Looking at "/etc/crypttab", I found a reference to the old swap partition, sda7:

cryptswap1 /dev/sda7 /dev/urandom swap,cipher=aes-cbc-essiv:sha256

I changed the line to use the new partition /dev/sda2, which I had formatted as swap:

cryptswap1 /dev/sda2 /dev/urandom swap,cipher=aes-cbc-essiv:sha256

I then turned swap back on, and it seems to work. "free -m" now tells me I have the 4 GB free swap space available in the partition, even after restarting.

However, I am a little suspicious that it should be so easy to just rewire swap through one little file entry. Also, the Disk Utility does not show the partition as being used as swap; it says "Usage: -".

Have I missed something? Are there other or additional steps I should follow to properly reconfigure the swap partition?

share|improve this question

If /dev/sda2 has been properly formatted as swap, that change should be all that is needed. If free -m and swapon -s report the swap partition you can assume it is working.

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.