Removing System Reserved Partition from vDisks

Title Image for System Unreserved - Removing the hidden System Reserved partition

That pesky System Reserved partition! Useless in the virtual world as near as I can tell, I don’t understand why Microsoft continues to allow virtual machines to be installed with the partition in place. Basically, for those that are unaware- it is a small partition Microsoft places in front of your “C” drive that contains just the boot information. No OS, nothing like that- just about 100 MB of boot data.

Well- if you are using PVS to manage your XenApp and XenDesktop images (and in most cases, you should be), this partition causes a real dilemma when it comes time to reverse image. Reverse Imaging is required when you need to make any changes to the networking sub-system because you cannot interrupt the iSCSI stream. This means that network drivers, certain system drivers, some antivirus programs may require it. More frequently it is simply updating VMware tools or PVS Target software prior to 7.6 FP3. It just can’t be done without going back to a traditional drive on your hypervisor (e.g. vmdk or vhd.) Granted, in most cases if you are using XenServer, you can just merge and copy the vhd file over, which is kind of awesome. But most of you are using VMware. So- you are pretty much forced to do this unless you want to try the plethora of options that work maybe 50% of the time. No thanks. The way most people take an image from a vDisk back to traditional disk is by using XenConvert or P2PVS. There’s just one problem- it will only allow you to convert a single partition when booted from PVS! So- if you don’t have these boot files on the partition you are converting… you’ll get an invalid boot device error when you start up.

Well, I recently had to do this for about 15 vDisks at a customer, so I figured it was time to take some screenshots and share the love!

Step 1: Moving the Boot Information from the System Reserved partition

Mount the vDisk in PVS

On your PVS server-

mount vdisk

You’ll see a little icon indicating it is mounted.

Now open Disk Management (on Server 2012 R2, right click on the Start Menu)

select disk management

Find the disk- it shouldn’t be hard to find- Server 2008 R2 typically has a 100MB partition, 2012 R2 has a 350 MB. Yeah. MB. Easy to miss. And from now on you’ll be more careful creating VMs, right? Yeah… sure. I always forget so I don’t expect any better of you 😉

view of system drives

You’ll see in my example, that the System Reserved disk has automatically mounted as E, and the targeted disk is F

Copy the Boot files from the System Reserved Partition

Make sure you’ve got system files showing in Explorer, then open up both disk partitions.

open system reserved partition

Alternatively, you can do this in the command line using robocopy… but hey, this is easier.

Select the Boot folder, as well as the bootmgr and bootsect.bak files

select boot files to copy

Copy them to the new “C” drive, in my case it is currently mounted as “F”

What does this do? It prevents all the drama of files in use- but unfortunately we still have to boot to take the next step.

So now, unmount the vDisk from PVS

unmount the vDisk

then assign it to your Reverse Build VM, making sure it is in either Private or Maintenance (for this, I prefer maintenance to have a way-back machine)

make a new vDisk version

Step 2: Removing the System Reserved Partition

Okay- now it’s time to remove the system reserved partition the right way. Windows has references to the boot partition location in a special location that is difficult to modify via other means. I’ve tried- this is the quickest sure fire way, unfortunately.

Make Changes to BCD on the Maintenance VM

Power up your Maintenance VM and be sure it started from your new Maintenance version.

Launch Disk Management on your VM

Now is the point when I usually rename the vDisk in Windows to better identify it. I like to give it something like “original”

Now for the fun part (well, one of them). We need to let windows know we’d like to boot to the C partition.

Open a command window as admin and enter the following:

  1. reg unload HKLM\BCD00000000 (that's eight zeros)
  2. bcdedit  /store  c:\boot\bcd  /set  {bootmgr}  device partition=C:
  3. bcdedit  /store  c:\boot\bcd  /set  {memdiag}  device  partition=C:

    bcd edit screenshot

Now this next part is SUPER IMPORTANT, so don’t forget it like I always seem to when I’m in a hurry. You need to mark the partition is active so the BIOS can see the boot partition!

don't forget to mark the C partition active!

Restart the VM and cross your fingers!

Once back up, it’s a good idea to verify that you really did boot from the new active disk

Basically, C should be active, and the System Reserved should NOT be active. No amount of PVS magic can get you around this one, folks!

You can now delete that pesky System Reserved Partition if you like.

So, you may be thinking… I’ll just extend the C drive!

optional- extend volume

Congratulations! You won’t be able to that easily! #sarcasm

Don’t worry about it though- when we run conversion we can make the disk any size and you’ll never see the system reserved partition again!

But hey- if that is all you needed, seal your vDisk and enjoy. Who cares about that tiny little empty partition, anyway, right?

But… since I happen to be doing massive conversions this week, I may as well continue guiding you on the likely scenario you’re facing in the first place- that doing a Reverse Build with one of these partitions in place is real pain, and in some cases nearly impossible!

Step 3: Get Rid of the System Reserved Partition for good with a Reverse Build.

Note- some people like to use the BCDedit method to make reverse build changes. But I will tell you that I’m getting about 25% success with that method (sorry, Carl!), which is unfortunate. Someday I’ll get it perfected and I certainly welcome your feedback… because that method would work a lot better for this next bit, I think. If I ever get it working reliably I’ll update this article. Consider this for the traditionalists… or for people like me that really don’t have the time to play with methods that may or may not work. This one works every time for me, so it’s what I do. I’d love your feedback if you have a method that works every time!

Add A Disk to the Maintenance VM or Reverse Build VM

add a disk to your reverse build vm

Note, I use BDM Disks for my VMs, a discussion for another day. But go ahead and add a new disk to your VM if you don’t already have one there on your maintenance machine. I typically have a PVS-booting Reverse Build machine in my environment that is part of an OU with inheritance blocked. This allows me to quickly do this process for any vDisk without the problems of policy corruption.

Quick note here, this is the perfect time to increase the size of your vDisk, which should always have headroom to include all the files in the structure plus the ENTIRE size of the WriteCache drive. Trust me- it matters. In the likely case you’re using Server 2008 R2 – you should also plan on having at least 1 GB per concurrent user (per server) as free space. It may seem counter-intuitive, and please remind me to have a larger discussion on this in the future if I forget… but you’ll need it, trust me.

I usually start around 80 GB for my Server VMs unless they have a need to be fatter. If you use dynamic disks (and in almost every case you should be), it barely matters. For this conversion process, however- we’ll go with 80. You’ll see my original had 32 GB. We already had a 4 GB WriteCache but I have seen around 40 users in these servers, so I’m going with 80 as a standard to give some headroom.

make sure the drive has the right capacity

Boot VM from PVS maintenance vDisk

This is usually the point I double-check to make sure my Reverse Build machine is booting from vDisk, not Hard Disk for this phase, anyway)

Boot up the VM with the elderly vDisk attached. You may see a prompt asking you to restart for the new hardware. Tell it to wait, we’ll get there, sparky! That means ignore the prompt, for those of you without my American humor.

Initialize and Format the Reverse Build Disk

Launch Disk Management on your VM, and expect the prompt to initialize the disk. Do so as MBR in most cases.

initialize the disk

This is a good time to go ahead and format your conversion disk. Note- the disk needs to be at least 4k alignment to contain the boot files but it will be erased and reformatted anyway. If you’re paranoid like I am, however…

formatting the new disk

Don’t worry much about the name, it’ll get overwritten soon anyway.

Run P2PVS to Convert Volumes

XenConvert is dead. Long live its wholly unsuitable replacement, P2PVS.exe… get used to it folks. Likely a lot of you reading this will have no context for how utterly disappointing this is from the glory days of XenConvert’s many flexible options, but… I digress.

Your choices in this scenario are… well, volume to volume- the whole reason you’re reading this article in the first place!

run P2PVS to convert the volume

But- at least now it will actually… you know… WORK!

select the source and destination volumes

Now, before you shut it down… like I did in the midst of screenshotting this process… AGAIN…

Mark the Converted Disk as ACTIVE

First, do yourself a favor and rename this disk right now…

Then, remember to MARK THE DISK ACTIVE if it isn’t already. It happens. Not sure why I’m always forgetting that, but if you don’t (hilariously, I did so three more times in the course of my evening) you’ll end up right back where you were. No big deal, but frustrating and time consuming.

double-check to make sure the converted partition is active

Step 4: Correcting the Drive Capacity

Now, this volume-to-volume conversion method has another problem. The problem is that the size is rarely displayed correctly after P2PVS conversion if the target drive was larger. Typically the drive will appear the exact same size.

screenshot of a converted volume not showing the full size of the disk

You’ll note that our 80 GB partition (you see it above) only has a 50 GB capacity! This may boggle and confuse. You’re not alone.

It shows in Disk management as an 80 GB disk but what you’ll see looks like this:

Time to go back to the command line, friends

Enter the commands:

Diskpart
 

List volume
 

(take note of the label we made earlier- now you know why…)

screenshot of diskpart

Select volume n (the n being the number of the volume you want to extend)

Extend filesystem
 

Exit
 

That’s it!

Your volume should now be all sortsa pretty

Now, shut the machine down and change the boot to the freshly converted local disk. If you are smart and using the BDM like I am, all you have to do is change the disk order. Done. No messing with the BIOS screen or boot orders. Just Winning.

If you feel like it, go ahead and take the opportunity to change the PVS target device to boot from Hard Disk. You’ll need this later… but you can also do it later.

boot from hard disk

Step 5: Reverse Build

I’m not going to capture more screenshots on this process as you can pretty much consider it a traditional P2PVS capture going forward. Once you have made your changes to the vDisk (typically installing new VMware tools and PVS target software, as mentioned), image the drive to PVS using your normal procedures.

Congratulations. You now have a larger, up to date PVS vDisk with no pesky System Reserved Partition!

If this article was helpful, please do share it with your CUGC and other groups! Feel free to link this in your blogs and Tweet about it. I depend on people sharing for the word to get out about this site! I also encourage you to comment here or join our Facebook Group!

-DJ “XenMaster” Eshelman

By the way- if you’re like me, you are on the go a lot and still want to listen to books. Personally, I use Audible for this on my smartphone. Amazon has a great promotion going right now: Get two books on Audible for FREE for signing up with my link! My favorite feature right now is Whispersync for Voice, which allows you to sync your position in the audio book with it’s Kindle counterpart. Right now I’m reading Ctrl-Alt-Revolt using the Whispersync for Voice feature. It works great! (Buy Paperwhite Kindle on Amazon for this feature)