Hack 69. Create a swap file system.
by Ramesh
Create a file for swap usage as shown below.
- # dd if=/dev/zero of=/home/swap-fs bs=1M count=512
- 512+0 records in
- 512+0 records out
- # ls -l /home/swap-fs
- -rw-r--r-- 1 root root 536870912 Jan 2 23:13 /home/swap-fs
Use mkswap to setup a Linux swap area in the /home/swap-fs file that was created above.
- # mkswap /home/swap-fs
- Setting up swapspace version 1, size = 536866 kB
Once the file is created and has been setup for Linux swap area, it is time to enable the swap using swapon as shown below.
- # swapon /home/swap-fs
Add the following line to /etc/fstab and reboot the system for the swap to take into effect.
- /home/swap-fs swap swap defaults 0 0
当前内容版权归 Ramesh Natarajan 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Ramesh Natarajan .