Grimoire-
Command
.es

GNU+Linux command memo

Manage swap

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 (this creates 1GO empty file).

Format the swap file : # mkspaw /swap

Give secure rights : # chmod 0600 /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