How to Run SpinRite in VirtualBox

SpinRite is a popular hard drive maintenance and data recovery software from Gibson Research Corporation, and costs $90 to own. While I haven’t extensively used the software, it has helped me recover data from hard drives when I thought the data was lost. It is a small application, and you also don’t need a powerful PC to use the application.

The once aspect of SpinRite that makes it different from other drive maintenance and data recovery tools is that you are required to boot up your computer using SpinRite to launch the application. SpinRite loads a copy of FreeDOS, detects the disks on your system and then allows you to perform specific scans of the disks.

Of course, if you need to scan a hard drive, you will usually need to connect it to either the IDE your SATA interface within your computer, which requires you to open up computer, and then connect the hard drive to the correct interface so the FreeDOS operating system can find your hard drive. In order for you to connect the drive to the USB port of you computer requires you to load the USB drivers within FreeDOS in order for the hard drive to be detected.

The alternative is to use a virtual system created by software such as VirtualBox to automatically setup and use a hard drive that is connected to a USB port. While the scanning may not be quite a fast, it is much easier to simply connect a hard drive to a USB port and then have SpinRite scan the hard drive in a virtual system.

I outline the steps that you need to follow to run SpinRite in VirtualBox.


SpinRite Running in VirtualBox

Setup the Virtual Drive

In order to scan a hard drive with SpinRite from within a virtual system in VirtualBox, you will first need to create a virtual hard drive. This virtual hard drive will essentially be the hard drive you want to scan. You will not be booting the virtual system from this drive, as this will be handled by SpinRite.

The steps below outline how to create a virtual hard drive.

Note

I am using Windows 7, so the steps below describe what I do on Windows 7. For other versions of Windows, you may need to adjust the steps a bit to get it to work, but the steps should be very similar.

Create the SpinRite ISO

We will need to create the SpinRite ISO file that will be loaded by the virtual machine. This is easily done from within SpinRite:

  1. Run SpinRite and then click the “Create ISO or IMG File” button.
  2. SpinRite

  3. Click the “Save a Boot Image File” button and select the location where you want to save the ISO file.
  4. SpinRite - Save a Boot Image File

  5. Once the image file is created, you will be shown a confirmation message. Click the “Close” button to close the windows.
  6. Click the “Exit” button to close SpinRite.

Get the Hard Disk Number

Before we create the virtual machine, you will need to get the hard disk number for the hard disk you will scan with SpinRite. Use the following steps to get the hard disk number:

  1. Connect the hard disk to your computer, which is called the host machine.
  2. Once the hard drive is connected, you will need to find the disk number. This is easily done with the following steps:
    1. Bring up the Windows Start menu, and enter “Computer Management” in the search box.
    2. From the list of search results, right-click “Computer Management” and then select “Run as administrator” from the menu. Enter the administrator password, if required.
    3. From “Computer Management”, expand the “Storage” item on the left, and then select the “Disk Management” option.
    4. in the middle part of the window you will see a list of drives that are connect to your computer. In the bottom half you will see the disk numbers for you hard drives. In my case, as shown in the image below, I will be scanning “Disk 1” (drive E). You will need to find the disk number for your drive in the same fashion.
    5. Disk Management

Create the Virtual Machine

  1. Once you have the disk number, open the Start menu and enter “cmd” in the search box. Right-click “cmd.exe” from the search results and select “Run as administrator”, and enter the administrator password, if required.
  2. Navigate to the folder where VirtualBox is installed. For me, I would enter the following:
  3. cd C:\Program Files\Oracle\VirtualBox\
  4. Now you will need to create a raw disk of the hard drive you want to scan that will be used with virtual box. The command you need to run is as follows:
    vboxManage internalcommands createrawvmdk -filename "[raw disk filename path]" -rawdisk "\\.\PhysicalDrive[disk number]"

    For example, I will use the following:

    vboxManage internalcommands createrawvmdk -filename "C:\Users\Public\Documents\VirtualBox\Raw Disk Images\laptopdisk.vmdk" -rawdisk "\\.\PhysicalDrive1"
  5. Once you have created a raw disk, you will now need to start VirtualBox by right-clicking on the VirtualBox shortcut and select the “Run as administrator” option.
  6. After VirtualBox is loaded, click “New” in the toolbar.
  7. VirtualBox - New Virtual Machine

  8. In the “Create New Virtual Machine” dialog, click the “Next” button.
  9. In the “VM Name and OS Type” dialog enter the following:
    • Name: Enter a name for your virtual machine.
    • Operating System: Other
    • Version: DOS

    Click “Next” to continue.

  10. VirtualBox - VM Name and OS Type

  11. For memory, you can accept the default or increase it if you wish. For me, I haven’t had any issues with using 32-128 MB of memory. Click “Next” to continue.
  12. VirtualBox - Memory

  13. In the “Virtual Hard Disk” dialog, uncheck “Start-up Disk” because you will be boot the virtual machine using SpinRite. Click “Next” to continue.
  14. VirtualBox - Virtual Hard Disk

  15. If you get a warning message about not attaching a hard disk to the virtual machine, just click the “Continue” button.
  16. You will now be shown a “Summary” window. Click the “Create” button to create the virtual machine.
  17. Once the VirtualBox window is back, click the “Settings” option from the toolbar.
  18. VirtualBox - Settings Option

  19. From the options on the left, click “Storage” and then the “add new attachment” icon.
  20. VirtualBox - Storage Settings

  21. Click the “Add Hard Disk” option.
  22. VirtualBox - Add Hard Disk

  23. Click the “Choose existing disk” button.
  24. VirtualBox - Choose Existing Disk

  25. Select the raw disk in step 3 above and click the “Open” button. The raw disk you created should now appear in the list of storage devices.
  26. Now we will add the SpinRite ISO as a CD-ROM. Click the “add attachment” icon, again.
  27. Click the “Add CD/DVD Device”option.
  28. In the next question dialog, click the “Choose disk” button.
  29. VirtualBox - Choose Existing CD-ROM

  30. Navigate to the SpinRite.iso you create in the first section, select the file and click the “Open” button.
  31. Once the hard drisk and the ISO (CD-ROM) storage devices have been added, they should now appear in the “Storage Tree” list.
  32. VirtualBox - After Adding Storage Devices

  33. Click the “OK” button to close the “Settings” window.
  34. Click the “Start: button from the toolbar to start your virtual machine.
  35. SpinRite should load automatically within your virtual machine. If it doesn’t select “Devices->CD/DVD Devices->(The IDE controller of your CD/DVD you added)->SpinRite.iso” to load SpinRite.
  36. You can now run SpinRite to scan your hard disk.

SpinRite Critical Error Solution

When I tried to run SpinRite to scan my hard drive within a virtual machine, I ran into an issue. SpinRite produced the following error:

Vritual Box - SpinRite Critical Error

The problem appears because Windows appears to have “locked” the hard disk in some manner which prevents the virtual machine from gaining exclusive access to the hard disk. This problem is solved by using the following steps:

  1. Close all applications that are accessing the hard disk.
  2. Once you have the disk number, open the Start menu and enter “cmd” in the search box. Right-click “cmd.exe” from the search results and select “Run as administrator”, and enter the administrator password, if required.
  3. At the command prompt, run the following command:
    diskpart
  4. The “DISKPART” tool will load, and show “DISKPART>” as the prompt.
  5. Using the same disk number as above, enter the following:
    select disk [hard disk number]

    For example, in my case the hard disk was “disk 1”, so I would use the following command:

    select disk 1

    A message should be displayed that your disk has been selected. The following commands will now only act on that disk.

  6. Enter the following command to take the disk offline:
    offline disk

    A confirmation message should be displayed.

  7. Next we will clear the read-only attribute using the following command:
    attributes disk clear readonly

    A confirmation message should be displayed.

  8. Type the following to exit the DiskPart utility:
    exit

Once you have completed running the above command, you should now be able to scan the hard disk with SpinRite from within a virtual machine within VirtualBox.

Follow Me