04 - How to boot directly from a USB drive using an Emulator or VM under Windows

unique hits statistics for vBulletin

You can make QEMU,  VMware Server  or    Oracle VirtualBox boot from the host USB drive. This is an easy way to test if your bootable USB drive is really bootable without having to reboot your Windows system and boot it from the USB drive instead. Note however that if it boots under a VM it does not guarantee that it will boot from every system for real!

Oracle VM Virtual Box can boot from a USB drive with full write access using DavidB's Virtual Machine USB Boot application (see below).

The QEMU available in RMPrepUSB is much slower and is 32-bit only but can be used for testing grub4dos menus and will be almost as successful as VBox (just a lot slower!).

RMPrepUSB v2.1.707 and later versions have two QEMU 'boot from USB drive' options:
  • F11 - boot from USB drive but now with full read/write access (but the host Windows OS will not be able to access the drive whilst QEMU is running).
  • Ctrl+Shift+F11 - boot from USB drive in 'snapshot' mode. This used to be the default action in previous older versions of RMPrepUSB (used to be F11). This mode is still useful if you want to be able to modify files on the USB drive whilst QEMU is running because the USB drive is not dismounted. This allows you to make simple changes (e.g. colour or menu position) and reload the menu whilst still running in the QEMu session and so this mode is still useful in some cases.
I strongly recommend using Oracle VBox with DavidB's Virtual Machine USB Boot utility for the best results.

Boot from a USB drive using Oracle VM VirtualBox

Enabling permanent writes (recommended!)

DavidB has provided a great utility which allows a USB drive to be run under Oracle VM VirtualBox and the writes to USB will work and be permanent.

See here for the discussion.

Here is what to do;

1. Download the latest version of the GUI utility from here and run the setup program to install it (or use the portable version). If the site is down, see bottom of this page for a download.

2. Run Oracle VBox Manager and make a new VM which leaves an empty space for the FIRST hard disk (this will be used by the USB drive). You can add more virtual hard disks (VHDs) or CD/DVD drives to the VM but you must leave the first hard disk 'slot' free. e.g. If using an IDE VHD, leave the Primary Master IDE hard disk slot free. If using a SATA VHD, leave SATA Port 0 free and attach the VHD to SATA Port 1.

3. Run the Virtual Machine USB Boot utility (Admin access required) and use the Add icon to add a new entry - use any name you like for each entry and then attach a USB drive to your system and add it in to the 'Drive to Add' section.

This is the utility set up for four different VMs

This is the Add/Edit form. Choose a suitable name, the VM you want and
                the USB drive you want to boot from.

4. To start the VM click on Start

In this way you can make the free Oracle VM VirtualBox boot from USB with writes just like a real drive.

Note that when you boot from the USB drive, the first HDD will be the USB drive and the 2nd HDD will be your virtual HDD (if you have set one up). So when booting to linux or Windows, the drive lettering may not be the same as when you boot from a real system (e.g. under linux, the USB drive will be sda when booting under the VM, but sdb when booting on a real system).

If you want to boot to a different USB drive, select the VM from the list and then click the Edit icon - then change the USB drive to any drive that is currently attached.

You can have the VBox Manager running at the same time or not.

Tips when using Oracle VBox

  • If you are booting XP type OS's, you may be more successful by disabling VT-x /AMD-V and PAE/NX. If using Vista and later OS's enable VT-x. Use DavidB's USB VM app for XP type ISOs - this seems more successful than using the Oracle VBox Manager because drive writes will work correctly when using Start_VM.exe.
  • If your CPU supports it, enabling VT-x /AMD-V and PAE/NX will result in much faster emulation. Also using 2 or more processors if available.
  • VT-x /AMD-V and PAE/NX support may need to be enabled on some BIOSes. 
  • If you find that you sometimes get errors when trying to run a VM with VT-x but previously you did not get errors - switch off your system (not reboot but actually power off). Then switch on again. Also try this if your VM seems to be running much slower than normal even with VT-x enabled.
  • Using just the VBox Manager is useful if you just want to test out menus because you can still write and update any file on the USB drive whilst the VM is still running - this is very useful for updating menu files, etc. as you don't need to shutdown the VM every time you need to edit a file.
    If you use DavidB's utility to run the VM, then the USB drive will be dismounted and you will not be able to access the USB drive or edit any files on the USB drive until you close the VM.
  • Status: 0xc0000225 Info: An unexpected error has occurred
  • or
    Windows failed to start

    This is because in Settings - System - "enable IO APIC" is checkbox is not selected for Win7 64-bit.

Problems installing XP or running BartPE from USB under Oracle VBox?

If Oracle reports an error just at the very start of XP text-mode setup then you can fix it by turning off VT-x/AMD-V in the Acceleration - System settings.
Once text-mode completes and the VM reboots, you can speed up the install by re-enabling VT-x for the GUI-mode setup phase.

I set up two VMs, one with VT on and one with VT off. I use VT-off for the first text-mode install of XP and booting BartPE, etc. and the use VT-ON for the 2nd GUI-mode install stage of XP and most others OS's.

Running VBox in 'read-only' USB mode

Note:  For best results when booting from a USB drive using a VM, I highly recommend using DavidB's application which allows Vbox full rd/wr access and is easy to set up and use - see enabling permanent writes in the section above.

These instructions will allow you to boot from the USB drive as read-only - therefore some things may not work if you boot a USB drive using this technique!

1. Download and extract the file MakeUSBvmdk.cmd and place it on your Desktop (or anywhere convenient)

2. Close VM VirtualBox now.

3. Right-click on the file and run as ADMINISTRATOR and enter in the USB drive number (as listed in RMPrepUSB) - the new vmdk file will be created for you and placed in the correct folder for Oracle VirtualBox to use.

4. Run VM Virtual Box as ADMINISTRATOR (right-click - Run as Administrator)

5. Set the Master IDE contents to the new USBPortX.vmdk file in Oracle Manager (see screenshot - click on the disk icon)

Click on the stacked-disk icon (to the right of IDE Primary Master) to select the new vmdk file.

The USB can now be booted from but any writes to the USB drive will not have any affect as the volume will be locked by Windows and thus writes will be prevented.

The USB drive must always be the same drive number - if you have two USB drives connected and your VM uses USBPort1.vmdk, then check with RMPrepUSB which USB drive is no 1 - you may need to remove and re-attach USB drives in a different order, to get the correct drive as the correct number.

Re-Running MakeUSBvmdk.cmd

If you buy a larger USB drive or re-make a new USBPortx.vmdk using a different drive, you will need to re-attach the new USBPortx.vmdk file (otherwise VirtualBox Manager will complain about the registry entry being wrong!)  as follows:

1. In File Virtual Media Manager - Remove the old USBPortx.vmdk file  (you may need to expand it and Release and Remove any children first)
2. Insert your largest USB device into a USB port and run RMPrepUSB to find out what device number it is
3. Repeat the steps above.

If you require instructions on how to add a vmdk to a new VM see here for a tutorial or watch the YouTube video below. 

Booting from USB using VirtualBox

Use Plop with VMWare Server

Note: This method uses Plop which uses a read-only USB driver.
VMware is faster than QEMU.
On your Windows system, test your bootable USB Flash Memory Drive (UFD) within Windows by booting it via a Virtual Machine using VMware Server as follows:

1. Download VMware server (or Oracle VirtualBox) and install it onto your Windows PC

2. Click on the Desktop shortcut which was created during the VMware Server installation (VMware Server Home Page icon): 

 You may get a security warning - if so just ignore it and click 'Continue to this website'.

Note: The Google Chrome Browser is not compatible and you will get this error - try Internet Explorer instead!

3. Enter your Windows logon credentials when prompted (i.e. same username and password that you normally use to log in to your Windows Desktop - e.g. myname + mypwd)

Use your Windows credentials to log in (obvious isn't it!)

3. Download PLOP Boot Manager ZIP file - e.g.  plpbt-5.0.10.zip

4. Extract the plpbt.iso file from the ZIP file and place it in your VMware Virtual Machine folder (in my case C:\Virtual Machines)

5. Now create a new virtual machine called USB BOOT (choose OS, Memory size, CPU numbers, size of new virtual disk, add a network adapter, add a DVD - Use an ISO image - browse to plpbt.iso, add floppy if required, add USB Controller, Finish). If you already have an virtual machine configured, select it and in the Summary tab click on the CD/DVD drive icon and choose Edit and then set Host Media and ISO image and Browse to the plpbt.iso file. The iso file must be present in the same folder as your virtual machine folder or you will not be able to select it in the VMware ISO browser applet.

Fig. 1 Ensure the plpbt.iso image is selected for the CD/DVD drive.

6. OPTIONAL: Now click on the Configure VM Command and highlight the Advanced tab - tick the Disable Acceleration radio button. If you do not do this, the PLOP manager may fail to boot and hang at the 'LOADING UHCI' or 'LOADING EHCI' progress text. 

Fig. 2 You may need to disable acceleration (try it first and then enable it when you have a USB drive booting successfully).

7. Now start the VM by clicking on the Console tab and the large Arrow that you see in the Window (Fig. 3) - if you do not see the USB icon  (as in the top smaller red ring in Fig. 1 above) appear shortly after clicking the large arrow  (and a Windows 'Ka-Plob' sound as the UFD is disconnected from the host Windows system), ensure you have a SINGLE USB drive inserted before you start the VM. You may need to run the VM twice before you see the USB icon. When the USB icon appears, wait for about 5-10 seconds before selecting it and you should see an empty tickbox for Kingston USB Mass Storage Device - tick the empty box and you should hear the Windows sound for a USB Device removal - see Fig. 4 below).

Fig. 3 Click the large arrow to start the VM session.

Fig. 4 Once you start the VM, wait a few seconds and select the USB icon and tick the box.
You should hear a re-asssuring 'USB device removed' sound from Windows when you do this. No sound - no worky!

Fig. 5 Check that you have a USB device here - if not then it won't work!

Fig. 6 Now click on the window to open a console and see what is happening.

8. Now click inside the window to window as directed to open the Virtual Machine in a new window (Fig. 7) and when the PLOP menu appears (Fig. 8), click inside the console window again and use the down cursor key to select USB from the PLOP menu and press [Enter] - the USB key should now start to boot!

Fig. 7 The VMware Remote Console should start.

Fig. 8 This is the PLOP boot manager screen - select USB using the cursor keys.

Fig. 9 Here is my grub4dos menu!

Steve Si,
13 Sep 2013 01:33