How to enable linux swap partition?
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Thinking It Over
--
Chapters
00:00 How To Enable Linux Swap Partition?
00:18 Accepted Answer Score 27
01:07 Answer 2 Score 9
01:27 Answer 3 Score 0
01:59 Answer 4 Score 0
02:20 Thank you
--
Full question
https://superuser.com/questions/862994/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #partitioning #linuxmint #swap
#avk47
ACCEPTED ANSWER
Score 27
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 (make sure you put the right partition name for this command as you might easily destroy the contents of another partition):
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.
ANSWER 2
Score 9
GUI way:
- start GParted (builtin Disks utility won't do)
- ensure the partition is formatted as linux-swap (mine was displayed as swap in Disks but non-formatted in GParted), apply the formatting operation
- right-click, 'swapon'. Done.
ANSWER 3
Score 0
I had a similar problem.
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.
I found that the UUID shown in /etc/crypttab was incorrect.
I ran blkid to find the correct UUID for the swap partition.
Modifed /etc/crypttab to read the correct UUID.
and swap is now loaded correctly.
Hope that helps.
ANSWER 4
Score 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.