LVM management for guests


Current setup on my test server is 1 20GB drive for all the dom0 stuff, and a larger drive which will hold all the domU images. There will be 2 images for each system – 1 20GB partition which will be mounted as / and 1 512MB partition which will be used as swap.

Because I’ve now gone through 3 drives, I think I know how to do this very well. First off, use fdisk and change the partition type of the drive to 8e, or Linux LVM. (Just to make things simple, the entire disk is partitioned as one large partition, I’ve decided to use LVM is manage partitions instead.)

Then, run pvcreate /dev/[h|s]d[a-z], where [h|s]d[a-z] is the name of your disk – for some reason, it’s not possible to do this on a partition by partition basis, probably because this physically prepares the drive somehow. Not too sure how. Just tried it with a new drive. It works now for some reason.

After that, run vgcreate <vg name> <partition(s)>. I just used vgcreate domU /dev/hdc . (This is where the partition-by-partition basis comes in.) It seems to work if you specify an entire drive. I shall just chalk it up to not remembering properly.

To finally prepare the logical volumes, run lvcreate -L<size> -n <name of lv> <name of vg>. I used lvcreate -L20G -n <distroname> domUs and lvcreate -L512M -n <distroname>-swap domUs

The best resource I found on LVMs (with a quick Google search) was this: www.howtoforge.com/linux_lvm

  1. No comments yet.
(will not be published)