How To: Run SpinRite on an Apple Silicon Mac (Part 2 of 2)

  • DNS Benchmark v2 Release 5 with Consultant License
    Guest:
    If you own any earlier release of our DNS Benchmark you may immediately download its release #5 replacement. Running an earlier release will detect the new release and help you upgrade.

    Although this release is cosmetic, appearance matters and affects ease of use. The biggest change, as seen in the image above, is that the DNS Benchmark now has a traditional Windows application menu to more fully expose its many features. This release is also "Consultant License Aware" and GRC will now issue a Consultant version when owners have previously purchased four "Personal Use" licenses. If you have previously purchased four DNSB licenses, or if you wish to upgrade your "Personal Use" license to Consultant, GRC's purchase process will direct you through that process.
    /Steve.
  • Be sure to checkout “Tips & Tricks”
    Dear Guest Visitor → Once you register and log-in please checkout the “Tips & Tricks” page for some very handy tips!

    /Steve.
  • BootAble – FreeDOS boot testing freeware

    To obtain direct, low-level access to a system's mass storage drives, SpinRite runs under a GRC-customized version of FreeDOS which has been modified to add compatibility with all file systems. In order to run SpinRite it must first be possible to boot FreeDOS.

    GRC's “BootAble” freeware allows anyone to easily create BIOS-bootable media in order to workout and confirm the details of getting a machine to boot FreeDOS through a BIOS. Once the means of doing that has been determined, the media created by SpinRite can be booted and run in the same way.

    The participants here, who have taken the time to share their knowledge and experience, their successes and some frustrations with booting their computers into FreeDOS, have created a valuable knowledgebase which will benefit everyone who follows.

    You may click on the image to the right to obtain your own copy of BootAble. Then use the knowledge and experience documented here to boot your computer(s) into FreeDOS. And please do not hesitate to ask questions – nowhere else can better answers be found.

    (You may permanently close this reminder with the 'X' in the upper right.)

Scott

Well-known member
Sep 18, 2020
215
52

This How To article is in two parts:​

  1. Part 1 - Introduction, creating external boot drive, installing QEMU and it's prerequisites
  2. Part 2 - Setting up your virtual boot drive, copying SpinRite to it, and running SpinRite via QEMU against your Mac drives (this article)

Part 2 of 2​

E. Setting up the QEMU Boot Drive​

  1. Create a folder to store your virtual disk images
    1. Open your Home folder
    2. Create a new folder called "QEMU" at this level (same level as Documents and Downloads folders)
  2. Download the base drive "srdos.qcow2" from my OneDrive, and move it to the QEMU folder
  3. Test that qemu is working:
    1. Open a Terminal window
    2. Change to the QEMU directory:
      • cd ~/QEMU
    3. Now you'll run qemu, attaching the base drive
      • sudo qemu-system-x86_64 -drive file=srdos.qcow2
    4. A window should open and settle at a DOS C:\> prompt
    5. There is a spinrite.exe file on the drive, but it's an old pre-release version that will not do anything
    6. Type shutdown at the C prompt and the DOS window should close
    7. Congratulations, you've got QEMU running!!!!

I bought my own copy of SpinRite, how do I get it on the C Drive?​

You'll download the .zip file from GRC with your copy of SpinRite on a drive .img file. Then you'll use QEMU to mount both the base C drive as well as the .img file (as drive D), then copy SpinRite onto the C drive.
  1. Go to GRC.com and download your personal copy of SpinRite
    1. Go through the Upgrade or Purchase process. You'll be presented with a web page with two links. You want to click on the link that leads to a .ZIP file, "For users without any access to Windows"
    2. Your Mac may automatically unzip the file, which contains one file called spinrite.img
    3. Move that file to the QEMU directory you created previously
    4. You now have two virtual drive files in that directory, one called srdos.qcow2 and one called spinrite.img
  2. Now you'll run a QEMU session to copy the spinrite executable
    1. From the Terminal window, cd ~/QEMU
    2. Type the following command (note the backslash as the line continuation character):
      1. sudo qemu-system-x86_64 \
        -M pc \
        -rtc base=localtime,clock=host \
        -hda srdos.qcow2 \
        -hdb spinrite.img \
        -boot c

      2. This will open a FreeDOS session booted from the srdos.qcow2 file as the C drive, with the spinrite.img file as the D drive
      3. At the C prompt, type:
        1. C:\>copy d:spinrite.exe c:\
      4. You'll be asked if you want to overwrite spinrite.exe on the C drive; Yes, you do
      5. You can start spinrite from the C prompt, it should show your licensed copy
      6. Now you can shutdown from the C prompt
      7. Next steps: determining the Unix drive names for the drives you want spirit to operate on, dismounting them from MacOS, and then starting QEMU

Determining Unix drive names​

  1. You’ll need the device names of the physical drives on the system
  2. Open a Terminal session
  3. Run the command:
    1. diskutil list
  4. This will show all the disks on the system; look for the devices noted as (internal, physical), AS WELL AS any "synthesized" drives which contain partitions from the internal disks
  5. Note the name(s) of the disk(s), AND the partitions which are under the main drive device for both physical and synthesized disks. You’ll unmount the partitions the drives to prevent concurrent access, then map the disk name(s) to virtual drive(s) using the QEMU command line.
  6. Run the command:
    1. df -h
  7. This will show you the mounted partitions, and you must unmount them.
    1. EXAMPLE:
      1. You have a physical disk0, and a synthesized disk1. The output of df -h shows that /dev/disk1s4 and /dev/disk1s1 are mounted. You would then run two unmount commands:
        1. diskutil unmount /dev/disk1s1
        2. diskutil unmount /dev/disk1s4
      2. You should then unmount the physical and synthesized disks
        1. diskutil unmountDisk /dev/disk1
        2. diskutil unmountDisk /dev/disk0
  8. Alternatively, for unmounting after you've determined the device names, you can use the Mac Disk Utility
    1. Open the Disk Utility
    2. Go to the View Menu, and select "All Devices"
    3. For any disk you intend to target, if it's in APFS format, click on the highest level container on the left, and click "Unmount" from the toolbar
    4. For example, on my system:
      1. My external boot drive was /dev/disk2, showing synthesized drive of /dev/disk3
      2. My internal drive, which will be the SpinRite target, was physically /dev/disk0 with synthesized drive of /dev/disk1
      3. I used Disk Utility to unmount the container from the physical disk, which unmounted the synthesized drives

Running QEMU
  1. Once you've determined your target drive(s), mount them in the order that you'd like the emulated PC to see them. Let's say I only want to have SpinRite look at my internal drive, /dev/disk0. I'd use the following command:
    1. sudo qemu-system-x86_64 \
      -M pc \
      -rtc base=localtime,clock=host \
      -drive file=srdos.qcow2,media=disk,cache=none,index=0 \
      -drive file=/dev/disk0,format=raw,media=disk,cache=none,index=1 \
      -boot c
  2. Explanation:
    1. -M pc: sets the device type to what QEMU currently considers its baseline PC, which has:
      1. PS/2 mouse and keyboard
        2 PCI IDE interfaces with hard disk and CD-ROM support
        Floppy disk
    2. -rtc sets the realtime clock within the emulated system to use the date and time from the host
    3. -drive file=srdos.qcow2,media=disk,cache=none,index=0 turns off write caching, and sets this drive as the 1st (index 0) on the IDE adapter. As this would be the C drive, you'll note the reference below to boot from the C drive
    4. -drive file=/dev/disk0,format=raw,media=disk,cache=none,index=1 mounts the target drive as the D drive
    5. -boot c says to boot from the C drive. Not really necessary
  3. After SpinRite runs, you can drop back to the C drive in the emulator and type shutdown
  4. If you wish to run this again on the same drive, you'll have to unmount the drive again using the command line or the Mac Disk Utility


And that's it!!

Big Caveat!!!​

I have barely tested this!! All seems to work but please, please, please backup your data, and potentially be ready to completely wipe the machine and reinstall MacOS from scratch
 
Last edited:
  • Like
Reactions: DocZZZ
I have used the following:

sudo qemu-system-x86_64 -M pc -rtc base=localtime,clock=host -hda SpinRite61.img -drive
file=/dev/disk16,format=raw,media=disk,cache=none,index=1


It runs faster than my Zimaboard.

I created the bootable image ( SpinRite61.img ) myself from my USB drive I use on my Zimaboard. The image can be mounted on the mac to view, remove, or move the log files.

Thanks for the post.
 
I have used the following:

sudo qemu-system-x86_64 -M pc -rtc base=localtime,clock=host -hda SpinRite61.img -drive
file=/dev/disk16,format=raw,media=disk,cache=none,index=1


It runs faster than my Zimaboard.

I created the bootable image ( SpinRite61.img ) myself from my USB drive I use on my Zimaboard. The image can be mounted on the mac to view, remove, or move the log files.

Thanks for the post.
Thank you for testing!! I have updated the instructions to include the real time clock flag, great catch.

Question -- was the /dev/disk16 disk the internal drive on your system, or an external (USB or Thunderbolt) drive?
 
I just found this thread and have Spinrite running on my 2020 MacBook Pro (M1 chip).

Bash:
sudo qemu-system-x86_64 -M pc -rtc base=localtime,clock=host -drive file=srdos.qcow2,media=disk,cache=none,index=0 -drive file=/dev/disk4,format=raw,media=disk,cache=none,index=1 -boot c

I didn't want to scan the Mac HD, but a USB drive I attached. Nice!
 
Thank you for testing!! I have updated the instructions to include the real time clock flag, great catch.

Question -- was the /dev/disk16 disk the internal drive on your system, or an external (USB or Thunderbolt) drive?
It is my USB drive i am testing
 
Scott, this looks awesome. As someone whose skills are a little rusty, it's a little intimidating, but the instructions are extremely clear.
I often use UTM on my Apple Silicon mac, often successfully, and always for its x86 emulation (UTM is basically a wrapper around QEMU, allowing some tasks to be done more easily). Is there anything fundamental about the steps described here that indicate that UTM on my Mac wouldn't work for using SpinRite on an external USB drive? My main concern is the need in these instructions for sudo, but there might be others.
Thanks for any insights.
 
My main concern is the need in these instructions for sudo, but there might be others.
Thanks for any insights.

It’s the need for sudo. As far as I can tell you can’t run UTM via sudo, which is why I outlined the command line process with QEMU.
 
  • Like
Reactions: jzsimon
Thank you for your clear instructions for installing Xcode command line tools, Homebrew package manager and QEMU. The process was simple for me, and I suppose for a person that knows their way around macOS, and with some experience with download and running programs from the terminal command line. The entire process was maybe 45 minutes until I had SpinRite running on my 2020 M1 Mac mini, and then, about 30 minutes to get it running on my 2024 M4 Mac mini. I had previously been successful with VirtualBox on my M1 Mac mini, but setting up QEMU following your guide was much easier, and seems to be better suited for Apple Silicon Macs. I highly recommend your process, and thanks again for the clear guidance.
 
Hi! Thanks for the instructions - they are very clear. I am trying to run this on a 2021 M1 MBP (Sequoia 15.6), and I can get QEMU running without difficulty using your instructions. However, when I boot to my external drive and try to run it with spinrite using your terminal commands, I am unable to unmount disk0 (my internal SSD). I keep getting the response
"Unmount was dissented by PID 100 (/usr/libexec/IOMFB_bics_daemon)
Dissenter parent PPID 1 (/sbin/launchd)"
I have tried multiple cold reboots from the external drive, but it still refuses to unmount disk0.

Any ideas as to what's causing this?

Thanks for all your help.
 
… I am unable to unmount disk0 (my internal SSD). I keep getting the response
"Unmount was dissented by PID 100 (/usr/libexec/IOMFB_bics_daemon)
Dissenter parent PPID 1 (/sbin/launchd)"
I have tried multiple cold reboots from the external drive, but it still refuses to unmount disk0.

Maybe try the unmount from the Disk Utility instead of the terminal command line
 
Maybe try the unmount from the Disk Utility instead of the terminal command line
Thanks. I tried that also. It doesn't cough up any errors, but doesn't unmount the disk (when I check using terminal). I am also trying to boot into 1TR using the external drive (holding power button), but it won't do that either (keeps going into the regular boot from the external drive). I figured that if I got into recovery mode from the external drive, then disk0 would not be mounted and I would able to use spinrite on it. I'm open to any other suggestions.
 
Thanks. I tried that also. It doesn't cough up any errors, but doesn't unmount the disk (when I check using terminal). I am also trying to boot into 1TR using the external drive (holding power button), but it won't do that either (keeps going into the regular boot from the external drive). I figured that if I got into recovery mode from the external drive, then disk0 would not be mounted and I would able to use spinrite on it. I'm open to any other suggestions.
Just double checking - when you went into Disk Utility, did you go to the View Menu and select "All Devices", then unmount the uppermost tier for the internal drive? Else it just unmounts the synthesized drive, not the actual physical drive
 
Just double checking - when you went into Disk Utility, did you go to the View Menu and select "All Devices", then unmount the uppermost tier for the internal drive? Else it just unmounts the synthesized drive, not the actual physical drive
Yup, did that. I can unmount the synthesized drive if I boot into the external drive, but spinrite still does not see disk0 or the synthesized drive (disk3 in my case).
 
Yup, did that. I can unmount the synthesized drive if I boot into the external drive, but spinrite still does not see disk0 or the synthesized drive (disk3 in my case).
I just ran this again following my own instructions. My external drive is running Macos Sequoia 15.6.1, and I made sure that brew and QEMU were up to date. I was able to unmount the partitions, followed by unmounting the synthesized and then the physical disks, and the unmounting was successful.

When I ran SpinRite with the command line specifying /dev/disk0, SpinRite showed the boot DOS drive (the qcow2 file) and also the physical drive. I started a Level 2 run, which ran successfully until I canceled it.

Difference between your system and mine? A ton! Mine is a 2012 MacBook Pro with an Intel CPU, and I'm running Open Core Legacy Patcher in order to run newer MacOS versions on my old system. Still, MacOS should be the same between the two architectures, and other folks have reported success.

I don't know why your system is not releasing your disk. All I can think to try is editing the fstab on the external drive to tell it not to mount your internal drive at startup. I found instructions here but I have NOT tested this at all.

 
I just ran this again following my own instructions. My external drive is running Macos Sequoia 15.6.1, and I made sure that brew and QEMU were up to date. I was able to unmount the partitions, followed by unmounting the synthesized and then the physical disks, and the unmounting was successful.

When I ran SpinRite with the command line specifying /dev/disk0, SpinRite showed the boot DOS drive (the qcow2 file) and also the physical drive. I started a Level 2 run, which ran successfully until I canceled it.

Difference between your system and mine? A ton! Mine is a 2012 MacBook Pro with an Intel CPU, and I'm running Open Core Legacy Patcher in order to run newer MacOS versions on my old system. Still, MacOS should be the same between the two architectures, and other folks have reported success.

I don't know why your system is not releasing your disk. All I can think to try is editing the fstab on the external drive to tell it not to mount your internal drive at startup. I found instructions here but I have NOT tested this at all.


I have the issue as @orthopodvt. I see launchd and the other daemon not letting go of a partition.

I have both an Intel and Apple Silicon MacBook Pro both running Tahoe. The Apple Silicon MacBook Pro drive is laid out different, like so:
Disk 0 - Physical
Disk 1 - Recovery on Disk 0
Disk 2 - Recovery on Disk 0, it is a duplicate of Disk1 (doesn't mount by default, only mounts if Disk 1 doesn't mount)
Disk 3 - Synthetic

To be clear Disk 0 through 3, are the internal drive inside the MacBook Pro.

I created an /etc/fstab file and that stopped Disk 1 from mounting, but then Disk 2 mounted instead with the same UUID as Disk 1 had.

I'm at a complete loss. It appears it is no longer possible to run SpinRite, because Tahoe on the external drive insists an internal drive recovery partition is mount.
 
Maybe making my external drive a Sequoia installation would work??

That is the oldest macOS I can run on my M4 Pro silicon.
 
It’s the need for sudo. As far as I can tell you can’t run UTM via sudo, which is why I outlined the command line process with QEMU.
I know I'm late to this party, but I've been attempting to use UTM to boot the SpinRite.iso, and it does get as far as the splash-screen -- but then it just hangs mid-way.

The reason I don't use the QEMU approach anymore (and, thank you, Scott, for doing all that pioneering work) is that I've ditched Homebrew because it was loading my machine up with packages of unknown provenance (how many different versions of Python do I need?). And given the propensity of the bad guys to try to poison libraries, I decided that a discrete package (like UTM) that I can better manage and monitor was a safer path (of course, YMMV). Without QEMU from Homebrew, I'm back to square one.

Any recommendations would be welcome.
 
I know I'm late to this party, but I've been attempting to use UTM to boot the SpinRite.iso, and it does get as far as the splash-screen -- but then it just hangs mid-way.

The reason I don't use the QEMU approach anymore (and, thank you, Scott, for doing all that pioneering work) is that I've ditched Homebrew because it was loading my machine up with packages of unknown provenance (how many different versions of Python do I need?). And given the propensity of the bad guys to try to poison libraries, I decided that a discrete package (like UTM) that I can better manage and monitor was a safer path (of course, YMMV). Without QEMU from Homebrew, I'm back to square one.

Any recommendations would be welcome.
I don't use Homebrew either. But you don't needed it on your internal boot drive just the external drive that Spinrite runs on.