I used LVM to increase the size of a logical volume containing an ext3 fileystem from 300GB to 500GB. After expanding the logical volume, it is necessary to expand the filesystem to use the added space. In theory, this can be done online (while the filesystem is mounted) by using the resize2fs command. In practice…When I gave the resize2fs command, it printed a few messages about what it was going to do. Things looked good, but after a little while it complained:
resize2fs: No space left on device While trying to add group #[some big number]
Studying the man pages and HOWTOs didn’t help, but Google turned up a mailing list posting explaining the problem and workaround.
The problem is that the default journal size on ext3 filesystems isn’t big enough to support expansion of the filesystem. Fortunately, it’s possible to expand the journal. Unfortunately, this can’t be done while the filesystem is mounted. This seems to defeat the whole purpose of having a tool for only filesystem expansion.
The required steps are:
unmount <device>
tune2fs -O ^has_journal <device>
tune2fs -J size=16M <device>
e2fs -f <device>
resize2fs <device>
mount <device>
Lesson learned: when initially creating an ext3 filesystem, don’t just give the ‘-j’ option and accept the default values. However, when the filesystem is created for you automatically, for instance when installing from scratch, you generaly don’t get any choice in the matter. mke2fs should probably be modified to have better default values.