Extending Storage for an LVM-Backed Windows Guest Domain with KVM/QEMU

Well that was significantly more painful than I had anticipated.  Here’s the quick and dirty instruction set which involves multiple tools, perhaps needlessly, since I was investigating the issue for some time:

  1. Shut down the guest domain (someone might be able to whip up an online resize method, but given the GPT modifications I required, I’m not sure).
  2. Extend the logical volume providing the guest domain’s storage (I’m using raw storage on an LVM) with lvextend as usual.
    1. Example:  lvextend guests/domainVolume -L +40G
  3. Open up the logical volume with gdisk and repair the now-corrupt GPTs (both primary and backup) so that they properly recognize the disk size.
    1. If gpart detects the GPTs as valid, then perform a ‘v’ (to verify the disk).  The gpart utility will inform you that the secondary header’s self-pointer indicates that it doesn’t reside at the end of the disk. You may then use the ‘x’
      option to enter the experts’ menu where you can use the ‘e’ option to relocate the secondary header to the end of the now-extended volume.
  4. Start up the guest domain
    1. Within Windows’ Virtual Disk Manager, I noted that my partition layout was correct (with the system volume extended and everything); this was likely because I had attempted to extend the system partition previously (between steps 2 and 3) and was receiving “Invalid Operation” errors from Windows.  It probably made some headway but failed halfway through, so the partition was properly recognized as extended after I fixed the GPT.
  5. Use Windows diskpart to select the volume targeted for extension (e.g. select volume 3), and extend the filesystem on the volume (extend filesystem).

That is more of a pain than it should be.  Silly Windows VDS.

This entry was posted in Information Technology and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s