[8GB]
1 |
dd if=/dev/zero of=/swapfile bs=1024 count=8290304 |
[1GB]
1 |
dd if=/dev/zero of=/swapfile bs=1024 count=1048576 |
1 2 3 4 |
chmod 600 /swapfile mkswap /swapfile swapon /swapfile echo "/swapfile swap swap defaults 0 0" >> /etc/fstab |
Set swappiness
A swappiness setting of zero means that the disk will be avoided unless absolutely necessary (you run out of memory), while a swappiness setting of 100 means that programs will be swapped to disk almost instantly.
1 2 3 |
$ cat /proc/sys/vm/swappiness or # sysctl -n vm.swappiness |
Set via command line
1 |
sysctl -w vm.swappiness=0 |
Or simply modify /etc/sysctl.conf adding this line:
1 |
vm.swappiness = 0 |