Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
This can be easily verified by trying.... –  Karlson Dec 13 '12 at 17:54
1  
Growing and shrinking (the two components of resizing) are typically handled differently, and both are dependent on the file system type itself. This is not related to LVM: you extend the "partition" that contains a file system with or without LVM. –  jw013 Dec 13 '12 at 18:02
3  
@Karlson Generally speaking, "just try it" isn't a great idea when it comes to questions like "will this corrupt my filesystem if I do it wrong" –  Michael Mrozek Dec 13 '12 at 18:24
    
@MichaelMrozek I would agree with you if the only way to do this is to try it on a live production system. Normally one would have a dummy volume or a system that this would be tested on, so if you corrupt anything the answer is obviously no and no harm comes to the data on your original volume. –  Karlson Dec 13 '12 at 18:32

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer

There is no need to unmount an ext3 or ext4 filesystem to expand it. Shrinking the filesystem, however, is another matter. That requires it to be unmounted and fscked before it is down-sized.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.