This How To article is split into 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
- Part 3A - Setting up the Linux drive, Installing VirtualBox
- Part 3B - Creating a SR VM, Mapping the Host drives to the SR VM, Moving your Linux drive to a new Target Machine (this article)
- Using MacOS as the base OS for your bootable VirtualBox system
- 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:
lsblk
- This will show all the block devices (drives) on the system, and their mountpoints if mounted
- You may see a lot of
loopdevices; you can ignore those. - Try and pick out the actual drives by looking at the capacity and matching that to your knowledge of the target system
- You may see a lot of
- Note the name(s) of the drive(s) and partitions underneath them
- Drive names may be something like:
sdaornvme0n1 - Some internal drives and their partitions, MAY BE MOUNTED. You MUST UNMOUNT the drives and partitions in order to proceed safely!
- Note the name of the Partition you need to unmount
- Use the
umountcommand to unmount the partition - For example, if I have a drive
sdawith a mounted partition,sda1, enter:sudo umount /dev/sda1
- For another example, if I have a drive
nvme0n1with a mounted partition,nvme0n1p4, enter:sudo umount /dev/nvme0n1p4
- Run the command:
- From the terminal window
cd ~/'VirtualBox VMs'- For each drive you want accessible to SpinRite 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
lsblk, issdc, you’d reference it in the VBoxManage command as/dev/sdc:sudo VBoxManage createmedium disk --filename DISK0.vmdk --format=VMDK --variant RawDisk --property RawDrive=/dev/sdc
- If the next one was nvme0n1, the command would be:
sudo VBoxManage createmedium disk --filename DISK1.vmdk --format=VMDK --variant RawDisk --property RawDrive=/dev/nvme0n1
- For each drive on the system, you’ll want to give a unique filename, and adjust the RawDrive parameter to refer to the correct Physical Drive
- When you’ve created the needed .vmdk file(s), exit from the command prompt
- Now start 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
- NOTE: The Host drive does NOT have be an actual AHCI connected SATA drive; access is just by block address
- 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
- Now start your VirtualBox 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 drives
How do I use this disk on another PC?
- Boot up the new target PC with the Linux USB drive
- If the new PC is running with Secure Boot on, you must re-enroll the MOK key, then reboot:
- Open a Terminal window
sudo mokutil --import /var/lib/shim-signed/mok/MOK.der- The system will prompt you for the MOK password during the install
- It doesn't have to be the same as the last time you ran it, but it still needs to be at least 8 characters. You'll enter the password twice; REMEMBER IT!!
- Once the install is finished, exit the terminal
- Reboot – as before, on first boot you will be prompted to install the MOK keys, follow the same steps as before
- If the new PC is running with Secure Boot on, you must re-enroll the MOK key, then reboot:
- Start VirtualBox
- Go into Settings and REMOVE the prior VMDK files from the AHCI controller
- 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:
- Reference: https://docs.oracle.com/en/virtualization/virtualbox/7.0/user/vboxmanage.html#vboxmanage-closemedium
- Open an 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
- 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
Last edited:
