#/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
mkswap $filename
chmod 0600 $filename
swapon $filename
echo $filename none swap sw 0 0 >> /etc/fstab