[mdlug] Linux VMs - virtual disk best practices

Adam Tauno Williams awilliam at whitemice.org
Thu Mar 21 09:36:22 EDT 2013


On Thu, 2013-03-21 at 09:22 -0400, Jonathan Billings wrote:
> On Wed, Mar 20, 2013 at 11:54:32PM -0400, Michael ORourke wrote:
> > So I'm curious to hear from some other admins out there and what you
> > have tried and what seems to work best.
> If you've got more than one partition, and you're not using LVM, if
> you expand the size of the virtual disk, the only partition you can
> easily expand is the last partition on the disk, and that's typically
> an extended partition if you've got more than 4 partitions.  With LVM,
> you can just make 2 partitions, one for /boot and one for the LVM
> physical volume.  You can extend the physical volume to the new space
> if the virtual disk size is increased,

+1 *USE LVM*!

> and you can extend the logical volume of
> whatever volume you want, and use your filesystem tools to resize the
> filesystems.  ext3 and ext4 can be extended online (without a reboot
> or even an unmount) if you've got a modern kernel, but most
> documentation suggest unmounting the volume you plan to extend,
> running fsck and then resizing, which definitely the safer option.

I've been doing hot resize of ext3/4 for years, ever had any issues.  I
do not do it during peak utilization, but neither do I quiesce the host.

> I don't have the ability to add storage while the OS is running on the
> VMware VMs I manage (I don't run the VMware cluster) so it takes a
> reboot for it to see the new storage anyway.  Most often, if I'm going
> to be resizing a VM's disks, if it isn't / (root) that's being
> resized, once it has been rebooted I just unmount the volumes and
> perform the above operations, and then remount it.

You can add new virtual disks and ask the virtual host to rescan the
SCSI bus.  That works intermittently.

> However, I've resized partitions on running VMs, taking space from one
> partition and giving it to another.  It is MUCH easier to do this if
> you're using LVM.

Not using LVM makes this a risky exercise in black magick.  VERY easy to
screw up.

> I think the hope is that btrfs will make this a lot easier, all
> storage will just be part of a pool and you can reallocate it all
> online without needing to jump through so many hoops.

I've played with sub-volumes in brtfs.  It works.  Takes a bit of
getting used to - it is just different, really different.  A filesystem
and a volume manager got married and had a baby, they named it Butter.
It was both like and unlike its parents.

-- 
Adam Tauno Williams  GPG D95ED383
Systems Administrator, Python Developer, LPI / NCLA



More information about the mdlug mailing list