Gérer le swap
1. Via partition
Make a suitable partition with : gparted
or cfdisk
(or fdisk
)
Format the new partition : # mkswap /dev/sdx1
Add the new swap partition to : /etc/fstab
.
/dev/sdx1 swap swap defaults 0 0
Run # swapon -a
to activate the new swap.
2. Via file
Create the file : # dd if=/dev/zero of=/swap bs=1M count=1000
[1] (this creates 1Go empty file).
Give secure rights : # chmod 0600 /swap
Format the swap file : # mkswap /swap
Add the new swap partition to : /etc/fstab
.
/swap swap swap defaults 0 0
Run # swapon -a
to activate the new swap.
3. Deactivate swap
# swapoff -a
4. Add fstab
options to allow the machine to hibernate
As per tok0z advice :
Add the resume=swap-device
parameter in your fstab
swap definition to allow the machine to hibernate
.
And resume_offset=<swap_file_offset>
if you use a swap file (instead of swap partition),
where <swap_file_offset>
can be obtain via filefrag -v swap_file
as explained on Arch wiki.