- OpenVPN IPv6 and IPv4 configuration - Mon, Mar 1 2021
- 4sysops author and member competition 2020 - Fri, Jan 1 2021
- Assign an IPv6 address to an EC2 instance (dual stack) - Tue, Dec 15 2020
You’ll find plenty of articles on the Internet that explain how you can boot a VirtualBox VM from a USB drive. Most of these guides work fine, but you will only be able to boot an operating system that doesn’t require write access. You will learn how to create a virtual machine disk (VMDK) file and use it as a raw disk that VirtualBox maps to the USB drive. If you just want to boot an operating system such as Windows PE that only needs read access, this is the procedure you should follow. If you need to run a more sophisticated OS such as Windows To Go that requires write access on the boot drive, you will need the free Virtual Machine USB Boot tool that I will describe in the second method below.
For the sake of completeness, I describe both methods here.
Boot with read access only ^
- Launch Disk Management (Press the Windows Key + R and type diskmgmt.msc), locate your USB device and note its disk number.
- Launch a Command Prompt with administrator privileges (type cmd in the Start menu (Windows 7) or Start screen (Windows 8), right-click the Command Prompt icon, and select Run as administrator) and then type
"%programfiles%\Oracle\VirtualBox\VBoxManage" internalcommands createrawvmdk -filename C:\usb.vmdk -rawdisk \\.\PhysicalDrive#
Replace # with the disk number you noted in step 2. You can also store the VDMK file at another location.
- Launch VirtualBox with administrator privileges (right-click and select Run as administrator), create a new virtual machine and follow the wizard until you are asked to add a virtual hard drive. Select Use an existing virtual hard drive file and choose the VDMK file (C:\usb.vdmk in the example) you created in step 2.
You can now start your virtual machine. If your operating system requires write access, VirtualBox will throw this error message:
The I/O cache encountered an error while updating data in medium “ahci-0-0” (rc=VERR_ACCESS_DENIED).
Freeing disk space as the dialog box suggests, won’t solve your problem. You have to follow the procedure below instead.
Boot with write access ^
- Download Virtual Machine USB Boot, start the tool and click Add. (The portable version works fine. Notice that that the tool needs administrator rights. Maybe this eases your concerns.)
- In the Add dialog window, select your VirtualBox virtual machine under VM name and add your USB drive under Drive to add and boot.
- In the tool’s main window select your virtual machine and click Start.
When you follow this procedure, you will see some pop-up windows and I highly recommend to read the information provided there. If you run into trouble, it is probably because you didn’t read the recommendations.
Your VirtualBox VM should boot now from your USB drive. Notice that you always have to start this VM with the Virtual Machine USB Boot tool, that is, you can’t use VirtualBox Manager to boot this VM.