Hyper-V, Virtualization, Windows
Leave a comment

Configuring pass through SCSI drive on ServerCore guest

If you are also experimenting with Hyper-V, by now, you would have come across a feature called pass through hard drive configuration for guests. This feature exposes a physical disk to the guest operating system as a raw disk. Tony Voellm explains about various storage options available in Hyper-V here.

Coming back to the subject of this post — on Windows Server 2008 (including Server Core flavor) guests — when we configure a pass through SCSI drive, disk’s read-only flag will be set. This can be verified by using diskpart.exe and running the following commands

diskpart> Select Disk x (replace ‘x’ with pass-through drive number from list diskDiskpart Read-Only Outputoutput)
diskpart> detail disk

As you see in this screen shot, Read-only flag will be marked yes, by default.
With this flag set, you get an error message “Media is write-protected”, if you try to create a partition or run any command that modifies the disk layout. To verify this, try something like
Diskpart> Create partition primary on this disk

To work around this issue, Select the pass through disk and run
Diskpart> Attributes Disk Clear Readonly

Diskpart Readonly Clear OutputAfter this, if you run detail disk again, you shall see output similar to what is shown in here.
You will now be able to modify the disk layout as you like.
This whole process will not apply to any scenario not using diskpart.exe for disk management.