Thursday, 8 January 2015

Virtual Machine Host, hard drive config

This is going to be post one of probably 6 or so (If I do them all) relating to how I have gone about setting up Virtual Machines Hosts at various sites. It is mostly to act as an aid memoir for myself but if it helps anyone else then that's a good thing.

Moving virtual machines between hosts works a lot better if the 2 hosts are configured the same way. I want to try and standardize the way I setup VM Hosts to make life easier down the line. The first thing I am looking at is how I have the VM disk images stored on the host.

All the advise seems to point to using LVM to manage your disk images. This makes sense as it means it's easy to resize the virtual disk and easy to change the underlying physical disk architecture without disturbing the virtual disks.

The standard layout we will be using will have a disk (or array) for the Host Operating System and then one or more disks (or arrays) for the virtual machines to live on. By putting the host os on a separate drive I hope to keep the VM Disk IO load away from the physical host so it does not degrade performance. On hosts where there are lots of drive bays I will probably create multiple arrays to serve different functions. One example may be to have 2 x 1TB SAS disks in a mirror for the OS' and 4 x 2TB SATA disks in raid 5 for the data.

My plan is to have, as standard, two volume groups called "VM OS Disks01" and "VM Data Disks01". It should not matter which physical disk they are located on as long as the VG names are consistent across servers. In situations where there are multiple disks we may have Disks02, Disks03, Disks04 etc in addition to the 2 standard ones.

There also seems to be some discussion (*) as to the best way to create a Physical Volume if you are using the entire disk. One option is to use the raw device the other is to create a partition table and one primary partition. The raw disk approach requires less setup but could cause issues if someone looks at the disk with, say fdisk as it would appear to be empty...The SAFE method would appear to be to create a partition table and one partition that uses the whole disk and then create the PV on that partition however the most flexible (if your admins are not idiots) is to use the block device.

For this example I want to put two VGs on one disk. Each VG takes up an entire PV and each PV takes an entire device so I'm going create a partition table with 2 partitions so that I can create 2 PV's one for each VG. The "disk" I am using is actually a 6TB raid 5 array on 4 x 2TB disks being managed by a HP raid card.

So, to the setup;

Create a partition table
parted /dev/sdb mklabel gpt

Create 2 partitions
parted /dev/sdb mkpart primary 0GB 2000GB
parted /dev/sdb mkpart primary 2000GB 6000GB

Create 2 physical volumes, one on each partition
pvcreate <your device name>
pvcreate /dev/sdb1
pvcreate /dev/sdb2

Create 2 volume group. They could contain several PVs for fault tolerance but we only have the one as the hardware is worrying about sorting the disk out for us.
vgcreate <VG name> <pv device(s)>
vgcreate vm_os_disks01 /dev/sdb1
vgcreate vm_data_disks01 /dev/sdb2

Create some logical volumes (more a practice than a requirement at this stage)
lvcreate -L <size> -n <volume name> <vg it should be housed in>
lvcreate -L 128G -n Ubuntu-test-OS-01 VM_OS_Disks01
lvcreate -L 500G -n Ubuntu-test-Datastore-01 VM_data_Disks01
lvcreate -L 500G -n Ubuntu-test-Datastore-02 VM_data_Disks01
lvcreate -L 500G -n Ubuntu-test-Datastore-02 VM_data_Disks01
lvcreate -L 160G -n Windows_7-OS-01 VM_OS_Disks01


http://serverfault.com/questions/439022/does-lvm-need-a-partition-table

2 comments:

  1. Hey rather cool internet web-site!! Man .. Beautiful .. Amazing .. I?ll bookmark your internet site and take the feeds also?I'm happy to uncover numerous beneficial details right here inside the submit, we will need develop far more strategies in this regard, thanks for sharing. . . . . . WD Elements Portable Hard Drive Price in India

    ReplyDelete
  2. I am really loving the theme/design of your site. Do you ever run into any web browser compatibility problems? A small number of my blog audience have complained about my blog not operating correctly in Explorer but looks great in Firefox. Do you have any solutions to help fix this issue? Seagate External Hard Drives

    ReplyDelete