garysimpson.dev
Mobile development with swift and flutter

How to SpinRite Internal SSD on Apple Silicon

September 15, 2024 at 3:30PM

After hearing it was possible to get SpinRite to run on AppleSilicon I set about trying to get it going. With the help of some online posts and grc's forums I was successful. Here are the details.

NOTE: This requires a bootable macOS external drive. I used a NVMe usb-c enclusure with macOS Sonoma (14.1). Setup was tricky for this I may write up what I used another time.


Steps

  1. Install VirtualBox
  1. VirtaulBox Setup FreeDOS
  1. Add VBoxManage to the FullDisk access list.
    • VBoxManage location...
  1. Unmount internal drive (found in DiskUtility -> Get Info):
    • diskutil unmountdisk /dev/disk4
      • force if error: Unmount was dissented by PID 407 ...
        • sudo kill -9 407
  1. Create Virtual (VMDK) for internal drive:
    • sudo VBoxManage internalcommands createrawvmdk -filename M2MacBookPro-Internal.vmdk -rawdisk /dev/disk4

  1. Open VBoxManage as admin.
    • sudo /Applications/VirtualBox.app/Contents/MacOS/VirtualBox
  1. Add Internal Disk to VM:
    • VM -> Settings -> '+'


Alternative to DiskUtility

CLOSE VERTIAL BOX BEFORE RUNNING BELOW COMMANDS use Activity Monitor if needed

  • Open Terminal
  • List Drives diskutil list
  • Identify which drive is internal. (e.g. dev/disk4)
  • Unmount Drive: diskutil unmountdisk /dev/disk4
  • Create VMDK:
    • sudo VBoxManage internalcommands createrawvmdk -filename M2MacBookPro-Internal.vmdk -rawdisk /dev/disk4
    • VBoxManage createmedium disk --filename M1MacintoshHD-internal.vmdk --format=VMDK --variant RawDisk --property RawDrive=/dev/sda
    • Reboot in Recovery Mode and disable SiP: `csrutil disable

Prologue

At this point I had an external NVMe drive with VirtualBox installed that ran SpinRite succesfully. I was able to reuse that drive on any AppleSilicon mac (Sonoma 14.1 compatible) using the following commands as needed.

  1. Create the VirtualDisk from Internal (vmdk):
    • Unmount internal drive:
      • diskutil unmountdisk /dev/disk4
      • force if error: Unmount was dissented by PID 407 ...
        • sudo kill -9 407
      • Create: sudo VBoxManage internalcommands createrawvmdk -filename M2MacBookPro-Internal.vmdk -rawdisk /dev/disk4
  1. Launch VirtualBox as admin.
    • sudo /Applications/VirtualBox.app/Contents/MacOS/VirtualBox

Happy Coding ;-)



Helpful Links: