LVM缩减

一 缩减步骤

  • 卸载挂载点
  • 检查文件系统
  • 调整分区大小
  • 缩减LV大小
  • 重新挂载并检查

注意:

1 减少文件的大小一定需要按照上面提高的4个规定动作顺序来做,在缩减LV大小前,首先要缩减filesystem的大小,否则将导致文件系统破坏等恶劣影响。

2 不能在线缩减,得先卸载切记。

3 缩减有风险,一般不建议

4 xfs格式的无法缩减,只能格式化ext然后缩减,再格式化xfs,再重新挂载

二 卸载挂载点

[root@liujunjun ~]# umount /dev/vgtest/vgtest_LV01 

三 检查文件系统

[root@liujunjun ~]# e2fsck -f /dev/vgtest/vgtest_LV01 

四 调整分区大小

[root@liujunjun ~]# lvreduce -L 25G /dev/vgtest/vgtest_LV01 
  WARNING: Reducing active logical volume to 25.00 GiB.
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce vgtest/vgtest_LV01? [y/n]: y
  Size of logical volume vgtest/vgtest_LV01 changed from 35.00 GiB (8960 extents) to 25.00 GiB (6400 extents).
  Logical volume vgtest/vgtest_LV01 successfully resized.

重新挂载,再用df -h查看。

原文地址:https://www.cnblogs.com/liujunjun/p/14130183.html