Home > Utility > Run SpinRite on a Mac

Run SpinRite on a Mac

Yes, I succeeded in running SpinRite 6 on an Intel Mac!

Here’s a screenshot:

Here’s a video:

You might notice that it’s horribly slow: about 1MB/sec if there are no errors. This makes it pretty much useless unfortunately. I’m just not that patient.

How It Is Done

Here are the key components for making this work:

Until recently I had no way to do the raw disk access in a virtualization tool. VM Fusion v2 didn’t support it (don’t know about the current version). Sun (now Oracle) VirtualBox didn’t support it, but starting with v1.4, it does.

Step 1: Boot from another hard drive

This isn’t a small step. Get an external hard drive, a cheap one will do. If you have a spare, bare hard drive lying around, get an enclosure for it (I got some 2.5″ laptop HD enclosures for $7 each, shipped, on eBay).

You’ll either have to install Mac OS X on the hard drive directly or use something like Carbon Copy Cloner to copy your installation over. There are instructions for this sort of thing around the net.

Restart your Mac and hold down the Option key. That will present you with a choice of bootable volumes (like grub, for the geeks out there). Select your external drive.

Step 2: Install VirtualBox

VirtualBox is a free tool from Oracle for running other operating systems in a window inside your computer. If you don’t know about it yet, you might be pleased to learn you can run Windows applications right there on your Mac without having to reboot using Boot Camp.

Download and install VirtualBox.

Step 3: Set up raw disk access

The tricky thing here is that instead of having VirtualBox use a file on your hard drive to represent an entire guest operating system’s hard drive, you actually want it to have raw access to a real drive on your computer (your internal drive, presumably). Chapter 9 of the user’s manual describes how to do this but leaves one part out. Perhaps we can get that updated.

First we have to know what to call our raw internal drive. From the Terminal enter this command:

$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            999.9 GB   disk0s2
... and so on ...

That will list all drives attached to your computer. You’ll have to look at the sizes probably to determine which one is the drive you’re interested in. It’s probably /dev/disk0.

A quick look at this device reveals that it is owned by root, not you. In the Terminal:

$ ls -l /dev/disk0
brw-r-----  1 root  operator   14,   0 Jul 17 18:11 /dev/disk0

You’ll have to fix this. I can’t say that what we’re about to do is normally a good idea, but presumably we’re only doing this on our non-production, SpinRite-dedicated, external boot drive. We need to make the device owned by you. In Terminal, and replacing USERNAME with your user account’s name:

$ sudo chown USERNAME /dev/disk0
Password:

You’ll have to enter your account password.

Now finally we can create a VirtualBox “disk image” that actually points to the raw device. All of the following lines should be on one line; I’ve broken them up for easier reading.

$ VBoxManage internalcommands createrawvmdk 
  -filename /full/not/relative/path/to/file.vmdk
  -rawdisk /dev/disk0
  -register

Step 4: Create a VirtualBox virtual machine

Now in VirtualBox you’ll go through the normal process of creating a virtual machine, but instead of creating a new virtual hard drive, you’ll select “Existing VMDK” and point to the VMDK file you just created.

You’ll get a SpinRite ISO image, which presumably you made on a Windows machine when you downloaded SpinRite, and mount that in the virtual machine as well, and when you start the virtual machine, Voila! You have SpinRite running and accessing your Mac HD. Slowly.

Why Is This Necessary?

This is painful. Why can’t you just pop in the SpinRite CD and boot your Mac? You can. Your Mac will boot the SpinRite CD and take you to the title screen where you’ll sit. And sit. And sit. Forever. Because although the CD boots, the software cannot read your keyboard inputs. Ack!

Who’s fault is this? Well, that’s not really the right question. Here is a slightly rough, slightly inaccurate, but generally helpful description of the problem. SpinRite works at a very low level without any operating system support to speak of (except a bit from FreeDOS). To read your keyboard inputs, SpinRite has to monitor actual hardware interrupts, and although these have been the same on PC BIOSes for years, Macs use the newer EFI firmware, and the mappings are different. Thus no keyboard. See update below.

Judging from his comments on the Security Now podcast, SpinRite creator Steve Gibson has no plans to update SpinRite, and indeed updating it to account for a new BIOS is no small task. We could perhaps ask him on his feedback page to consider making a slight update to SpinRite which would create a SpinRite CD that automatically selected Drive Maintenance on all attached drives and began working without any user input. That way regular maintenance runs that generally don’t require any intervention could run, and if there was a more serious problem, well, then we’re simply back to square one.

Yes, ask him.

Update: Mr. Gibson provided some feedback in the comments indicating that the issue is deeper than just keyboard interrupts, so having a run-automatically version wouldn’t help us. Rats.

Categories: Utility Tags: , ,
  1. September 17th, 2010 at 16:54 | #1

    This is not only a keyboard issue. The INT’s from BIOS are used also to access the disks, so all the methods need to be translated to EFI.

  2. September 17th, 2010 at 16:58 | #2

    Nuts. OK, don’t bother asking him. =) Thanks, Steve, for the expanded explanation.

  3. Gene Lee
    November 16th, 2010 at 02:00 | #3

    Hi, when I get to the part where I have to create a virtual disk image pointed to the raw device, it says:Oracle VM VirtualBox Command Line Management Interface Version 3.2.10
    (C) 2005-2010 Oracle Corporation
    All rights reserved.

    ERROR: VMDK: could not create new file ‘/full/not/relative/path/to/file.vmdk’
    Error code VERR_FILE_NOT_FOUND at /Users/vbox/tinderbox/3.2-mac-rel/src/VBox/Devices/Storage/VmdkHDDCore.cpp(3491) in function int vmdkCreateRawImage(VMDKIMAGE*, VBOXHDDRAW*, uint64_t)
    Error while creating the raw disk VMDK: VERR_FILE_NOT_FOUND
    The raw disk vmdk file was not created

    Why is this?

  4. November 16th, 2010 at 13:21 | #4

    The first problem is that you need to replace ‘/full/not/relative/path/to/file.vmdk’ with an actual pathname relevant to your computer.

    Not sure if there are other problems masked by that one.

    -Rob

  5. Gene Lee
    November 16th, 2010 at 16:48 | #5

    So I put a pathname relevant to the disk I want analyzed by spinrite? i.e. ‘MAC\ OSX/Users/jaelee/Downloads/file.vmdk’? Am I pointing it to an already existing file or creating a new one? The new one being “file.vmdk?”

  6. David Fulton
    November 16th, 2010 at 17:36 | #6

    Hi Robert,

    I am trying to repair / recover / backup a 500Gb disk in a 2007 Intel iMac which has gone on the fritz. The iMac is running OS X 10.6x. I also have a MacBook Pro (MBP) and I was wondering if you have considered the following:

    Install VirtualBox on the MBP and loading the SpinRite software in the VM, as you describe, and then connect the iMac (target) to the MBP (host) using Firewire Target mode. I connected my MBP to the iMac in target mode to run DiskWarrior (DW), but DW failed in it’s repair process.

    I am not sure how to go about mounting the iMac drive in the VM on my MBP, but I am thinking it might work. What are your thoughts?

  7. November 22nd, 2010 at 12:54 | #7

    @GeneLee You’re pointing to a new file that the VBoxManage command is creating.

    @DavidFulton Not sure if connecting via FireWire will work since SpinRite doesn’t support FireWire. Not sure if VirtualBox would emulate a layer there or not for you.

  8. December 21st, 2010 at 14:22 | #8

    @GeneLee You’re pointing to a new file that the VBoxManage command is creating. @DavidFulton Not sure if connecting via FireWire will work since SpinRite doesn’t support FireWire. Not sure if VirtualBox would emulate a layer there or not for you.

  9. December 29th, 2010 at 22:22 | #9

    spinrite is something u want to run on an older machien and leave it on for a week to refurbish a hard drive.. not something ud run on your shiny new imac or mac pro.. you wanna run this on your beat up old clunker of a machine set up on the floor in your basement or something..
    !

  10. December 29th, 2010 at 22:23 | #10

    i wish there was a program that would be able to use an old machine and process more then one harddrive at a time.. so you can fix and maintain your harddrives..

  11. Russ
    January 3rd, 2011 at 10:13 | #11

    Thanks for the info. I couldn’t get spinrite to work on my mac either. The problem is that my mac is dead and won’t boot. I’m assuming from your post here, that the machine you install virtualbox and spinrite on need to be working in the first place, correct? (ie. there’s no way to get spinrite working on a mac that won’t boot?)

    Thanks!
    -russ

  12. January 3rd, 2011 at 11:29 | #12

    @Russ Yes, sadly you need a working computer to begin with, or at least a working, bootable external drive. You’d have to have gotten this set up ahead of time.

    Here’s hoping Mr Gibson can bring SpinRite to us Mac users sometime…

  13. Russ
    January 5th, 2011 at 14:05 | #13

    Just an FYI, i got this working, but there were some tweaks.

    1. On the command to make the virtual disk for virtualbox, I got an error saying “-register” was an unrecognized option, i took it out, it’s working so far without that.

    2. The OS would consistently try to mount the internal HD, and this gave errors in virtualbox, and via the command line when trying to use the hard drive. So i would have to go to disk utility and unmount the drive. Then virtualbox could access it.

    Hope that helps someone.

  14. Laszlo
    January 24th, 2011 at 22:45 | #14

    Hi,
    thanks for the hack!

    But sadly, I could not get VirtualBox working. As Russ said, the -register parameter was invalid. But even without that, I got a VERR_RESOURCE_BUSY error. I could not unmount the internal drive though. (I cannot think of what is using it.)

    A newer version of VirtualBox break this, or what is wrong?

    Thanks for any help!

  15. Dan
    January 30th, 2011 at 05:06 | #15

    I’d like to run spinrite on my families laptops for preventative reasons. I’m more then happy to purchase spinrite after I figure out how to do this. Is the enclosure you bought a USB enclosure, and will spinrite run from the USB enclosure on the laptops internal disc?

  16. March 11th, 2011 at 11:15 | #16

    @Laszlo About the resource busy thing, this last time I had to unmount the HD from the command line (even though it didn’t show up in the Finder anyway): diskutil unmount /Volumes/Macintosh\ HD

  17. March 15th, 2011 at 17:32 | #17

    You know, I’m starting to wonder if running Spinrite in VirtualBox really does anything. From some suspicious warnings I’ve received in Spinrite, the lack of SMART access, and the lack of any errors at all found, I’m wondering if VirtualBox “raw disk access” really is just providing access to /dev/disk0 as a block device, but still intercepting all IDE-related commands.

    Who would know the answer to this? Maybe on the VirtualBox forums…I’m off to ask…

  18. June 22nd, 2011 at 13:59 | #18

    Was thinking about running spinrite on my MacBook’s harddrive just for some preventive maintenance.

    Couldn’t you just pull the drive and hook it up to a windows machine and run it there?

  19. June 22nd, 2011 at 14:16 | #19

    @Cash Yes, but it’s a pain and makes it infeasible to perform regular checkups. Still…the only solution is as you say: pull it.

  20. January 9th, 2012 at 13:48 | #20

    hi. some time ago i posted my aproach, how i ran spinrite on my internal mac drive using a windows 98 boot disk. i’ll share it here. hope it helps:

    Hi there. Maybe someone is interested in how to run Spinrite booting from a mac. I managed to boot it and scan my internal drive. It went flawless but there are some restrictions.
    the problem when trying to boot spinrite from a cd or usb drive is, that there is no keyboard access after starting the prog. there are two different reasons for that. at first you have to get hold of a boot image that provides you with ms-dos command line. i used win98 boot image and booted this from cd. there are loads of errors concernig ram drive stuff and himem.sys failing to load, but that’s unimportant. the best thing is to press shift+f5 on the boot menu, skipping the whole mess. you’ll notice that your keyboard layout is the standard u.s. – it’s really important not to execute the keyb command to switch to your countrys codepage, this is what kills the keyboard access in the first place. after establishing command line access make sure you attached a usb flash drive with the spinrite.exe on it before booting up. if done properly you can access the usb drive juct by typing “c:” you may ask, why not burn the spinrite executable right on the cd and access it from there. this has to do with the ability to write log files. log files are most important, because you won’t be able to run spinrite just like that. the program has it’s own routine to address your computers hardware. it overrides the bios. that’s the reason, why you still will not have acces to your macs keyboard after launching spinrite. the solution is to use spinrite’s command line switches and turn it into auto mode. this will make it work without any user input during the process. at first type “spinrite list” this will give you an overview of all the computers partitions. your mac drive and all its partitions are there. i found mine under “drive 0″ this is what you need to specify. for example, doing a scan on drive 0 using level 4 you have to type “spinrite auto drive 0 level 4″ very easy.
    attention!: after starting the process there is no way to stop until the task is finished, since you have no keyboard access within the program you cannot abort the process. the only way to get out of spinrite is to turn of your mac. which may result in data loss, if done during a scan operation. so be careful when selecting the drive and level. be sure you make the right selection, otherwise you have to wait until the program finished the task and start over again. well, this sounds complicated, but in fact it’s really easy and it saved me loads of trouble, since there is no need to remove the mac drive and attach it to a pc to scan it. it worked perfect. after the scan is completed restart and look for the spinrite.log on your usb device. there is all the information about found errors and stuff. have a nice day.

  21. Greg
    June 4th, 2012 at 20:12 | #21

    I just got a new AMD mother board and SpinRite sits there with the
    “working” at the bottom of the screen.

    Linux had problems with EFI firmware but in the 3.0 kernel they have a work around.

    Soon SprinRite will have to update to keep up with the current deployment of EFI firmware (BIOS).

    Mother board:
    ASUS E35M1-I
    Integrated AMD Dual-Core Processor E-350 with
    AMD Radeon™ HD 6310 Graphics

    http://usa.asus.com/Motherboards/AMD_CPU_on_Board/E35M1I/

  22. Reza
    July 30th, 2012 at 19:39 | #22

    I agree with you Greg for the high price i think there should be a proper solution available. I was considering to buy it for my mac in the first place so i will wait until there is a proper version (bootable USB for Mac’s)

  23. January 9th, 2013 at 19:27 | #23

    “Robert Harder

  24. February 8th, 2013 at 11:34 | #24

    Fine way of describing, and pleasant article to get facts regarding my presentation focus, which i am going to present in school.

  25. nunz
    March 11th, 2013 at 21:17 | #25

    hi robert

    did you ascertain whether running spinrite in virtual box actually does anything? About to try your method on a mac mini (easier than digging the disks out of the case) unless of course it doesn’t work!

    thnx for your helpful info.

  26. May 13th, 2013 at 08:34 | #26

    Having gone through Beta testing for well over a year,
    the game appears to have avoided most of the common problems that have
    plagued many MMO’s upon launch, such as overburdened servers, long wait times, unbalanced game play or technical glitches. Again, please check out the GVGINU website, link above. Find out if this developer is making the kinds of games you want to make.

  27. May 15th, 2013 at 15:50 | #27

    Although some people may not like it, video games are here to stay.

    Online, they are available through individual resellers and auction’s sites, both as single titles and in collections. * If you do not yet want to join the millions of other guys and girls working tedious 9 to 5 jobs, Monday to Friday then the lifestyle of a video game tester might be the answer.

  28. October 13th, 2014 at 02:09 | #28

    Nice replies in return of thi matter with solid arguments and describing thhe wole thing
    concerning that.

  29. October 14th, 2014 at 03:13 | #29

    The flower gardening is the hobby of growing flower gardens for decorative purposes.

    Special tools and techniques are needed for Bonzai gardening and
    those people who enjoy this type of gardening really enjoy the challenge
    of nursing these trees into the shape and style they want
    to create. Gardening on a regular basis is a highly-physical activity that is believed to tone your muscles,
    help you lose weight and also reduce your risk for certain health problems including heart disease
    and obesity.

  1. October 9th, 2014 at 04:37 | #1
  2. October 9th, 2014 at 05:19 | #2
  3. October 14th, 2014 at 03:57 | #3