Linux Swap and Swapfile: Difference between revisions

From WikiMLT
m (Spas moved page Swapfile to Linux Swap and Swapfile without leaving a redirect)
Line 1: Line 1:
<noinclude><!--[[Category:Linux_Server|?]]-->{{ContentArticleHeader/Linux_Server}}</noinclude>
<noinclude><!--[[Category:Linux_Server|?]]-->{{ContentArticleHeader/Linux_Server}}</noinclude>


== Swapfile Конфигуриране ==
== Add Swapfile ==
<syntaxhighlight lang="shell" line="1">
<syntaxhighlight lang="shell" line="1">
sudo fallocate -l 4G /swapfile
sudo fallocate -l 4G /swapfile
Line 12: Line 12:
<syntaxhighlight lang="shell-session">
<syntaxhighlight lang="shell-session">
/swapfile swap swap defaults 0 0
/swapfile swap swap defaults 0 0
</syntaxhighlight>Проверка:<syntaxhighlight lang="shell" line="1">
</syntaxhighlight>Check the swap and its usage:<syntaxhighlight lang="shell" line="1">
sudo swapon --show
sudo swapon --show
sudo free -h
sudo free -h

Revision as of 17:32, 17 August 2022

Add Swap­file

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