分类: LINUX
2010-04-06 14:05:00
For this article, assume that the file system in question is 1GB mounted at /data on the logical volume /dev/vg0/LV. This file system needs to be reduced by 100MB, bringing it down to 900MB. Note: there must be enough free space on the file system to reduce it. If the file system is at 99% full, this may not work or may cause unrecoverable data loss.
Begin by unmounting the file system:
$ umount /data
Reduce the file system. Please note that this is done on /dev/vg0/LV. The number at the end is the final size of the filesystem, not the amount it is reduced by.
$ resize2fs /dev/vg0/LV 900M
The final logical volume shouldn't extend past the filesystem. Because the filesystem has been reduced by 100MB, the volume must also be reduced that amount:
$ lvreduce -L -105M /dev /vg0/LV -reduces the logical volume
Mount the filesystem and run df to verify the change was made.
WARNING: Reducing LVM can cause a catastrophe which could result in data loss. Plan and act accordingly. ALWAYS create backups!