我们知道,mount -a可以挂载/etc/fstab里面所有定义的磁盘。
如果/etc/fstab里面定义了swap类型的磁盘分区,使用mount -a无法实现挂载,需要使用swap自己的管理命令:
swapon, swapoff - enable/disable devices and files for paging and swapping
使用方法:
swapon [options] [specialfile...]
-a, --all
All devices marked as ``swap'' in /etc/fstab are made available, except for those with the ``noauto'' option. Devices that are already being used as swap are silently skipped.
-L label
Use the partition that has the specified label. (For this, access to /proc/partitions is needed.)
-U uuid
Use the partition that has the specified uuid.
使用方法:
swapoff [-va] [specialfile...]
选项参照swapon。