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
$ sudo lvresize -L +2G /dev/vg00/foo.example.com-disk Extending logical volume foo.example.com-disk to 8,00 GB Logical volume foo.example.com-disk successfully resized
Then, you’re ready to tell the file system that it has been resized:
$ sudo resize2fs /dev/foo.example.com-disk resize2fs 1.40-WIP (14-Nov-2006) Resizing the filesystem on /dev/vg00/foo.example.com-disk to 2097152 (4k) blocks. The filesystem on /dev/vg00/petitepeople01.koho.dk-disk is now 2097152 blocks long.
And there you have it, a file system resized and ready for use.
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:
Turn on journal: