Sunday, February 19, 2006

Reducing the size of an LVM2 logical volume containing an EXT3 filesystem

(LVM2 on Ubuntu/Debian. Kernel 2.6.12)

Increasing the size of a LV (Logical Volume) is somewhat trivial. Reducing the size isn't. Its important to not make the LV smaller than the filesystem it contains. There is usually confusion as to what exactly '1G' is. So not wanting to trust that the option '70G' is the same for both resize2fs and lvreduce, I opted to:

resize the filesystem such that its much smaller than the desired LV size

resize the LV to the desired size (must always be greater/equal the filesystem size!)