This How To article is in multiple parts:
This information is so that you can mount the virtual hard drive within the host system and perform read and write file operations (including copying your own copy of the SpinRite executable to the drive)
There are three main steps to work with files on the VM virtual C drive from within your host OS:
Note: Because this drive is a FAT16 drive, it does not have long file name support. If you create files with names that go beyond the DOS 8.3 file name convention, the names will be truncated when viewed in FreeDOS.
With VirtualBox NOT running:
- 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
- Downloading or Creating your VM and moving files in and out of the virtual drive
Copying files to and from the VM "C" drive
This information is so that you can mount the virtual hard drive within the host system and perform read and write file operations (including copying your own copy of the SpinRite executable to the drive)
There are three main steps to work with files on the VM virtual C drive from within your host OS:
- Convert the virtual C drive to a format that's readable by the Host OS
- Mount the virtual C drive from the host OS and perform your file manipulations
- Unmount the virtual C drive before starting VirtualBox
Converting the virtual C drive to a format that's readable by the Host OS
- If you already did this when creating or importing your Virtual Machine, you obviously do not need to do it again
- When you created or imported your virtual machine, the hard drive can be in one of a variety of formats that VirtualBox supports. For easy manipulation in the Host OS, it should be in one of two formats:
- .VHD file, if Windows is the Host OS
- .IMG file, if Linux or MacOS is the Host OS
- Reference: https://docs.oracle.com/en/virtualization/virtualbox/7.0/user/vboxmanage.html#vboxmanage-clonemedium
- The following instructions assume your Virtual Machine is in a directory called
SRDOS
underneath theVirtualBox VMs
directory - With VirtualBox NOT running:
- On the Windows base OS, you'd want to convert the file to a .VHD file:
- Open your terminal, and change directory to the
VirtualBox VMs\SRDOS
directory cd "C:\Users\Admin\VirtualBox VMs\SRDOS"
- do a
dir
and look at the files. If you see a .VDI, .VMDK, instead of a .VHD, you can convert it "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonemedium disk SRDOS-disk001.vmdk SRDOS.vhd --format VHD
- Note: .VDI, .VMDK and .VHD formats are all compressed, so they will only be between 1 and 3 MB for the 100 MB hard drive
- Open your terminal, and change directory to the
- On the MacOS or Linux base OS, you'd want to convert the file a .IMG file. Instructions for both MacOS and Linux are identical
- Open the console or terminal, and change to the
VirtualBox VMs
directory (not the SRDOS directory just yet) cd ~/'VirtualBox VMs'
- Change the permissions on the SRDOS directory
sudo chmod 777 SRDOS
- Change into the SRDOS directory
cd SRDOS
- do a
ls
and look at the files. If you see a .VDI, .VHD or .VMDK instead of a .IMG, you can convert it sudo VBoxManage clonemedium disk SRDOS-disk001.vmdk SRDOS.img --format RAW
- When that's done, you'll change the permissions so that you can mount the .IMG file from the standard user's account
sudo chmod 666 SRDOS.img
- Note: the --format RAW switch makes an UNCOMPRESSED disk image file, which will be about 100 MB
- Open the console or terminal, and change to the
- Now start VirtualBox the normal way for your platform (graphically for Windows and Linux,
sudo virtualbox
for MacOS- In the Settings for the SRDOS Virtual Machine, detach the original disk and attach the new .VHD or .IMG file to the IDE controller
- Start the VM; once you know it works, go into the Media Manager and delete the original hard drive file (.VDI or .VMDK)
- On the Windows base OS, you'd want to convert the file to a .VHD file:
Mounting and unmounting the drive in the Host OS
Note: Because this drive is a FAT16 drive, it does not have long file name support. If you create files with names that go beyond the DOS 8.3 file name convention, the names will be truncated when viewed in FreeDOS.
With VirtualBox NOT running:
- For Windows, use the Computer Management app
- Go to Windows Tools
- Select Computer Management; Right click on it, and Run as Administrator
- Open Disk Management
- On the Actions Tab, Attach VHD
- Browse to the file (C:\Users\Admin\VirtualBox VMs\SRDOS\SRDOS.VHD) and choose Okay
- You may then see the Disk mounted but Offline in the Disk Management app
- Right click on the Drive descriptor in the drive pane, and move the Drive Online; it may ask you what Drive Letter you'd like to assign
- Perform whatever file operations you want
- When you're done, Detach the VHD file in the Disk Management app
- If you Attach that VHD file again, it will normally be online and get the same drive letter as last time
- For MacOS:
- In the Finder top menu, select Go | Go to Folder; type a
~/
and navigate to the VirtualBox VMs folder; click and then select SRDOS folder - Right click (Ctrl-click) on the SRDOS.img file. Go to Open With, and select DiskImageMounter
- The Image file will now show up on the desktop looking like a Drive icon, possibly named NO NAME
- Open up the "drive" and perform whatever file operations you like
- Close the finder window, and drag the drive icon to the trash to "Eject" it just like a USB drive
- In the Finder top menu, select Go | Go to Folder; type a
- For Linux:
- Open the Discover application store app and install the Gnome Disks app
- Search for disks
- Find the Disks app, the "Disk management utility for Gnome"
- Click on it, and in the upper right of the Discover app, click Install
- Once it's installed, open it (just called Disks) from the Application Menu
- From the top "hamburger" menu (the 3 horizontal lines), select "Attach Disk Image"
- Work your way through the folder hierarchy from Home until you get into the VirtualBox VMs/SRDOS folder
- Click on the SRDOS.img file
- UNCHECK the box in the lower left that says "Set up read-only loop device"
- Click on Attach.
- Now open the Dolphin File Manager
- Now within the Dolphin File Manager, you'll see the device in the Devices section (on mine it says 99.9 MiB Internal Drive).
- Click on the drive to see the disk contents.
- Perform whatever file operations you want
- Close the Dolphin File Manager
- Now back to the Disks application
- You'll see the drive listed on the left; on mine it showed up as "105 MB Loop Device"
- Click on the drive
- On the top of the app, toward the right side, is the icon typically used for Eject. Click on it.
- The .IMG file is now unmounted, and when you start VirtualBox you should see the results of your changes on the C drive
- Open the Discover application store app and install the Gnome Disks app
Last edited: