[TriLUG] using parted to change the size of a loop mounted filesystem

Alan Porter porter at trilug.org
Thu Mar 15 09:17:25 EDT 2012

> After I posted, I wondered if it would be trivial in LVM

It is.

To expand:
$ lvresize /dev/myvg/myvolume --size=+100M
$ resize2fs /dev/myvg/myvolume

To shrink:
$ resize2fs /dev/myvg/myvolume 80M
$ lvresize /dev/myvg/myvolume --size=85M
$ resize2fs /dev/myvg/myvolume

Note that when shrinking, I usually squeeze the filesystem to be a
little smaller than the new LV size, resize the LV, and then expand the
filesystem to the actual LV size. This is because of my own paranoia...
I have been told that the "85M" that you tell to lvresize is the same as
the "85M" you would tell to resize2fs, but I like to be very sure.

# ɹǝʇɹoԀ uɐl∀

More information about the TriLUG mailing list