centos 7 xfsファイルシステムに対してLinux swapパーティションを低減する方法
3111 ワード
/dev/mapper/centos-swap: 33.8 GB
swapoff /dev/mapper/centos-swap
そしてfreeコマンドでswapが0になったかどうかを確認します.lvreduceコマンドでswapパーティションを4 Gに減らします.
lvreduce -L 4G /dev/mapper/centos-swap
yを入力して、OKして、ヒントswapが4 Gに減少するのを見ます.
mkswap /dev/mapper/centos-swap
swapon /dev/mapper/centos-swap
そしてfreeコマンドでswapが4 Gになったかどうかをチェックします.
lvextend -l +100%FREE /dev/mapper/centos-root
xfs_growfs /dev/mapper/centos-root
付録:
[root@40-187 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 2.6T 1008M 2.6T 1% /
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 9.2M 32G 1% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/sda2 1014M 145M 870M 15% /boot
/dev/mapper/centos-home 100G 33M 100G 1% /home
tmpfs 6.3G 0 6.3G 0% /run/user/0
[root@40-187 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 2.7T 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 2.7T 0 part
├─centos-root 253:0 0 2.6T 0 lvm /
├─centos-swap 253:1 0 31.4G 0 lvm [SWAP]
└─centos-home 253:2 0 100G 0 lvm /home
[root@40-187 ~]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sda: 3000.0 GB, 3000034656256 bytes, 5859442688 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: A4ACB23B-6686-4444-8C18-F3B29486B77F
# Start End Size Type Name
1 2048 4095 1M BIOS boot
2 4096 2101247 1G Microsoft basic
3 2101248 5859440639 2.7T Linux LVM
Disk /dev/mapper/centos-root: 2857.8 GB, 2857826779136 bytes, 5581692928 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-swap: 33.8 GB, 33755758592 bytes, 65929216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-home: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@40-187 ~]#