Adding Disk to my Xen VMs

Ok, I added some space to one Xen VM this morning.  Wasn’t too bad, although there are so many ways to do this in Linux.  I wanted to do something simple.  Create a file on the host O/S (grant), attach it to the VM (sherman) and then just add it into the filesystem.  I was surprised at the number of commands I had to run, but they all made sense:

  1. Use dd to create a file on grant that will become a new disk on sherman
  2. Shutdown sherman using xm shutdown
  3. Edit the sherman configuration file under /etc/xen to add the new file as another disk (took me a minute to remember the disk naming conventions)
  4. Re-start (“re-create”) sherman so that it recognizes the disk
  5. Use fdisk to partition the disk on sherman using a primary partition and changing the type to 8e so that the Linux LVM can manage it (Look at all the types!)
  6. Use pvcreate to create a new physical volume on the device partition
  7. Use vgscan to look at the volume groups
  8. Use vgdisplay to display the current volume group
  9. Use vgextend to add the new physical volume to the volume group
  10. Use lvscan to verify the addition
  11. Use lvextend to extend the logical volume onto the newly added space
  12. Use resize2fs to extend the filesystem to the newly extended logical volume space


Many thanks to the following:

  1. Re: Adding more space to the system without using LVM in the host
  2. Extend Your MythDora Video Partition using LVM
  3. Extending a logical volume

Leave a Reply

Posting code can be a pain. To make sure your code doesn't get eaten, you may want to pre-format it first by using HTML Encoder