Difference between revisions of "Linux: swap"

From RHS Wiki
Jump to navigation Jump to search
Line 7: Line 7:
 
If you need more than 1024 then change that to something higher.<br />
 
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 />
 
To enable it by default after reboot, add this line to /etc/fstab:<br />
 
# swap        /var/swap.1 swap    defaults        0  0
 
 
  /var/swap.1        none        swap    sw        0  0
 
  /var/swap.1        none        swap    sw        0  0
  

Revision as of 07:50, 14 March 2018

Create swap

sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo chmod 600 /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

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

edit /etc/fstab