Skip to content

lvresize is my friend

by jprice on April 15th, 2011

Everyone is fearful of resizing volumes.

Linux has made it pretty easy though, provided you’re using LVM (lvm2 that is), and ext3 filesystems.  Tested on Redhat 5.6 (aka Oracle Enterprise Linux aka CentOS).  One command which will grow or shrink both the volume and the file system.

lvresize!

Note: if you’re resizing down (shrinking), you’ll need to umount the shrinking volume first.  If it is mounted, it’ll ask you to do it for you.

Say you need to move 20GB from /home, to /var, and they’re in the same VG:

umount /home
lvresize --resizefs -L -20G /dev/mapper/localdisks-home
lvresize --resizefs -L +20G /dev/mapper/localdisk-var
mount /home

Done!  (though the shrink command will take a little bit of time to finish)

From → Geeky musings

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS