myvdb-vo 掛載在 /reports,大小為 89M ( 100M )。
[root@kvm10 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_kvm10-root 4.3G 3.1G 1.2G 73% / devtmpfs 4.0M 0 4.0M 0% /dev tmpfs 853M 0 853M 0% /dev/shm tmpfs 342M 5.0M 337M 2% /run tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-journald.service /dev/vda2 436M 211M 226M 49% /boot tmpfs 1.0M 0 1.0M 0% /run/credentials/getty@tty1.service tmpfs 171M 8.0K 171M 1% /run/user/0 /dev/mapper/myvdb-vo 89M 14K 83M 1% /reports
myvdb-vo 檔案系統為 50M。
[root@kvm10 ~]# lvreduce -L 50M /dev/myvdb/vo --resizefs Rounding size to boundary between physical extents: 52.00 MiB. File system ext4 found on myvdb/vo mounted at /reports. File system size (100.00 MiB) is larger than the requested size (52.00 MiB). File system reduce is required using resize2fs. File system unmount is needed for reduce. 缷載 File system fsck will be run before reduce. 檢查檔案系統 Continue with ext4 file system reduce steps: unmount, fsck, resize2fs? [y/n]:y Reducing file system ext4 to 52.00 MiB (54525952 bytes) on myvdb/vo... unmount /reports unmount done e2fsck /dev/myvdb/vo /dev/myvdb/vo: 11/25584 files (9.1% non-contiguous), 12081/102400 blocks e2fsck done resize2fs /dev/myvdb/vo 53248k resize2fs 1.47.1 (20-May-2024) Resizing the filesystem on /dev/myvdb/vo to 53248 (1k) blocks. The filesystem on /dev/myvdb/vo is now 53248 (1k) blocks long. resize2fs done remount /dev/myvdb/vo /reports remount done Reduced file system ext4 on myvdb/vo. Size of logical volume myvdb/vo changed from 100.00 MiB (25 extents) to 52.00 MiB (13 extents). Logical volume myvdb/vo successfully resized.
myvdb-vo 大小為 44M ( 50M )。
[root@kvm10 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_kvm10-root 4.3G 3.1G 1.2G 73% / devtmpfs 4.0M 0 4.0M 0% /dev tmpfs 853M 0 853M 0% /dev/shm tmpfs 342M 5.0M 337M 2% /run tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-journald.service /dev/vda2 436M 211M 226M 49% /boot tmpfs 1.0M 0 1.0M 0% /run/credentials/getty@tty1.service tmpfs 171M 8.0K 171M 1% /run/user/0 /dev/mapper/myvdb-vo 44M 14K 41M 1% /reports