This How To article is in multiple parts:
- Introduction
- Using Windows to Go as the base OS for your bootable VirtualBox system
- Using Kubuntu Linux as the base OS for your bootable VirtualBox system
- Using MacOS as the base OS for your bootable VirtualBox system
- Part 4A - Setting up the MacOS drive, Installing VirtualBox, Running VirtualBox as "root"
- 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 (this article)
- Downloading or Creating your VM and moving files in and out of the virtual drive
C. Setting up the base SpinRite Virtual Machine
- You could do either of the following:
- Using the pre-built Virtual Machine does not require access to a Windows PC but does entail some command line work
- Once you've completed one of those processes, come back here to configure access to the target system drives
D. Configuring access to target system drives
- Reference: https://docs.oracle.com/en/virtualization/virtualbox/7.0/user/AdvancedTopics.html#rawdisk
- You’ll need the device names of the physical drives on the system
- Open a Terminal session
- Run the command:
diskutil list
- 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 - 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 VBoxManage command.
- Run the command:
df -h
- This will show you the mounted partitions, and you must unmount them.
- EXAMPLE:
- You have a physical
disk0
, and a synthesizeddisk1
. The output ofdf -h
shows that /dev/disk1s4
and/dev/disk1s1
are mounted. You would then run twounmount
commands:diskutil unmount /dev/disk1s1
diskutil unmount /dev/disk1s4
- You should then unmount the physical and synthesized disks
diskutil unmountDisk /dev/disk1
diskutil unmountDisk /dev/disk0
- You have a physical
- EXAMPLE:
- Now you can proceed with creating the .VMDK file(s) to access the physical drives
cd ~/'VirtualBox VMs'
- Now, for each drive you’ll create a special .VMDK file that VirtualBox will use to access the real drive. For example, if the first drive you want to use, as noted from the
diskutil list
command, is/dev/disk0
: sudo VBoxManage createmedium disk --filename DISK0.vmdk --format=VMDK --variant RawDisk --property RawDrive=/dev/disk0
- Now, for each drive you’ll create a special .VMDK file that VirtualBox will use to access the real drive. For example, if the first drive you want to use, as noted from the
- For each drive on the system, you’ll want to give a unique filename, and obviously adjust the RawDrive parameter to refer to the correct Physical Drive
- When you’ve created the needed .vmdk file(s), stay at the command prompt
- Now start VirtualBox with the sudo command as noted above
sudo virtualbox
- Go to Settings, then Storage
- Decide whether to attach your virtual drives to either the IDE controller or the AHCI controller
- IDE Controller (listed as PIIX4 in the VM Settings)
- Pros:
- Faster operation (SpinRite native IDE driver works)
- Cons:
- Can only add up to 3 drives, as IDE only supports 4 total
- Logs will not be written until after the SpinRite session ends
- Pros:
- AHCI Controller
- Pros:
- Can have up to 30 drives (ports 0 to 29)
- Can log during operation
- Cons:
- Drives are seen as BIOS attached; SpinRite native AHCI doesn't work for some reason
- BIOS access may be an order of magnitude slower than IDE (or the same speed, you need to test and see!!)
- Pros:
- IDE Controller (listed as PIIX4 in the VM Settings)
- Attach the drives
- From the selected controller, add a Hard Disk
- The Medium Selector screen should be aware of the vmdk files you made, highlight one and select Choose
- Repeat as necessary to add all your vmdk files
- NOTE: The Host drive does NOT have be an actual AHCI connected SATA drive; access is just by block address
- NOTE: If you get an error attaching the .VMDK files, or an error on starting, make sure that the drives and partitions are still unmounted. Use the
diskutil
anddf -h
commands as noted above to be sure.
- NOTE: If you get an error attaching the .VMDK files, or an error on starting, make sure that the drives and partitions are still unmounted. Use the
- NOTE: The Host drive does NOT have be an actual AHCI connected SATA drive; access is just by block address
- Now start your Virtual Machine session
- At the C:\> prompt start spinrite
C:\>spinrite
- After the memory check, SpinRite should enumerate the boot virtual drive, as well as all of the VMDKs you’ve attached
- And that’s it!! Perform whatever SpinRite operations you want on the attached drive
How do I use this disk on another Mac?
- Make sure this other Mac is capable of running the MacOS version that you have on your external drive
- Check at: https://everymac.com/ or other reliable source
- For most Macs, starting with the Option key held down will bring up the Boot Picker screen and you can select the External Drive
- Start VirtualBox (again, from the terminal with sudo as noted above)
- Go into Settings for the Virtual Machine and REMOVE the prior VMDK files from the AHCI controller
- Exit VirtualBox
- You should now CLOSE and DELETE any prior VMDK files referring to drives from a different system.
- You’ll use the VboxManage closemedium command for this:
- From the Terminal window
- Change to the VirtualBox VMs directory
cd ~/'VirtualBox VMs'
- do an ls command to see the .VMDK files
ls
- Use VBox Manage to delete any prior VMDK files.
sudo VBoxManage closemedium DISK0.vmdk --delete
- Change to the VirtualBox VMs directory
- The vmdk files will be deleted, AND removed from VirtualBox’s registry of known drives
- You can now add the drives from the new system you are testing per the instructions above
Last edited: