A while back I was messing with my swap space, turning it on and off using sudo swapon -a and sudo swapoff -a. Since I generally have enough RAM anyway (6GB) I totally forgot about it. Currently I am running some quite hefty and memory-hungry analyses which are bringing me to the borders of my 6GB. I suddenly saw that my memory was still turned off, so I wanted to turn it on using sudo swapon -aagain. Unfortunately, that gave me an error:

swapon: /dev/mapper/cryptswap1: stat() has failed: File or folder does not exist.

I had a look at my fstab, which looks like this:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda1 during installation
UUID=f2ef1c1b-f606-44ed-9405-979fb6fa8ca4 /               ext4    errors=remount-ro 0       1
# /home was on /dev/sda3 during installation
UUID=7a1f29ef-3fcd-40ce-8e2a-4b9181a46863 /home           ext4    defaults        0       2
# swap was on /dev/sda2 during installation
#UUID=d0ef2314-6a84-432d-94f8-0d46c91c3d99 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0

Whenever I see any option to encrypt something, I always do, not only because I don't like having people snooping around my files, but also for the high-tech James Bond-feel of it.. :) . Supposedly I now need to re-encrypt my swap in order for it to be usable again. I wouldn't have a clue of how to do that though.

So my questions are:

  1. Is the solution to my problem indeed the re-encryption of my swap-partition?
  2. And if so; how do I re-encrypt my swap partition?

All tips are welcome!


I am no sure if I understood your question properly, but I MIGHT have an answer to your question.

First of, what you were installing your OS, did you see on the partitionning part on the installer that you can either erase your hard drive or install alongside your current or do the partitionnig manually?

Now, you choose to do the partitionning manually.

Then, I advise you to chose the same partition for "/" (and for "/home" if you do not want to delete your files).

You have to chose/create another partition for your "swap space".

It is the only way I know to get your swap back. Once you did this, tell me!

Thank you.

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.