Difference between revisions of "Swap"

32 bytes removed ,  2 years ago
Fixes, formatting
(Marked this version for translation)
(Fixes, formatting)
(One intermediate revision by the same user not shown)
Line 131: Line 131:
==Creating and Enabling a Static Swapfile== <!--T:41-->
==Creating and Enabling a Static Swapfile== <!--T:41-->
</translate>
</translate>
{{tip|<translate><!--T:42--> There is no reason you can't have both a swap partition and a swapfile.  This is an easy way to add more swap without repartitioning.</translate>}}
{{tip|<translate><!--T:42-->
There is no reason you can't have both a swap partition and a swapfile.  This is an easy way to add more swap without repartitioning.
</translate>}}




<translate><!--T:43--> First create and intialize the file to hold the swap.  For example, to create a 4GB swapfile, you could use the command:</translate>
<translate><!--T:43-->
  sudo fallocate -l 4G /swapfile
First create and intialize the file to hold the swap.  For example, to create a 4GB swapfile, you could use the command:
  sudo mkswap /swapfile
</translate>
 
  sudo dd if=/dev/zero of=/swapfile bs=1M count=4096 status=progress
 
 
<translate><!--T:44-->
Set the appropriate permissions on the file.  It should be readable and writable only by {{ic|root}}.  This can be done with the command:
</translate>
 
  sudo chmod 600 /swapfile




<translate><!--T:44--> Set the appropriate permissions on the file.  It should be readable and writable only by {{ic|root}}.  This can be done with the command:</translate>
<translate><!--T:45-->
sudo chmod u=rw,go= /swapfile
Next we need to format and enable the swapfile:
</translate>


sudo mkswap /swapfile


<translate><!--T:45--> Next we need to enable the swapfile with the {{ic|swapon}} command.  Following our example above this could be done with:</translate>
  sudo swapon /swapfile
  sudo swapon /swapfile




<translate><!--T:46--> In order to ensure that the swap is enabled at boot we can add an entry to {{ic|/etc/fstab}}.  You can add the line to fstab manually or using the command:</translate>
<translate><!--T:46-->
In order to ensure that the swap is enabled at boot we can add an entry to {{ic|/etc/fstab}}.  You can add the line to fstab manually or using the command:
</translate>
 
  sudo bash -c "echo /swapfile none swap defaults 0 0 >> /etc/fstab"
  sudo bash -c "echo /swapfile none swap defaults 0 0 >> /etc/fstab"


<translate>
<translate>
==Swapfiles on BTRFS== <!--T:47-->
==Swapfiles on BTRFS== <!--T:47-->


48

edits