(base) [root@localhost ~]# lvdisplay --- Logical volume --- LV Path /dev/centos/swap LV Name swap VG Name centos LV UUID xdonVW-skI2-1P3T-JQuh-WwY4-qfrV-vbmVQk LV Write Access read/write LV Creation host, time localhost, 2021-01-27 05:01:01 +0800 LV Status available # open 2 LV Size <7.88 GiB Current LE 2016 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:1 --- Logical volume --- LV Path /dev/centos/home LV Name home VG Name centos LV UUID n2a4OV-oaif-5jSE-RJh8-Pc6t-NxFf-FwegR9 LV Write Access read/write LV Creation host, time localhost, 2021-01-27 05:01:01 +0800 LV Status available # open 1 LV Size <965.12 GiB Current LE 247070 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:2 --- Logical volume --- LV Path /dev/centos/root LV Name root VG Name centos LV UUID dj27sN-lnZX-9THU-TrO5-2VPg-q8bS-mYFiYF LV Write Access read/write LV Creation host, time localhost, 2021-01-27 05:01:01 +0800 LV Status available # open 1 LV Size 50.00 GiB Current LE 12800 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:0
3、减少/dev/centos/home的空间
(base) [root@localhost ~]# lvreduce -L 50G /dev/mapper/centos-home Volume group "cl" not found Cannot process volume group cl (base) [root@localhost ~]#
报错,需要将home 卸载
(base) [root@localhost ~]# umount /home
# 命令设置 /dev/centos/home 分区 50G空间
(base) [root@localhost ~]# lvreduce -L 50G /dev/mapper/centos-home WARNING: Reducing active logical volume to 50.00 GiB. THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce centos/home? [y/n]: y Size of logical volume centos/home changed from <965.12 GiB (247070 extents) to 50.00 GiB (12800 extents). Logical volume centos/home successfully resized.
(base) [root@localhost ~]# lvextend -l +100%FREE /dev/mapper/centos-root Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 965.12 GiB (247071 extents). Logical volume centos/root successfully resized.
(base) [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 253000704
[root@localhost ~]# mkfs.xfs -f /dev/mapper/centos-home
[root@localhost ~]# umount /home [root@localhost ~]# mount /home
[root@MOMOCO-02 ~]# mkfs.xfs /dev/mapper/centos-home【这个时候我们选择xfs格式】 mkfs.xfs: /dev/sdb1 appears to contain an existing filesystem (xfs). mkfs.xfs: Use the -f option to force overwrite.
【提示说我们里面有个文件系统里,如果你要继续这样格式就加上-f选项】
[root@MOMOCO-02 ~]# mkfs.xfs -f /dev/sdb1【意思就是强制的】 meta-data=/dev/sdb1 isize=512 agcount=4, agsize=196608 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=786432, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0
评论专区