2

I'm playing a little bit with LVM. I've noticed that I can add a new HDD, include it in the volume group, and add some space to all of the existing volumes without unmounting theirs filesystem or rebooting the whole machine. But when I tried to do the opposite thing, i.e. to reduce the volumes' space and remove the drive from the system, I was unable to do it online. This can be achieved when the filesystems are unmounted, or from live cd/dvd/pendrive (root filesystem).

So the question is, why the filesystem can't be shrunk online?

4

Presumably you already found this: https://serverfault.com/questions/528075/is-it-possible-to-on-line-shrink-a-ext4-volume-with-lvm so the short answer is "because the folks who wrote ext4 don't support this."

The slightly longer answer is that it's hard, especially if maintaining any sort of backward compatibility with ext2. Finding all the bits and pieces of the filesystem that are in use past the end of the desired new size, then moving them all back within that new size is hard enough. Now do it while all the existing aspects of a filesystem's daily chores are still taking place and it becomes super easy to destroy your data. The ext4 folks have essentially said that if you need to shrink... do it safely.

The very long answer delves deep into the internal operations of filesystems and is probably more than you really want to know. But if you do: this might be a good (free) place to start: http://www.nobius.org/~dbg/practical-file-system-design.pdf

  • > The slightly longer answer is that it's hard, especially if maintaining any sort of backward compatibility with ext2 Ahh, linux priorities. – duane Jun 17 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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