11

I've got a swap partition, but the System Monitor in Linux Mint says, 'Swap not available'. I guess I've forgot to set 'Use as: swap' on install.

How to fix this?

17

You can simply add a line declaring your swap partition to /etc/fstab. So, if your swap partition is /dev/sdaX, add this entry in fstab:

/dev/sdaX      none            swap      sw         0        0

If your swap partition wasn't properly formatted as such, you can initialize it:

sudo mkswap /dev/sdaX

To enable the newly declared swap partition, just use:

sudo swapon -a

(or reboot).

EDIT: if you have an encrypted swap partition, instead of /dev/sdaX, you will have to use its name (/dev/mapper/something), look in /etc/crypttab, the name is on the first column.

  • Interestingly, GParted added the following line: /dev/mapper/cryptswap1 none swap sw 0 0 – ansgri Jan 10 '15 at 9:57
  • ah interesting, it seems that there is some disk encryption enabled, at least for the swap partition... – Ale Jan 10 '15 at 9:58
  • 1
    ... Encrypted swap? Good grief. – Shadur Jan 10 '15 at 17:53
  • 2
    @Shadur: Not sure if you're being serious, but if you're using any kind of disk encryption (say, you don't want your files and passwords to be stolen if you lose your laptop), then you most certainly do want to use encrypted swap, too. Otherwise, you compromise security as soon as you hibernate your laptop. Besides, there's no good reason not to encrypt swap nowadays, since the cost of encryption is totally negligible compared to the cost of swapping the data to disk in the first place. – Ilmari Karonen Jan 10 '15 at 19:22
  • 1
    @Shadur: encrypted swap will possibly become default in the future. It is already the case in MacOS X since version 10.8, and can be enabled (from command line) on Windows since Vista. Except on very low-end hardware, I don't see a reason not to use encrypted swap. – Ale Jan 11 '15 at 14:38
7

GUI way:

  1. start GParted (builtin Disks utility won't do)
  2. ensure the partition is formatted as linux-swap (mine was displayed as swap in Disks but non-formatted in GParted), apply the formatting operation
  3. right-click, 'swapon'. Done.
  • 1
    This won't be persistent across reboot. Or does gparted automatically edit fstab? – Ruslan Jan 10 '15 at 10:39
  • @Ruslan: seems it does (see ansgri's comment to my post) – Ale Jan 10 '15 at 12:15
0

I had a similar problem.

  1. I used the "GUI way" posted by ansgri to change the format for the swap partition from unknown to linux-swap.This didn't solve the problem, but may have helped.

  2. I found that the UUID shown in /etc/crypttab was incorrect.

  3. I ran blkid to find the correct UUID for the swap partition.
  4. Modifed /etc/crypttab to read the correct UUID.

    and swap is now loaded correctly.

Hope that helps.

0

I did the GUI method as well but also changed the UUID in both /etc/crypttab and /etc/fstab to match the info displayed by blkid, i restarted and it worked, as a side note with my SWAP being at 36gb and my RAM being 32gb my hibernation button works now, since the SWAP is larger than the RAM.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.