Linux shell swapoff 命令
Linux shell swapoff 命令用于关闭系统交换区 (swap area)。 swapoff 实际上为 swapon 的符号连接,可用来关闭系统的交换区。 swapoff 命令语法格式 swapoff [options] [<spec>] 选项 a, --all 将/etc/fstab文件中所有设置为swap的设备关闭 -v, --verbose 进入详细信息模式 -h, --help 显示版主文档信息 -V, --version 显示 swapoff 命令的版本信息 [<spec>] 使用的设备 <spec> 可能的参数如下: -L <label> 使用设备的标签(LABEL) -U <uuid> 使用设备的 UUID LABEL=<label> 使用设备的标签(LABEL) UUID=<uuid> 使用设备的 UUID <device> 使用设备的名称(name) <file> 使用的文件名 范例 1. 显示分区信息: root@localhost ~]# sfdisk -l Disk /dev/sda: 2610 cylinders, 255 heads, 63 sectors/track Units: cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0 Device Boot Start End #cyls #blocks Id System /dev/sda1 * 0+ 130- 131- 1048576 83 Linux /dev/sda2 130+ 2610- 2481- 19921920 8e Linux LVM /dev/sda3 0 - 0 0 0 Empty /dev/sda4 0 - 0 0 0 Empty Disk /dev/mapper/centos-root: 2218 cylinders, 255 heads, 63 sectors/track Disk /dev/mapper/centos-swap: 261 cylinders, 255 heads, 63 sectors/track [root@localhost ~]# System 那列有 LVM 的就是交换分区了 关闭交换分区 [root@localhost ~]# swapoff
Linux shell swapoff 命令用于关闭系统交换区 (swap area)。
swapoff 实际上为 swapon 的符号连接,可用来关闭系统的交换区。
swapoff 命令语法格式
swapoff [options] [<spec>]
选项
a, --all 将/etc/fstab文件中所有设置为swap的设备关闭 -v, --verbose 进入详细信息模式 -h, --help 显示版主文档信息 -V, --version 显示 swapoff 命令的版本信息 [<spec>] 使用的设备<spec> 可能的参数如下:
-L <label> 使用设备的标签(LABEL) -U <uuid> 使用设备的 UUID LABEL=<label> 使用设备的标签(LABEL) UUID=<uuid> 使用设备的 UUID <device> 使用设备的名称(name) <file> 使用的文件名范例
1. 显示分区信息:
root@localhost ~]# sfdisk -l Disk /dev/sda: 2610 cylinders, 255 heads, 63 sectors/track Units: cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0 Device Boot Start End #cyls #blocks Id System /dev/sda1 * 0+ 130- 131- 1048576 83 Linux /dev/sda2 130+ 2610- 2481- 19921920 8e Linux LVM /dev/sda3 0 - 0 0 0 Empty /dev/sda4 0 - 0 0 0 Empty Disk /dev/mapper/centos-root: 2218 cylinders, 255 heads, 63 sectors/track Disk /dev/mapper/centos-swap: 261 cylinders, 255 heads, 63 sectors/track [root@localhost ~]#
System 那列有 LVM 的就是交换分区了
关闭交换分区
[root@localhost ~]# swapoff /dev/sda2
关闭后可以使用
swapon开启
交流与评论