swapon 功能说明:激活交换分区
使用mkswap命令创建交换分区后,分区并没有生效,还需要使用swapon命令使之生效。
参数选项
-s 显示所有交换分区的信息
[root@cs6 ~]# mkswap -f /dev/sdb1
Setting up swapspace version 1, size = 417652 KiB
no label, UUID=5ce3d626-5794-4990-9980-489d49e4d930
[root@cs6 ~]# swapon /dev/sdb1
[root@cs6 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_cs6-lv_root
26G 1.7G 24G 7% /
tmpfs 931M 0 931M 0% /dev/shm
/dev/sda1 477M 28M 424M 7% /boot
[root@cs6 ~]# free -m
total used free shared buffers cached
Mem: 1989 176 1813 0 5 40
-/+ buffers/cache: 129 1860
Swap: 3479 0 3479
[root@cs6 ~]# swapoff /dev/sdb1
[root@cs6 ~]# free -m
total used free shared buffers cached
Mem: 1989 176 1813 0 5 40
-/+ buffers/cache: 129 1860
Swap: 3071 0 3071