Using Physical Disks with VMware workstation

I want to try out the new iSCSI target feature of Windows Server 2012. This feature only works with virtual disks however, not physical disks, so I’ll have to create a VHD file in the machine and use that as a target. No problemo, just that the server itself is running from a virtual disk (as it’s a VM running on VMware Workstation) and it kind of feels odd to have a virtual disk inside another virtual disk – all that overhead is going to make it slow! So I decided to pass a physical disk instead, to the server, and let it create the VHD file on that.

First, decide if you are going to allocate a disk or a partition to the virtual machine. I was going to allocate a partition, so I cleared up some space, made an empty partition on it, edited the settings of the virtual machine, and added this partition as a physical disk. One thing to keep in mind is to NOT choose the “Independent disks” mode in settings. I selected this mode initially as I didn’t want the disk to be used when making snapshots, but this had the unintended effect of making the disk read-only to the guest. I am guessing this is a bug. Independent mode doesn’t really apply to physical disks anyway as they bypass the hypervisor and so can’t be snapshotted.

After adding the disk, power on the virtual machine. The disk will be present, but you’ll have to get it ready before being able to use it, so here’s what I did. Note that I am using Windows Server 2012 Core so diskpart is all I have.

The formatting fails! This is because the disk is shown as read-only for some reason so we have to tell diskpart to clear that attribute. Do the following –

And now it formats and we can use the disk! Thanks to this KB article where I read about clearing disk attributes.