Linux Swap and Swapfile: Difference between revisions

From WikiMLT
Line 1: Line 1:
<noinclude><!--[[Category:Linux_Server|?]]-->{{ContentArticleHeader/Linux_Server}}</noinclude>
<noinclude><!--[[Category:Linux_Server|?]]-->{{ContentArticleHeader/Linux_Server}}</noinclude>


== Add Swapfile ==
== Add/Remove Swapfile Short Guide ==
<syntaxhighlight lang="shell" line="1">
<syntaxhighlight lang="shell" line="1">
sudo fallocate -l 4G /swapfile
sudo fallocate -l 4G /swapfile

Revision as of 17:35, 17 August 2022

Add/​​​Remove Swap­file Short Guide

sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo nano /etc/fstab
/swapfile swap swap defaults 0 0

Check the swap and its us­age:

sudo swapon --show
sudo free -h