LVM – Must Filesystem be Unmounted While Extending an LVM Logical Volume?

filesystemslinuxlvmsize;

I have seen some tutorials on extending an LVM2 logical volume. None of them instruct you to unmount the filesystem. They claim that you can extend an LVM volume while it is in use. Is this right?

Best Answer

That depends on whether the filesystem can be extended online. Most major Linux filesystems can be extended while they are mounted (btrfs, ext2, ext3, ext4, xfs, zfs) — the main exception is reiserfs. If you want to extend one of these filesystems on an LVM volume, you can extend the volume with lvextend, then extend the filesystem to fill the enlarged volume, all without deactivating or unmounting anything.

If you're shrinking the volume, there are fewer filesystems that don't require mounting: only btrfs and zfs can be shrunk online. Shrink the filesystem, then call lvreduce to bring the logical volume size down to the size of the filesystem.

Related Question