How To: Run SpinRite on a UEFI-only machine (Part 1 of 5)

  • SpinRite v6.1 Release #3
    Guest:
    The 3rd release of SpinRite v6.1 is published and may be obtained by all SpinRite v6.0 owners at the SpinRite v6.1 Pre-Release page. (SpinRite will shortly be officially updated to v6.1 so this page will be renamed.) The primary new feature, and the reason for this release, was the discovery of memory problems in some systems that were affecting SpinRite's operation. So SpinRite now incorporates a built-in test of the system's memory. For the full story, please see this page in the "Pre-Release Announcements & Feedback" forum.
    /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
63
22

Introduction​


As has been noted previously, the FreeDOS OS on which SpinRite runs can't boot on a PC with UEFI firmware that does not have a CSM (aka Legacy) mode. This includes newer Intel Macs, as well as most PCs from around 2019 and newer.

These machines CAN run SpinRite, though, but it takes some effort to make it work. Essentially, one must:
  1. Create a bootable, external USB drive from which a UEFI-compatible OS can boot
  2. Boot the target PC from that drive
  3. Install the virtualization software VirtualBox on that drive
  4. Create a FreeDOS Virtual Machine within VirtualBox in which to run SpinRite, and install SpinRite to that VM
  5. Ensure that the internal drives of the host machine are UNMOUNTED, so that the actual OS does not interfere with SpinRite operations
  6. Using VirtualBox commands, map the actual physical drives of the target PC to virtual drives in VirtualBox
  7. Mount those virtual drives in your virtual machine
  8. Run SpinRite, which should now see those drives as BIOS addressable drives within the FreeDOS Virtual Machine
These techniques have been around the Internet for a while, but never documented here on the GRC Forum. For example, here's an article from 2017:

There are currently 3 tested "Host OS" environments that can be setup within which one can run VirtualBox:
  1. Windows 11, specifically setup in a "Windows to Go" configuration
  2. Kubuntu 24.04 LTS, specifically setup in a "Live CD" configuration on a USB with Persistence
  3. MacOS, specifically setup on an external drive

Which of the 3 "Host OSes" should I use?​

The Windows 11 and Kubuntu setups can be used to boot any UEFI system, whether PC or Intel Mac, AND SECURE BOOT CAN STAY ON!! The MacOS setup can only be used to boot a Mac.

There hasn't been enough testing to know if either Windows or Kubuntu makes for a "better" VirtualBox host, so for now the advice is to use whichever environment you're more comfortable with.

If you have a Mac, you should be able to boot any of the 3, but you should probably use MacOS as your host OS. Some users have reported that internal drives on the Mac were not accessed correctly if using Win to Go or Linux host OSes.
(And I did say Intel Macs; there is no solution for Apple Silicon at the moment, and it's unlikely there will be)

What kind of drives can SpinRite in VirtualBox "see"?​

All of the physical drives are virtualized and accessed through the VirtualBox "BIOS", so it appears that any drive that the Host OS can see can be mapped to a .VMDK file and mounted in VirtualBox, and then addressed by SpinRite. So far I've attached the following physical drive types:
  • SATA attached hard drives and SSDs
  • M.2 form factor NVMe SSDs
  • M.2 form factor SATA SSD
  • USB-attached hard drives
  • eMMC SSD
USB drives must be physically attached (and the appropriate OS-specific unmount commands run) before creating the .VMDK files and attaching to the Virtual Machine. There is no need for the USB mapping capability within VirtualBox when using the standard VBoxManage createmedium disk drive mapping command.

Prerequisites​

There are certain items you need in order to make this work:
  • Prep PC
    • As this is written (April 2024), you need a PC running Windows 10 or Windows 11 for certain prep steps (specifically running Rufus to create the Kubuntu or Windows to Go drives). If you are using MacOS as your host OS, you can get by without a Prep PC.
  • Target PC (non Mac)
    • Must boot with UEFI firmware (or in UEFI mode if it can switch between UEFI and BIOS/Legacy mode)
      • But if you can boot in BIOS/Legacy mode, maybe run SpinRite natively
    • It must support Virtualization and have that feature turned ON in it's firmware settings:
  • Target PC (Mac)
    • Must be able to boot in UEFI mode (Intel Mac from about 2012 onwards)
  • At least two FAST USB drives. Must be fast due to the number of random read/write operations during USB creation and host OS operation
    • Capacity
      • For Linux setup, that should be at least 32 GB
      • For Windows or MacOS setup, that should be at least 64 GB
    • Speed - how do you know if a USB flash drive is fast enough?
      • Run the GRC utility ValiDrive on the USB drive. If it finishes in less than 10 seconds, that's fast enough.
  • And most importantly, these "items":
    • A SAFETY FIRST ATTITUDE!!
      • Before working on your target system, back it up!! Just like running SpinRite natively against a system, virtualized SpinRite will rewrite data, so backup your data, just in case!
      • If running against an encrypted drive (with BitLocker on Windows, or FileVault on MacOS), print out your recovery key and store it safely!!
        • And if possible, temporarily turn off the encryption before running SpinRite against the drive
    • KNOWLEDGE!! You must be comfortable with Administration commands in both the Host OS of choice, as well as DOS and the VirtualBox application. You should NOT blindly follow this guide; you need to understand what the commands are; there is an assumption that you know your way around a PC. If that's not you, DO NOT attempt this. YOU ARE DOING THIS AT YOUR OWN RISK, AS IT IS AN UNSUPPORTED METHOD TO RUN SPINRITE. WHILE THE INSTRUCTIONS SHOULD ENSURE THAT THE DRIVES ARE UNDER EXCLUSIVE SPINRITE CONTROL, THESE INSTRUCTIONS HAVE NOT BEEN EXTENSIVELY TESTED! DATA LOSS IS A POSSIBILITY!

Other notes:​

  • Booting from external drives seems to throw off the clock on many target systems. Before starting work, double check that the time zone and time are correct. When booting back to the native OS on the target device, you should do the same
  • The Windows and MacOS boot media seemed to shutdown cleanly; the Linux boot drive would often hang during shutdown, requiring a physical push of the Off button. This did not seem to corrupt the Linux boot drive in anyway (and if you've unmounted the internal drives they wouldn't be touched anyway).

Choose your own adventure!!​

Due to length limitations in the forum, I can't include all the instructions for all of the variations in one article. I will therefore write up the following articles from which you can choose your path. Each topic is also split into multiple parts as needed:
  1. Introduction (this article)
  2. Using Windows to Go as the base OS for your bootable VirtualBox system (split into multiple parts):
    • Part 2A - Setting up the Windows to Go drive
    • Part 2B - Installing VirtualBox, creating a SpinRite Virtual Machine, Mapping the Host drives to the SR Virtual Machine, Steps to take when moving your Windows to Go drive to a new Target Machine
    • Part 2C - Updating the Windows to Go drive to include Mac "BootCamp" drivers (optional, and obviously only for those planning to run the Windows to Go drive against a target Mac)
  3. Using Kubuntu Linux as the base OS for your bootable VirtualBox system
    • Part 3A - Setting up the Linux drive, Installing VirtualBox
    • Part 3B - Creating a SpinRite Virtual Machine, Mapping the Host drives to the SR Virtual Machine, Steps to take when moving your Linux drive to a new Target Machine
  4. Using MacOS as the base OS for your bootable VirtualBox system
    1. Part 4A - Setting up the MacOS drive, Installing VirtualBox, Running VirtualBox as "root"
    2. Part 4B - Creating a SpinRite Virtual Machine, Mapping the Host drives to the SR Virtual Machine, Steps to take when using your MacOS drive on a new Target Machine
  5. Downloading or Creating your VM and moving files in and out of the virtual drive
    1. Part 5A - Download a pre-built Virtual Machine instead of creating your own
    2. Part 5B - Creating your own Virtual Machine
    3. Part 5C - Copying files to and from the VM hard drive
 
Last edited:
Just a friendly reminder to anyone following this guide that Steve advised against running SpinRite 6.1 in virtual machines on Security Now #956 (pages 11-12 of the show notes).

SpinRite 6.1 really is NOT [a well-behaved “generic” DOS application]. It… briefly switch[es] the processor into protected mode, then directly alters its memory management segmentation registers to remove real mode’s traditional 64K segment limitations. […] So it’s very safe to say that SpinRite v6.1 and an emulated environment are not going to be seeing eye to eye.

With that in mind, I'm currently doing a Level 3 on my 4TB external HDD and so far so good. (Also, I followed a previous version of the guide and set up SR 6.1 on Kubuntu 22.04.)

---

Update: operation complete. Disk I/O feels noticeably snappier with no apparent side effects.

Screenshot_20240512_215230.png


More importantly, SpinRite was able to bypass the 2.2 TB BIOS limit.

Accessible BIOS drives will be limited to just the first 2.2 TB of capacity

With the added bonus of being able to save the VM state and resume at any time, running SpinRite 6.1r3 in VirtualBox could be more beneficial than on bare metal.
 
Last edited:
Just a friendly reminder to anyone following this guide that Steve advised against running SpinRite 6.1 in virtual machines on Security Now #956 (pages 11-12 of the show notes).
This is an unsupported method, but that’s an odd comment from Steve considering he did most of his initial development against a virtual machine in VirtualBox.
 
More importantly, SpinRite was able to bypass the 2.2 TB BIOS limit.

DanR said:
Accessible BIOS drives will be limited to just the first 2.2 TB of capacity

My complete quote:

Accessible BIOS drives will be limited to just the first 2.2 TB of capacity, with the exception of the rare BIOS that is able to access additional capacity
 
More importantly, SpinRite was able to bypass the 2.2 TB BIOS limit.

DanR said:
Accessible BIOS drives will be limited to just the first 2.2 TB of capacity

My complete quote:

Accessible BIOS drives will be limited to just the first 2.2 TB of capacity, with the exception of the rare BIOS that is able to access additional capacity
To the best of my knowledge, SpinRite has no problems with drives larger than 2.2 TB when run in VirtualBox. VirtualBox provides its own BIOS in software, which is apparently well written and presents drives in their full size to SpinRite. The VirtualBox "BIOS" relies on the drivers of the host OS (Windows, MacOS, or Linux) to talk to the drive, so the BIOS or firmware of the host machine is not brought into play. I've tested this on a 4 TB drive, which showed its size correctly during drive discovery and which SpinRite acted upon across its full capacity.
 
To the best of my knowledge, SpinRite has no problems with drives larger than 2.2 TB when run in VirtualBox. VirtualBox provides its own BIOS in software, which is apparently well written and presents drives in their full size to SpinRite. The VirtualBox "BIOS" relies on the drivers of the host OS (Windows, MacOS, or Linux) to talk to the drive, so the BIOS or firmware of the host machine is not brought into play. I've tested this on a 4 TB drive, which showed its size correctly during drive discovery and which SpinRite acted upon across its full capacity.
Good to know! Thanks, Scott. I have edited my post to reference your post just above.