LVM for viritual hosts

Hi,

Can you possibly add the option to format a drive with LVM support, inside a Virtual Machine?

Currently when I add a drive to a XEN Virtual Machine, and need LVM (for resizing later on) I need to manually login to the XEN domU (which is sometimes not possible on client's VM's) and first create a PV, VG & LV before it can be formatted and mounted.

It would be nice if this was part of the automation when adding new disks to an existing VM.

It would be even nicer if new VM's could be formatted with LVM instead of EXT3 as well.

Status: 
Active

Comments

This is unlikely to be ever supported, as cloudmin needs access to the vm's file system when creating, imaging and for other operations when the VM is down. If it runs lvm internally, this isn't possible...

Why do you need to use lvm inside the VM? Disks can be expanded even without it.

But CloudMin already has that info. When you create a new disk you have an option of filesystem to format it with.

With LVM one can essentially add more storage space without shutting down the VM. i.e. add another disk (say sda4), add it to the PV inside the VM, then to thew VG and finally to the LV. Thus, 0 downtime while addding more diskspace :)

Fair enough, I can see how that would be useful.

The problem is that if the root disk is on LVM, Cloudmin has no way to mount the filesystem within it on the host system, and thus no way to access config files in /etc/ when the VM is down.

What I would recommend instead is moving /home or some other large non-root directory to a separate filesystem, which could then be on LVM spread across multiple virtual disks.

Yes, but CloudMin can't format the extra partition (for use in /home for example) with LVM - which is why I have submitted the feature request.

And, I'm almost certain if the VM's LVM has a different name (maybe with the same name as a XEN instance( the you should be able to mount it on the host node as well.

No actually formatting of the partition is needed for LVM though - when you add a disk using Cloudmin, it should create a single linux-type partition that spans the whole disk. This can then be added to an LVM VG on the VM..

but the VM doesn't have LVM to begin with since the root partition is formated with ext3 or whater is used on the templates.

Thus, as I understand it, it should be formatted with LVM to begin with. OR how else do I get LVM partitions automatically into a VM?

Do you want the root directory to be on LVM, or just some directory like /home ?

If the latter, you can setup LVM as follows :

  1. Add a disk or two using Cloudmin
  2. Open Webmin on the VM, and go to Hardware -> Logical Volume Management
  3. Create a new VG , and select one of the disks as the initial PV
  4. Add the second disk as another PV
  5. Create an LV that uses up all the space in the VG
  6. Format and mount the LV as /home

That functionality is only available to VM's which actually have WebMin installed, and it takes a lot longer to get into WebMin and then to the LVM screen than to just add the LVM volume through SSH.

Non-webmin VM's don't have any options for LVM, which is why I'm submitting this support request.

Ok, so if it was possible to add a new disk to an existing volume group on the VM as part of the creation process, would that work for you?

Yes, that's what I was asking for :)

But, as a bonus, it would be nice if the VM's could be formatted with LVM on the root partition as well - this would help to resize /var, /tmp, and possibly swap if / as needed too.

Ok, adding to a volume group should be possible to add as an option - although only for a VM that is running when the disk is added.

Having the root disk on LVM isn't likely to ever happen, due to the aforementioned difficulty that it adds to accessing the filesystem from outside the VM.