# dd if=/dev/zero of=/tmp/myswap bs=1M count=4096 # mkswap /tmp/myswap # swapon /tmp/myswap # vim /etc/fstab /tmp/myswap swap swap defaults 0 0 (开机时启动此swap文件)