总体过程:
把/home内容备份,然后将/home文件系统所在的逻辑卷删除,扩大/root文件系统,新建/home ,恢复/home内容
1.查看分区
df -h
2.备份home分区文件
tar cvf /tmp/home.tar /home
3.卸载/home,如果无法卸载,先终止使用/home文件系统的进程
fuser -km /home/
umount /home
4.删除/home所在的lv
lvremove /dev/mapper/centos-home
5.扩展/root所在的lv,增加800G
lvextend -L +800G /dev/mapper/centos-root
6.扩展/root文件系统
xfs_growfs /dev/mapper/centos-root
7.重新创建home lv
lvcreate -L 73G -n /dev/mapper/centos-home
8. 创建文件系统
mkfs.xfs /dev/mapper/centos-home
9.挂载home
mount /dev/mapper/centos-home
10.home文件恢复
tar xvf /tmp/home.tar -C /home/
cd /home/home/
mv * ../
-------------------------------------------------------------------------
如果想创建额外的lvm
1. 查看vg
# vgscan
Reading volume groups from cache.
Found volume group "centos" using metadata type lvm2
# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size <464.76 GiB
PE Size 4.00 MiB
Total PE 118978
Alloc PE / Size 39360 / 153.75 GiB
Free PE / Size 79618 / <311.01 GiB
VG UUID jKRX0T-8rz2-pRlV-ak5q-asSF-wT23-ldeCkV
2. 创建lv
# lvcreate -l 79618 -n mhc_lv centos
-l指定小于等于上边的 Free PE
# lvdisplay
3. 格式化
# mkfs -t ext4 /dev/centos/mhc_lv
4. 挂载
# mkdir /data
# mount /dev/centos/mhc_lv /data