Mounting Bootable External/USB (passthrough) In VirtualBox As Read/Write

This past week, one of my clients voicemail systems hard drive in a lovely way, received bad sectors. Of course the bad sectors were over the top of the voicemail database, and the system that runs it is on DOS 6.22.

My goal was to run some builtin repair functionality on the DOS OS that is running on the external drive. Alas, how can I get this done?

1. Install VirtualBox
2. Plug in the external drive to a PC.
3. Open up an elevated command prompt
4. enter DISKPART

c:\Windows\system32> DISKPART

5. enter LIST DISK
DISKPART> LIST DISK

6. find the disk your looking for
Disk 1, etc

7. open a new command prompt (leave diskpart right where it is)
c:\Windows\system32>mkdir c:\temp
(in the next line, substitute your disk # from step 5 on the externaldisk(n).vmdk file and the PhysicalDrive(n) path)
(this will create a small pointer file that points to disk(n) as a vmdx)
c:\Windows\system32> VBoxManage internalcommands createrawvmdk -filename C:\temp\externaldisk1.vmdk -rawdisk \\.\PhysicalDrive1

6. go back to your diskpart window, select the disk (in my case, disk 1)
DISKPART> SELECT DISK 1

7. offline the disk
DISKPART>OFFLINE DISK

8. clear the readonly attribute from the disk
DISKPART>ATTRIBUTES DISK CLEAR READONLY

9. verify the disk is now r/w
DISKPART> ATTRIBUTES DISK

10. exit diskpart
DISKPART> exit

11. create the VM in virtualbox, with whatever OS and all that jazz that you need, but as the hard drive, dont create one, use the one we created in c:\temp

12. boot and be happy that you have a fully functional passthrough r/w external disk acting on a VM

… I havent been in DOS 6.22 in a while. HIMEM.SYS here I come!

 

PS. If you want to get that disk back online on the HOST os, you need to get back into it with diskpart and select it, then do an ONLINE DISK command to bring it back online (inverting the OFFLINE DISK that we did earlier)