Linux常用命令-swapoff

命令

swapoff

描述

disable devices and files for paging and swapping
关闭swap分区

用法

1
swapoff [options] [<spec>]

选项

1
2
3
4
5
6
7
8
9
10
11
Options:
-a, --all 关闭当前系统中/proc/swaps中的所有swap分区
-v, --verbose 显示详情

The <spec> parameter:
-L <label> LABEL of device to be used
-U <uuid> UUID of device to be used
LABEL=<label> LABEL of device to be used
UUID=<uuid> UUID of device to be used
<device> name of device to be used
<file> name of file to be used

注意

示例

1
2
3
4
5
6
7
8
9
$ swapon
NAME TYPE SIZE USED PRIO
/dev/dm-1 partition 2G 0B -2
/swapfile file 1000M 0B -3
# 关闭所有swap
$ swapoff -a
$ swapon
$ more /proc/swaps
Filename Type Size Used Priority