Thursday, December 31, 2009

CREATE SWAP BASED ON FILES IN REDHAT LINUX

Features:

1. The ability to provision swap space based on a file, similar to pagefile.sys
in Windows NT, etc., if you have no available disk space to partition.

2. Doesn't waste partitions

Task:
1. Create 512MB swap file

• dd if=/dev/zero of=/home1/swapfile1 bs=1024 count=524288
• mkswap /home1/swapfile1 - overlays swap file system
• swapon /home1/swapfile1 - makes swap space avaialable to the kernel

2. Ensure that when the system reboots, the swapfile is made avialable to the kernel

• nano /etc/fstab - /home1/swapfile1 swap swap defaults 0 0

3. Create 2GB swap file
• dd if=/dev/zero of=/home1/swapfile2 count=2G

No comments:

Post a Comment