Linux build Swap partition file and automatically mount

purpose:Establish a 2G size of the swap partition,And automatically mount when the system boots。
System Environment:RedHat53

1. dd if=/dev/zero of=/swapfile bs=1k count=2048000
2. mkswap /swapfile
3. swapon /swapfile
4. Modify / etc / fstab to automatically mount at startup:
Add the following sentence in the / etc / fstab in:
/swapfile swap swap defaults 0 0
5. Get!

Leave a Comment