Linux-磁盘扩容缩容
1. 磁盘扩容
1.1. 扩容前查看
[root@k3s-work ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos_k3s--work-root xfs 36G 1.7G 34G 5% /
devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs tmpfs 3.9G 9.0M 3.9G 1% /run
tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 142M 873M 14% /boot
/dev/mapper/centos_k3s--work-home xfs 18G 33M 18G 1% /home # 增加此容量
tmpfs tmpfs 783M 0 783M 0% /run/user/0
[root@k3s-work ~]# fdisk -l
Disk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 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: dos
Disk identifier: 0x00050669
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 125829119 61864960 8e Linux LVM
Disk /dev/mapper/centos_k3s--work-root: 38.2 GB, 38235275264 bytes, 74678272 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_k3s--work-swap: 6442 MB, 6442450944 bytes, 12582912 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_k3s--work-home: 18.7 GB, 18668847104 bytes, 36462592 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/sdb: 5368 MB, 5368709120 bytes, 10485760 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@k3s-work ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos_k3s-work lvm2 a-- <59.00g 0
[root@k3s-work ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos_k3s-work 1 3 0 wz--n- <59.00g 0
[root@k3s-work ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home centos_k3s-work -wi-ao---- <17.39g
root centos_k3s-work -wi-ao---- <35.61g
swap centos_k3s-work -wi-ao---- 6.00g 1.2. 格式化磁盘
1.3. 扩容卷组
1.4. 扩容卷组下某个LV
(加餐)扩容固定空间
(加餐)扩容全部空间
(加餐)在线扩容文件系统
2. 磁盘缩容
2.1 xfs 缩容
2.1.1 备份
2.1.2 卸载
2.1.3 删除对应lv
2.1.4 建立新的lv
2.1.5 格式化
2.1.6 挂载
2.1.7 还原
2.2 ext 缩容
3. LVM 概念及使用
一、 创建lvm 的流程
二、删除逻辑卷命令
三 、其他相关命令整理如下
Last updated