How to resize ext3 partition on LVM

From time to time I have to resize the file systems on various systems which are primarily using ext3 on top of LVM.

Resizing such an ext3 file system is not a complex task at all. For starters, make sure you shut the domU down (or unmount the file system – unless you feel brave enough to do an online resize, in which case you should not be reading this).

After unmounting the file system, the LVM volume can be resized with lvresize:

$ sudo lvresize -L +2G /dev/vg00/
  Extending logical volume to 8,00 GB
  Logical volume successfully resized

Then, you’re ready to tell the file system that it has been resized:

$ sudo resize2fs /dev/ 
resize2fs 1.40-WIP (14-Nov-2006)
Resizing the filesystem on /dev/vg00/ to 2097152 (4k) blocks.
The filesystem on /dev/vg00/ is now 2097152 blocks long.

And there you have it, a file system resized and ready for use.

P.S. I’ve read numorus times that you have to run fsck -f and turn off journaling to use resize2fs but can’t really find any good reason to do so. If you want to, the commands are:

Turn off journal: tune2fs -O ^has_journal

Force check of file system: fsck -f

Turn on journal: tune2fs -j