Artificial intelligent assistant

Why the ext4 filesystem can be shrunk only when not mounted? 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?

Presumably you already found this: < 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: <

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 48dab6426f339764a72b9c3b5ec17341