17 umount /home
19 lvs
20 lvremove /dev/mapper/centos-home
21 lvresize -l +100%FREE /dev/centos/root
28 xfs_growfs /dev/mapper/centos-root
29 df -Th
[root@localhost ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 50G 1007M 49G 2% /
devtmpfs devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs tmpfs 2.0G 8.6M 2.0G 1% /run
tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 133M 882M 14% /boot
/dev/mapper/centos-home xfs 46G 33M 46G 1% /home
tmpfs tmpfs 396M 0 396M 0% /run/user/0
先卸载/home
[root@localhost ~]# umount /home
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 3 0 wz--n- <99.00g 4.00m
[root@localhost ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- <99.00g 4.00m
[root@localhost ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home centos -wi-a----- <45.12g
root centos -wi-ao---- 50.00g
swap centos -wi-ao---- <3.88g
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 99G 0 part
├─centos-root 253:0 0 50G 0 lvm /
├─centos-swap 253:1 0 3.9G 0 lvm [SWAP]
└─centos-home 253:2 0 45.1G 0 lvm
sr0 11:0 1 4.3G 0 rom
[root@localhost ~]# lvremove /dev/centos/home
Do you really want to remove active logical volume centos/home? [y/n]: y
Logical volume "home" successfully removed
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 99G 0 part
├─centos-root 253:0 0 50G 0 lvm /
└─centos-swap 253:1 0 3.9G 0 lvm [SWAP]
sr0 11:0 1 4.3G 0 rom
[root@localhost ~]#
[root@localhost ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- 50.00g
swap centos -wi-ao---- <3.88g
[root@localhost ~]# lvresize -l +100%FREE /dev/mapper/centos-root
Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 95.12 GiB (24351 extents).
Logical volume centos/root successfully resized.
[root@localhost ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 50G 1007M 49G 2% /
devtmpfs devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs tmpfs 2.0G 8.6M 2.0G 1% /run
tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 133M 882M 14% /boot
tmpfs tmpfs 396M 0 396M 0% /run/user/0
[root@localhost ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=3276800 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=13107200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=6400, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 13107200 to 24935424
[root@localhost ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 96G 1007M 95G 2% /
devtmpfs devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs tmpfs 2.0G 8.6M 2.0G 1% /run
tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 133M 882M 14% /boot
tmpfs tmpfs 396M 0 396M 0% /run/user/0
[root@localhost ~]#
centos 根目录逻辑卷扩容/home -> /
linux修理工2023-10-26 16:35
相关推荐
IT机器猫4 分钟前
Docker完整技术汇总无所不在的物质8 分钟前
Jenkins基础教程广而不精zhu小白20 分钟前
CentOS Stream 9 挂载Windows共享FTP文件夹一休哥助手25 分钟前
全面解析 Linux 系统监控与性能优化二进制杯莫停28 分钟前
掌控网络流量的利器:tcconfigwatl044 分钟前
【Android】unzip aar删除冲突classes再zip团儿.1 小时前
Docker服务发现新纪元:探索Consul的无限魅力赵大仁1 小时前
在 CentOS 7 上安装 Node.js 20 并升级 GCC、make 和 glibcvvw&1 小时前
Docker Build 命令详解:在 Ubuntu 上构建 Docker 镜像教程李白你好1 小时前
家用无线路由器的 2.4GHz 和 5GHz