On the most recent episode of Security Now! [Episode #389 - Listener Feedback #159 & UPnP Exposure Disaster], Steve Gibson mentioned that Dan Fox has a web post that gives instructions for running SpinRite in a VirtualBox Virtual Machine.
He does indeed, but his instructions are for running SpinRite in VirtualBox on a Windows machine. Dan says that the same idea should work on a Mac, but he doesn't give all the details; so here are the step-by-step instructions for a Mac.
Dan's instructions are for running the SpinRite.iso without an operating system in a VM on VirtualBox. That's fine because it eliminates the need to install an OS, but it can be problematic for a Mac user because normally SpinRite is distributed as a Windows .exe file, and one has to run the SpinRite program to create the .iso (a CD disk image). So a Mac user would first have to find a way to run Windows. Therefore, I'll give instructions for running the SpinRite.exe in a FreeDOS VM.
And I'll repeat Dan's warning: "Raw hard disk access is for expert users only. Incorrect use or use of an outdated configuration can lead to total loss of data on the physical disk. Most importantly, do not attempt to boot the partition with the currently running host operating system in a guest. This will lead to severe data corruption." In short, make sure you know what you are doing!
The following steps have worked for me, but I hope to keep refining them over the next few days, so if you see an error or something that needs to be clarified, please leave a comment. If you have success with these instructions or find another way to go about it, please let me know. Thanks!
Step One: Install VirtualBox
Step Two: Install FreeDOS
And you can find detailed FreeDOS installation instructions at this link: http://sourceforge.net/apps/mediawiki/freedos/index.php?title=VirtualBox
Step Three: Put SpinRite on FreeDos Virtual Drive
This is probably the trickiest part if you aren't technically inclined. In the FreeDOS session, set up an ftp server and run it according to the directions in Chapter 6 of the previous web site.
Make a note of the IP address of the ftp server and connect to it from a Mac ftp application such as Transmit. You can also run the ftp program from the Terminal application. Send the SpinRite.exe file to the virtual drive in your FreeDOS VM.
This assumes that you've purchased SpinRite from Steve Gibson's site, of course.
As I said, this part can be a bit tricky for some people, so if you have access to a Windows machine, run SpinRite on that system to create the SpinRite.iso file, then instead of installing FreeDOS and ftp-ing the .exe file, you can just set up a VM on VirtualBox by mounting the .iso file as a CD drive as Dan Fox describes in his instructions.
[Yes, I recognize that some folks might have a hard time here, so I hope to clarify this step in the near future. There has to be an easier way!]
Step Four: Connect the External Hard Drive
Now you want to plug in the external USB or Firewire drive that you want SpinRite to examine.
Please note that whatever you do, don't try to run SpinRite on your boot drive. If that's what you want to do, you will have to boot your Mac from a different drive, but that is outside the scope of these instructions.
Once your external drive has been mounted (this should happen automatically on your Mac once you plug in the drive), run the Disk Utility application. You can find it in the Utilities folder; open a folder in the Finder and press Shift-Command-U and the Utilities folder will open.
In Disk Utility, find your external drive and click on it. Note that you want to click on the drive itself, not the partition. In the screenshot below, notice that I've highlighted the "500 GB Samsung Drive", not the "LaCie Video" which is the partition that is seen in the Finder.
Press Command-I or click on the Info icon at the top of the window. A window will open showing detailed information about that drive. You want to make a note of the Disk Identifier; it should be of the form "disk#", as in this case it is "disk6".
If you've highlighted the partition rather than the drive, the disk ID will be of the form "disk#s#".
After noting the disk ID, close that popup window.
Now click on the mounted partition itself, and unmount the partition by clicking the Unmount icon at the top of the window. This is important; otherwise you will get an error in the next step.
Step Five: Create the Raw Disk
You now want to create a file to let VirtualBox know which disk you want to mount as a raw disk.
In the following example, I'll be using "/Users/jt/Desktop/MyRawDisk.vmdk" as my raw disk file and "disk6" as my disk ID. Modify these commands accordingly.
I would strongly encourage you to copy these commands to the clipboard, paste them into a text editor, edit them to what you want, then copy and paste them one at a time into the Terminal application.
Open a Terminal window and issue the following three commands:
sudo vboxmanage internalcommands createrawvmdk -filename "/Users/jt/Desktop/MyRawDisk.vmdk" -rawdisk /dev/disk6 sudo chmod 777 "/Users/jt/Desktop/MyRawDisk.vmdk" sudo chmod 777 /dev/disk6
The first command uses the command line version of VirtualBox to create the raw disk file. You will need to know your root password in order to run "sudo". Both the "/dev/disk6" and the new raw disk file that you've created have permissions so that only the root user can access them, so the following two commands open up the permissions so that you can access them when you run VirtualBox; the alternative is to run VirtualBox as root. Six of one, six feet under of the other.
Note that I'm using "/Users/jt/Desktop/MyRawDisk.vmdk" to reference my own Desktop folder. Since I'm running the command as root ("sudo"), I can't use the tilde notation; "jt" is my Mac user ID, so substitute your own Mac user ID. You can place the file wherever you like, of course, but be sure to use the quotation marks in case you have any spaces in your file or folder names. It makes life easier if you use the .vmdk extension in your filename.
After you've issued those commands you'll notice that your drive has been mounted again!
Once again, it's important to go back into Disk Utility and Unmount the drive, or you'll get an error in the next step.
Step Six: Connect the Raw Disk
Now open VirtualBox and select the FreeDOS guest OS, click on Storage and add the raw disk file that you've just created as a hard disk.
After connecting the raw disk to VirtualBox, you'll notice that once again the disk has been mounted, so once again go into Disk Utility and Unmount it, or you'll get an error.
Now Start up the FreeDOS session and run SpinRite.
And that is how you can run SpinRite on a Mac.
I hope to keep refining these steps, so please let me know if you find any errors or places where the instructions need to be clearer. And if you have success, I'd like to hear about that as well.