1. lsblk -f 查看磁盘分区情况
NAME FSTYPE LABEL UUID MOUNTPOINT sda ├─sda1 vfat 25DD-8DE3 /boot/efi ├─sda2 xfs bff234-f1cb-4c52-9794-979265e6f4b4 /boot └─sda3 LVM2_member G0gJ6e-1BVg-7dAb-4fYk-ifgs-la1See ├─cl_miwifi--r3l--srv-root xfs 2d99webd-1431-43fa-9b2b54ec56ce /├─cl_miwifi--r3l--srv-swap swap 4aa90ce1-6536-41e9-bc5f-7405a30b36 [SWAP]└─cl_miwifi--r3l--srv-home xfs b3364448-10c-42d7-bb8c-8ac8465cb /home
2. df -h 查看磁盘大小
文件系统 容量 已用 可用 已用% 挂载点 devtmpfs 3.6G 0 3.6G 0% /dev tmpfs 3.6G 0 3.6G 0% /dev/shm tmpfs 3.6G 8.7M 3.6G 1% /run tmpfs 3.6G 0 3.6G 0% /sys/fs/cgroup /dev/mapper/cl_miwifi--r3l--srv-root 190G 7.5G 183G 4% / /dev/sda2 1014M 213M 802M 22% /boot /dev/sda1 599M 7.3M 592M 2% /boot/efi tmpfs 736M 0 736M 0% /run/user/0 /dev/mapper/cl_miwifi--r3l--srv-home 39G 311M 39G 1% /home
3. 卸载/home: umount /home
4. 删除:lvremove /dev/mapper/cl_miwifi--r3l--srv-home
Do you really want to remove active logical volume cl_miwifi-r3l-srv/home? [y/n]: yLogical volume "home" successfully removed.
5. 查看磁盘大小 vgdisplay
--- Volume group ---VG Name cl_miwifi-r3l-srvSystem ID Format lvm2Metadata Areas 1Metadata Sequence No 5VG Access read/writeVG Status resizableMAX LV 0Cur LV 2Open LV 2Max PV 0Cur PV 1Act PV 1VG Size <236.89 GiBPE Size 4.00 MiBTotal PE 60643Alloc PE / Size 19839 / <77.50 GiBFree PE / Size 40804 / 159.39 GiBVG UUID vZ9He0-mdVB-QQql-jvaw-845G-Ckid-FiHZDd
6. 把空闲的120G,分给/root/: lvextend -L +120G /dev/mapper/cl_miwifi--r3l--srv-root
Size of logical volume cl_miwifi-r3l-srv/root changed from 70.00 GiB (17920 extents) to 190.00 GiB (48640 extents).Logical volume cl_miwifi-r3l-srv/root successfully resized.
7. 设置xfs: xfs_growfs /dev/mapper/cl_miwifi--r3l--srv-root
meta-data=/dev/mapper/cl_miwifi--r3l--srv-root isize=512 agcount=4, agsize=4587520 blks= sectsz=512 attr=2, projid32bit=1= crc=1 finobt=1, sparse=1, rmapbt=0= reflink=1 data = bsize=4096 blocks=18350080, imaxpct=25= sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=8960, version=2= sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 18350080 to 49807360
8. df -h
文件系统 容量 已用 可用 已用% 挂载点 devtmpfs 3.6G 0 3.6G 0% /dev tmpfs 3.6G 0 3.6G 0% /dev/shm tmpfs 3.6G 8.7M 3.6G 1% /run tmpfs 3.6G 0 3.6G 0% /sys/fs/cgroup /dev/mapper/cl_miwifi--r3l--srv-root 190G 7.5G 183G 4% / /dev/sda2 1014M 213M 802M 22% /boot /dev/sda1 599M 7.3M 592M 2% /boot/efi tmpfs 736M 0 736M 0% /run/user/0
9. 在看一下:vgdisplay
--- Volume group ---VG Name cl_miwifi-r3l-srvSystem ID Format lvm2Metadata Areas 1Metadata Sequence No 6VG Access read/writeVG Status resizableMAX LV 0Cur LV 2Open LV 2Max PV 0Cur PV 1Act PV 1VG Size <236.89 GiBPE Size 4.00 MiBTotal PE 60643Alloc PE / Size 50559 / <197.50 GiBFree PE / Size 10084 / 39.39 GiBVG UUID vZ9He0-mdVB-QQql-jvaw-845G-Ckid-FiHZDd
10. 在把剩余的39G 分给home: lvcreate -L 39G -n /dev/mapper/cl_miwifi--r3l--srv-home
Logical volume "home" created.
11. mkfs -t xfs /dev/cl_miwifi-r3l-srv/home
meta-data=/dev/cl_miwifi-r3l-srv/home isize=512 agcount=4, agsize=2555904 blks= sectsz=512 attr=2, projid32bit=1= crc=1 finobt=1, sparse=1, rmapbt=0= reflink=1 data = bsize=4096 blocks=10223616, imaxpct=25= sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=4992, version=2= sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 Discarding blocks...Done.
12. 挂载home: mount /dev/cl_miwifi-r3l-srv/home /home
13. df -h:
文件系统 容量 已用 可用 已用% 挂载点 devtmpfs 3.6G 0 3.6G 0% /dev tmpfs 3.6G 0 3.6G 0% /dev/shm tmpfs 3.6G 8.7M 3.6G 1% /run tmpfs 3.6G 0 3.6G 0% /sys/fs/cgroup /dev/mapper/cl_miwifi--r3l--srv-root 190G 7.5G 183G 4% / /dev/sda2 1014M 213M 802M 22% /boot /dev/sda1 599M 7.3M 592M 2% /boot/efi tmpfs 736M 0 736M 0% /run/user/0 /dev/mapper/cl_miwifi--r3l--srv-home 39G 311M 39G 1% /home