Creating a swap file

From hakchi
Jump to: navigation, search

To create swapfile (One time only)[edit | edit source]

fallocate -l 256MB /media/256MB.swap

dd if=/dev/zero of=/media/256MB.swap bs=1M count=256

chmod 600 /media/256MB.swap

mkswap /media/256MB.swap

To enable swap memory[edit | edit source]

swapon /media/256MB.swap

To disable swap memory[edit | edit source]

swapoff /media/256MB.swap

Note[edit | edit source]

Swapfile is disabled each time the console is booted unless you add `swapon` to the preinit...