Difference between revisions of "Linux: swap"

From RHS Wiki
Jump to navigation Jump to search
(Created page with "== Modify swap partition == swapoff /dev/sda3 mkswap /dev/sda4 swapon /dev/sda4 edit /etc/fstab")
 
Tag: visualeditor
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Modify swap partition ==
+
==Create swap==
 +
<syntaxhighlight lang="bash">
 +
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
 +
sudo chmod 600 /var/swap.1
 +
sudo /sbin/mkswap /var/swap.1
 +
sudo /sbin/swapon /var/swap.1
 +
</syntaxhighlight>If you need more than 1024 then change that to something higher.<br />
 +
To enable it by default after reboot, add this line to /etc/fstab:<br />
 +
/var/swap.1        none        swap    sw        0  0
 +
 
 +
==Modify swap partition==
 
  swapoff /dev/sda3
 
  swapoff /dev/sda3
 
  mkswap /dev/sda4
 
  mkswap /dev/sda4

Latest revision as of 08:16, 11 November 2019

Create swap[edit]

sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 
sudo chmod 600 /var/swap.1 
sudo /sbin/mkswap /var/swap.1 
sudo /sbin/swapon /var/swap.1

If you need more than 1024 then change that to something higher.

To enable it by default after reboot, add this line to /etc/fstab:

/var/swap.1        none        swap    sw        0   0

Modify swap partition[edit]

swapoff /dev/sda3
mkswap /dev/sda4
swapon /dev/sda4

edit /etc/fstab