[root@sannian mnt]# dd if=/dev/zero of=/mnt/swapfile bs=1M count=20480
20480+0 records in
20480+0 records out
21474836480 bytes (21 GB) copied, 193.865 s, 111 MB/s
开机自挂载:
[root@sannian swap]# mkswap swapfile
[root@sannian swap]# vim /etc/fstab
/mnt/swap/swapfile swap swap defaults 0 0
挂载
[root@sannian swap]# swapon /mnt/swap/swapfile
swapon: /mnt/swap/swapfile: insecure permissions 0644, 0600 suggested.
去除:
[root@sannian swap]# swapoff /mnt/swap/swapadd
查看是不事挂上去了?
[root@sannian swap]# free -m
total used free shared buff/cache available
Mem: 1839 196 999 0 642 1471
Swap: 20479 0 20479