Windows – Installing Server 2012R2 on VM with GPT harddrive issues

gptuefivirtualizationwindows

So… long story short I'm working on automated installations of Windows Server 2012 R2 on systems with GPT drives both physical and virtual. I haven't brought the disk back down stairs to the physical box yet, but my VMs aren't working. Here are the symptoms (all VM, no physical):

When I try to install Windows 2012R2 manually, it runs though the upgrade process rather than an install process. It seems to think that Windows is somehow installed despite the hard disk not being partitioned or formatted. It doesn't make much sense to me. I have entered the console in the installation and confirmed that the C Drive doesn't exist. Disk 0 is fully free and the only volume that exists is the D Drive (DVD).

When I try to install using my automated method I start in a Windows PE environment running a C# program I created. This takes some input and spits out an unattend.xml file which is read during the Windows installation. The program is creating a harddrive that is 100 GB. Some files are copied over but there is atleast 80 GB still free on that drive. There is also an extra 40 GB on the disk (it is 140GB total). In the 2012R2 setup the system will get to the point of showing the progress screen then immediately fail stating that there is a hard drive issue. When I look in the logs, the system seems to be convinced that the hard drive is not big enough even though it seems to read it just fine and it clearly is large enough.

Please note that the automated install works on an MBR system. The only change I'd need to make to get it back to MBR is to not run the GPT command on DiskPart. I'd also need to switch the machine from EUFI to BIOS, or so I assume. Here is the diskpart command (may be slightly off, I'm converting from code, I can confirm that it does create a function C drive with 100GBs when run):

SELECT DISK 0
CLEAN
SELECT DISK 0
CONVERT GPT
CREATE PARTITION PRIMARY SIZE=100000
SELECT PARTITION 0
ASSIGN LETTER=C
ACTIVE
EXIT

The VM is set for EUFI, has a non-partitioned 140 gb thin provisioned drive, is set for Windows 2012R2, and if it's in BIOS and running a version of my software that does MBR format works just fine.

Any ideas? I'm a bit stuck and the problem is wordy enough that it's been difficult to search for on the internet.

Best Answer

OK, I found the solution. Long story short a small 100MB partition needs to be generated before the installation if you are defining partitions rather than allowing Windows to do it. This is probably a unique case as the idea behind this program is to minimize the amount of time a user must touch the system during setup, so we create a partition and copy files over before Windows installs, and then run software installations once Windows starts up, removing the need for the person running the install to mess around with the system. Anyway the change is below:

SELECT DISK 0
CLEAN
SELECT DISK 0
CONVERT GPT
CREATE PARTITION EFI SIZE=100
CREATE PARTITION PRIMARY SIZE=100000
SELECT PARTITION 0
ASSIGN LETTER=C
EXIT