写了个自动生成SWAPFILE的脚本,记录一下
#/bin/bash
filename=/opt/swapfile/4GB-`hexdump -n8 -e'8/1 "%02x"' /dev/urandom`.swap
dd if=/dev/zero of=$filename bs=1024 count=4194304
/sbin/mkswap $filename
chmod 0600 $filename
/sbin/swapon $filename
echo $filename none swap sw 0 0 >> /etc/fstab