How should I correctly set up my encrypted swap partition? How can I ensure that the setup persists?
I'm running 14.04 using encrypted home folder. I noticed that occasionally my machine would grind to a complete halt for a minute or so. I finally realized that my machine showed that it did not have any swap space set up and my memory was filling up and nothing could be swapped when this happened.
/dev/sda6 is the partition of interest in my case.
How I Made Swap Work Yesterday
I reformatted the swap partition to
linux-swap format via
gparted and put its UUID, obtained from
blkid /dev/sda6, in the appropriate
/etc/crypttab entry. I then rebooted the system. Swap file was available and working correctly.
How Swap Stopped Working Again
Steps I've taken to diagnose this situation, things I modified, etc.:
free -mshows 0MB total swap space available
dmays@vipertooth:~$ free -m total used free shared buffers cached Mem: 5875 2238 3636 270 98 1007 -/+ buffers/cache: 1133 4741 Swap: 0 0 0
gpartedshows the swap partition as "Unknown"
blkid /dev/sda6returns exit code 2.
swapon -sshows only column headers
dmays@vipertooth:~$ swapon -s Filename Type Size Used Priority
swapon -afails with exit code 255
dmays@vipertooth:~$ sudo swapon -a [sudo] password for dmays: swapon: /dev/mapper/cryptswap1: stat failed: No such file or directory
cryptswap1 UUID=4602a330-ead0-4198-be26-47a5b16666e1 /dev/urandom swap,cipher=aes-cbc-essiv:sha256
fstab-- it appears my /home may not be encrypted???
# <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda5 during installation UUID=b09ec379-a94d-4905-b4ac-2f5c62b5605d / ext4 errors=remount-ro 0 1 # /home was on /dev/sda7 during installation UUID=d57bf732-77df-44fe-b547-d15a48dd1857 /home ext4 defaults 0 2 # swap was on /dev/sda6 during installation /dev/mapper/cryptswap1 none swap sw 0 0