SpinRite, VMware and Windows 7 or Windows 8

Today, my moderately trusty Windows Home Server HP MediaSmart ex495 started complaining of a disk issue. The built-in repair tools seemed to clear the error code, but when I went to run an error scan using HD Tool Pro, the box locked up.  After a reboot, I saw some SMART errors on the disk.  Time for SpinRite!

SpinRite is a trusted tool for performing hard disk maintenance on magnetic hard drives (not flash drives!).  Typically, one would use SpinRite by creating a boot CD or USB stick and running it on a dedicated PC. While it’s running, you can’t use your PC for anything else. It can take hours to do its job.

My preferred method of running SpinRite is inside a virtual machine on my laptop, using an external USB or eSATA dock to connect the troubled disk. To do this, I’ve created a tiny virtual machine in VMware Workstation 8. When creating it the first time, I booted into the virtual machine’s BIOS to change the order of the boot devices to ensure the ISO is the first boot device. I connect the troubled disk to the VM using the Physical Disk option in VMWare Workstation.

I used this method for some years, until it stopped working after moving to Windows 7. Windows 7 would seem to take a lock on the external disk, and the VM seemed to not be able to connect to the physical disk.

The fix for me is to use the DiskPart command line tool with some specific commands to get Windows to release the physical disk so VMware can use it.

In my case, the disk I needed to operate is Disk 2.

Run an elevated command prompt (as Administrator), then run “diskpart”.  Once in diskpart, issue these commands.

list disk
select disk #
offline disk
attribute disk clear readonly

That should do it. The next time you boot the VM, it should be able to take ownership of the physical disk.

Edit August 26th, 2013:

I just confirmed this technique continues to work on Windows 8.