增加分区空间 root home 1、备份home: cp -r /home/ homebak/ 2、卸载home: umount /home 进程占有:fuser -m -v -i -k /home kill -9 PID 3、删除/home所在的lv: lvremove /dev/mapper/cl-home [root@bogon /]# lvremove /dev/mapper/cl-home Do you really want to remove active logical volume cl/home? [y/n]: y Logical volume "home" successfully removed 4、扩展/root所在的lv,增加4430G : lvextend -L +100 /dev/mapper/cl-root 20-30G逐步增加 [root@bogon /]# lvextend -L +100 /dev/mapper/cl-root Size of logical volume cl/root changed from 50.00 GiB (12800 extents) to <50.10 GiB (12825 extents). Logical volume cl/root successfully resized. 5、扩展/root文件系统 : xfs_growfs /dev/mapper/cl-root [root@bogon /]# xfs_growfs /dev/mapper/cl-root meta-data=/dev/mapper/cl-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 13132800 linux使用lvresize和resize2fs调整lv大小 6、扩展rootlv文件系统 resize2fs /dev/mapper/myvg-rootlv 说明:扩展完磁盘后使用lsblk查看的结果变了而使用df -h结果大小却没变,这是因为前者查看的是磁盘的大小而后者查看的是文件系统的大小。磁盘和文件系统在不严格区分时可视为同一个东西,但追究起来确实是两样东西。这也是需要第3步的原因。 7、重新创建home lv : lvcreate -L 167G -n home cl [root@bogon /]# lvcreate -L 121G -n home cl Logical volume "home" created. 8、重新创建home lv 分区的大小,根据 vgdisplay 中的free PE 的大小确定 9、创建文件系统: mkfs.xfs /dev/centos/home [root@bogon /]# mkfs.xfs /dev/mapper/cl-home meta-data=/dev/mapper/cl-home isize=512 agcount=4, agsize=7929856 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=31719424, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=15488, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 10、挂载 home: mount /dev/centos/home /home [root@bogon /]# mount /dev/mapper/cl-home /home