ext3 online resize

Having used Debian Sarge for a while, and just using the default versions of e2fsprogs, I got used to unmounting logical volumes in order to resize them. However, now that I’ve upgraded to Etch, I can now finally do online resizing (yeah, yeah, I know I could have compiled the newer e2fsprogs for sarge …). If you have a system full of logical volumes, online resizing does make life a lot easier. The main problem I’ve discovered is that all the existing ext3 filesystems I’ve created refuse to do online resizing, and only new ones can be resized.

Apparently there is a relatively new ‘resize_inode’ feature in ext3. tune2fs won’t let me add this feature in, so at the moment I’m left with either offline resizing or to copy my data into new filesystems. I’m opting for the latter , which is time consuming and does rely on having enough spare disk space to do it.

Anyway, a typical resize is as simple as:

lvextend -l +10 /dev/myvg/lvone

resize2fs /dev/myvg/lvone
(I’m using 2GB extents so adding 10 extents means 20GB)

If you don’t have much experience with managing a system with logical volumes, one important thing to consider is to start out with smallish logical volumes and grow them as required. Just because you have a lot of disk space, doesn’t mean you need to preallocate it. To me the key advantage of logical volume systems is that you don’t have to get your disk space allocations correct first time. Just create logical volumes that are a bit bigger than what you need, and then as data grows use online resizing. Sure, many filesystems are meant to have degraded performance when they hit 90% full. If you think that’s the case, then factor that in when you work out how big you want each logical volume.