How to enable SWAP without restart

I use Conky to monitor my computer status, e.g. current cpu, memory and swap usage network connections etc. A few weeks ago I noticed that my SWAP-partition was not enabled. Maybe Conky was wrong, but I took a deeper look at it:

$ cat /proc/meminfo
SwapTotal:             0 kB
SwapFree:              0 kB

Conky was right and the Swap-partition wasn’t enabled. My Swap-partition is encrypted, maybe there is a problem with the encryption, but first I looked at the fstab, to make sure that the Swap-partition is uncommented:

$ cat /etc/fstab:
/dev/mapper/crytswap	swap	swap	defaults	0	0

The Swap-partition is uncommented, but the name of mapped device “crytswap” is not correct. I tried to verify my assumption:

# ls -l /dev/mapper/
lrwxrwxrwx 1 root root       7 Dec  5 10:26 cryptswap -> ../dm-0

I was right, the correct name is “cryptswap” and not “crytswap”. So I changed the entry in /etc/fstab to:

/dev/mapper/cryptswap	swap	swap	defaults	0	0

The next step was to enable the Swap-partition (without restarting the computer):

# swapon -a

Last step is to verify that the Swap partition is enabled:

$ cat /proc/meminfo
SwapTotal:        995992 kB
SwapFree:         995992 kB

Here we go. Swap is enabled and Conky was also lucky 🙂


Posted on January 9, 2014, in Command-Line, Configure, Troubleshooting and tagged , , , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: