Skip to main content

LINUX - ajouter/modifier SWAP

Si un fichier de swap existe déjà et qu'il faut en modifier la taille, commencer par le désactiver

swapoff /swapfile

Ensuite créer ou modifier le fichier (ex : 4G)

dd if=/dev/zero of=/swapfile bs=1024 count=4194304
sync
mkswap /swapfile
chmod 600 /swapfile
swapon /swapfile
swapon --show

Ajouter le fichier à fstab

vi /etc/fstab
   /swapfile swap swap defaults 0 0