linux_wiki:swap_files

This is an old revision of the document!


Swap Files

Description: Swap can be increased by resizing partitions, adding new partitions formatted as swap, or by creating swap files. Swap files are useful if you need to utilize existing volumes and cannot resize the swap partition.

Create a block file called “swapfile” in /home/ that is 1GB.

dd if=/dev/zero of=/home/swapfile bs=1024 count=1048576

Explanation:

  • bs: write 1024 bytes at a time (or 1K)
  • count: 1024K * 1024K = 1048576K (or 1GB)
mkswap /home/swapfile
swapon /home/swapfile
swapon -s

Edit /etc/fstab and add:

/home/swapfile    none    swap   sw    0    0
  • linux_wiki/swap_files.1423192361.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)