有时,当咱们在 linux 零碎中耗尽磁盘空间时,如果分区是在 LVM 上创立的,那么咱们能够通过应用 lvreduce 命令放大 LVM 在卷组中腾出一些闲暇空间。
在本指南中,咱们将学习如何在 RHEL 和 CentOS 零碎中缩小或放大 LVM 分区大小。
留神: 这些步骤仅实用于应用基于 LVM 的分区并格式化为 ext4 或 ext3 的状况。
假如咱们想缩小 /home 2GB(LVM 分区,EXT4 格局)
[root@cloud ~]# df -h /home/ Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_cloud-LogVol00 12G 9.2G 1.9G 84% /home(1) 卸载文件系统应用上面的 umount 命令卸载文件系统
[root@cloud ~]# umount /home/(2) 查看文件系统是否有谬误执行 e2fsck 命令查看文件系统是否存在谬误。当应用 -f 标记时,即便文件系统曾经被清理,它也会强制查看或扫描文件系统。
[root@cloud ~]# e2fsck -f /dev/mapper/vg_cloud-LogVol00 e2fsck 1.41.12 (17-May-2010) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/mapper/vg_cloud-LogVol00: 12/770640 files (0.0% non-contiguous), 2446686/3084288 blocks(3) 放大 /home 到指定尺寸As shown in the above scenario, size of /home is 12 GB , so by reducing it by 2GB , then the size will become 10GB. Run the following resize2fs command followed by the file system and size.
...