linux swap file

dd if=/dev/zero of=/path/to/file.swap bs=1G count=4
chown root:root /path/to/file.swap
chmod 0600 /path/to/file.swap
mkswap /path/to/file.swap
swapon /path/to/file.swap

edit /etc/fstab

/path/to/file.swap none swap sw 0 0
sysctl vm.swappiness

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.