[root@szm pub]# mkswap --help
Usage: mkswap [-c] [-pPAGESZ] [-L label] [-U UUID] /dev/name [blocks]
-c:创建交换空间的时候检查分区健康状态;
-f:强制创建交换空间;
-p PSZ:指定交换空间页面大小;
-L Label:为交换空间设置卷材;
-v0/-v1:旧/新的交换分区类型;
[root@szm pub]# swapon --help
Usage:
swapon -a [-e] [-v] [-f] enable all swaps from /etc/fstab
swapon [-p priority] [-v] [-f] <special> enable given swap
swapon -s display swap usage summary---/proc/swaps
swapon -h display help
swapon -V display version
The <special> parameter:
{-L label | LABEL=label} LABEL of device to be used
{-U uuid | UUID=uuid} UUID of device to be used
<device> name of device to be used
<file> name of file to be used
1.[root@szm pub]# mkswap -L swap-sdb6 /dev/sdb6
2.修改/etc/fstab文件
3.[root@szm pub]# swapon -a
4.查看交换分区情况:[root@szm pub]# swapon -s
关闭Swap:[root@szm pub]# swapoff /dev/sdb6
=====================创建交换空间二=====================
1.[root@szm test]# dd if=/dev/zero of=swapfile count=100 bs=1M
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 1.22642 s, 85.5 MB/s
2.[root@szm test]# mkswap swapfile
3.2.修改/etc/fstab文件
3.[root@szm pub]# swapon -a
4.查看交换分区情况:[root@szm pub]# swapon -s