Difference between revisions of "Linux: swap"

From RHS Wiki
Jump to navigation Jump to search
Line 8: Line 8:
 
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
+
  # swap        /var/swap.1 swap    defaults        0  0
 
+
/storage/swap/swap.1        none        swap    sw        0  0
  
 
== Modify swap partition ==
 
== Modify swap partition ==

Revision as of 21:19, 21 February 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:

# swap        /var/swap.1 swap    defaults        0   0
/storage/swap/swap.1        none        swap    sw        0   0

Modify swap partition

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

edit /etc/fstab