Jump to content











Photo
* * * * * 1 votes

Booting VirtualBox with USB workaround

usb virtualbox grub4dos plop

Best Answer steve6375 , 26 February 2013 - 12:18 PM

Is the Win7 64-bit or special in any way? Did you try an plain MS Win7 32-bit ISO extracted to a USB drive?

How about creating a virtual HDD, mounting the HDD, copying the USB stick to the virtual HDD, dismounting it, then boot from it via VBox?

Go to the full post


  • Please log in to reply
307 replies to this topic

#1 eblip

eblip
  • Members
  • 7 posts
  •  
    United States

Posted 26 February 2013 - 01:12 AM

To start off, I know that VirtualBox doesn't have built in USB boot support, but there are a number of workarounds.  Despite my best efforts all the workarounds I've found online have failed in some fashion or another. 

 

I'm attempting to use USB to install Windows 7 onto a VM.  I think the issue might be in the way this thumb drive was prepped.  It was made with RMPrepUSB and it works perfectly from a normal BIOS boot in physical machines.

 

If all my Windows installers on this USB were in ISO that would be no problem, but two of them required dumping the ISO contents onto the USB root since they didn't support emulation.  The Win 7 AIO installer I plan to use is one of these. 

 

Things tried:

 

VirtualBox raw disk emulation (The most recommended method from what I can tell).  I set my USB to be viewed as a raw disk using:

VBoxManage internalcommands createrawvmdk -filename "%USERPROFILE%"\.VirtualBox\usb.vmdk -rawdisk \\.\PhysicalDrive3

 

Using this I can load the USB and boot into Grub, select my Windows 7 installer.  The pre-installer loads fine, but during the "Starting Windows" portion my RAM usage spikes and crashes the VM.  I tried a few different things, including using Host I/O caching, but always the same RAM spike and VM crash.

 

Next I tried:

 

Plop boot.  I was optimistic but after trying it I realized loading a 4GB image and doing install at 1.0 speed would have taken hours if not days.  Just the in installer setup would have taken hours (Still looking for something similar that could provide 2.0 support).

 

Then I tried:

 

Making an ISO of the entire thumb drive following instructions here:

http://www.rmprepusb...makegrub4dosiso

 

I tried using both available tools mkisofs.exe & OSCDIMG.exe with the same results.  The ISO image is created and trying to boot will load grub, but grub can't find menu.lst.  I tried adjusting caps on menu.lst but it didn't seem to matter. 

 

Right now I'm thinking something like Plop boot with USB 2.0 support would be ideal, but I haven't had any luck finding one.  Honestly though, getting any of above methods to work would be fine by me, but I'm out of ideas.  I'm hoping someone will notice something silly I overlooked.  Any help at all would be great, even if they're extreme or inconvenience solutions.

 

 

 



#2 Blackcrack

Blackcrack

    Frequent Member

  • Advanced user
  • 458 posts
  •  
    Germany

Posted 26 February 2013 - 08:18 AM

i ask they people of VBox if they are not include the USB-Support as Boot possibility in the VM.

they told it's want be a interesting thing maybe in the future.. it is now a jear ago, maybe can ask they in the are too in the VBOX-Forum ?

 

best regards

Blacky



#3 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 26 February 2013 - 11:26 AM

Not quite clear what you are trying to achieve - USB flash boot using Win 7 ISO, USB HDD boot, DVD boot???

What method did you use to prepare the USB drive? If using Tut 43 (ISO from Flash drive) then it won't work on an emulator/VM as the drive appears as a fixed drive not a removable drive.



#4 Blackcrack

Blackcrack

    Frequent Member

  • Advanced user
  • 458 posts
  •  
    Germany

Posted 26 February 2013 - 11:41 AM

Steve you be offtopic, there it is speak about Virtualbox and Booting in USB

and I said that I had ask because of the already in Virtualbox forum.

 

and to the 2nd I have not to use your methods .. it's give others too.. why do you insist on it..

i dont like f... tutorials, i want a programm who do this what i want..

I do not like the song : "four corners you have to go"

if give one easy way..

 

 

 

and if you so mighty, why do you not create a programm who create via Virtualbox-programm on usb

a vhd, you programm can insert on the usb a grub4dos, use Virtualbox to install a Win7 and prepar 

the vhd for the next boot via grub4dos . For have a easy program for create a virtualbox+vhd+grub4dos+usb


Edited by Blackcrack, 26 February 2013 - 11:50 AM.


#5 eblip

eblip
  • Members
  • 7 posts
  •  
    United States

Posted 26 February 2013 - 11:43 AM

Not quite clear what you are trying to achieve - USB flash boot using Win 7 ISO, USB HDD boot, DVD boot???

What method did you use to prepare the USB drive? If using Tut 43 (ISO from Flash drive) then it won't work on an emulator/VM as the drive appears as a fixed drive not a removable drive.

 

I have a USB drive, prepped with RMprepUSB using Grub4Dos, that has several windows/linux installers on it, all of which will boot fine on a physical machine.  Some of the installers are intact ISO's, but two of installers are unpacked ISOs placed right on the root of the USB.  Presently, the only Win 7 installer I have is on this USB drive, but VirtualBox won't boot from USB and the installer I need is not an intact ISO.  I'm trying to find anyway that I can get Win 7 installed on VirtualBox. 



#6 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 26 February 2013 - 11:45 AM

Why not map the ISO file as a CD in VB and boot from it?

Why can't you boot from a USb drive from VBox? Just set the port as a device see http://www.rmprepusb...r-vmware-server



#7 eblip

eblip
  • Members
  • 7 posts
  •  
    United States

Posted 26 February 2013 - 11:47 AM

i ask they people of VBox if they are not include the USB-Support as Boot possibility in the VM.

they told it's want be a interesting thing maybe in the future.. it is now a jear ago, maybe can ask they in the are too in the VBOX-Forum ?

 

best regards

Blacky


They're probably nice people and all, but any time I found anyone mentioning booting USB on VirtualBox, the questioners were not treated very kindly.  (I have a feeling it's a sensative subject).  The questioners were more or less told "VirtualBox does not support USB booting" and it doesn't seem they want to promote people using such workarounds as I've outlined above.  That is just my guess though.



#8 eblip

eblip
  • Members
  • 7 posts
  •  
    United States

Posted 26 February 2013 - 11:51 AM

Why not map the ISO file as a CD in VB and boot from it?

 

I tried, both using a Windows host and an Ubuntu host.  In Windows, VirtualBox will boot the USB, menu.lst will come up, I can select my Windows 7 entry and everything seems to be fine.  The pre-install loads fine (The long white bar at the bottom).  It's when I get to the "Starting Windows" screen that my host RAM spikes about 1GB per second and in 8 seconds VirtualBox crashes with an error about VERR_ACCESS_DENIED.  This happens no matter how much RAM I give to the guest system. 

 

In Ubuntu, Virtualbox won't even find the MBR, menu.lst never comes up.



#9 Blackcrack

Blackcrack

    Frequent Member

  • Advanced user
  • 458 posts
  •  
    Germany

Posted 26 February 2013 - 12:08 PM

imho, should be it possible to boot on usb, but i think they don't want it..

like i know, all it is possible in code today, but if they not like to do.. :\

it want be the best possibility to have a running system on USB2/3 maybe

crypted for a possibility to quick disconnect / take away .. or for using a qemu-usb-boot-programm

who i have anywhere see here.. for have a Virtual environment for let start the usb-stick over the desktop (edit: MobaLiveUSB_0.2.exe  )..

that's all if can create a normal installed Winnt System on usb like i can do with Openmandriva before 5 jears..

 

With all Linux can does, but not with the WinNT and this it is fucked me on..

and why the hack it is not /never create this prossible for WinXP or 7 !

a Normal install on usbstick..

 

Not install via vhd or something bullshit.. nope.. real install on usb-stick. (and dont come now with a f*** tuturial!!)

 

best regards

Blacky


Edited by Blackcrack, 26 February 2013 - 12:58 PM.


#10 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 26 February 2013 - 12:18 PM   Best Answer

Is the Win7 64-bit or special in any way? Did you try an plain MS Win7 32-bit ISO extracted to a USB drive?

How about creating a virtual HDD, mounting the HDD, copying the USB stick to the virtual HDD, dismounting it, then boot from it via VBox?


  • Brito and eblip like this

#11 Blackcrack

Blackcrack

    Frequent Member

  • Advanced user
  • 458 posts
  •  
    Germany

Posted 26 February 2013 - 01:00 PM

steve, try to use Virtualbox, make a new virtualmashin.. create a new virtualdisk, there be possibility to create 4 or more diffrent virtualharddisk .. one of them be vhd.. this can you start with vbox and make a install..

the rest it's self explain ..

you can use/let work the virtualharddisk-creator for you ..

 

 

ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\blackcrack\AppData\Roaming
CommonProgramFiles=C:\Program Files (x86)\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=BLACKYSGATE2
ComSpec=C:\Windows\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Users\blackcrack
LOCALAPPDATA=C:\Users\blackcrack\AppData\Local
LOGONSERVER=\\BLACKYSGATE2
NUMBER_OF_PROCESSORS=4
OS=Windows_NT
Path=C:\Program Files (x86)\PC Connectivity Solution\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\
system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\blackcrack\AppData\Loc
al\Bandizip\7z;C:\Program Files (x86)\Common Files\Isshou
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_ARCHITEW6432=AMD64
PROCESSOR_IDENTIFIER=AMD64 Family 21 Model 1 Stepping 2, AuthenticAMD
PROCESSOR_LEVEL=21
PROCESSOR_REVISION=0102
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files (x86)
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\BLACKC~1\AppData\Local\Temp
TMP=C:\Users\BLACKC~1\AppData\Local\Temp
USERDOMAIN=blackysgate2
USERNAME=blackcrack
USERPROFILE=C:\Users\blackcrack
VBOX_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\
windir=C:\Windows
windows_tracing_flags=3
__COMPAT_LAYER=ElevateCreateProcess
C:\>

 

 

VBOX_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\

 

by installed Virtualbox can you use

the variable VBOX_INSTALL_PATH for vboxtools via cmdline

 

and the W7 32 bit should run anywere .. and maybe can you try to use WinVBlock_Install.zip on WinXP to have a driver on Winxp for virtualharddisk..


Edited by Blackcrack, 26 February 2013 - 01:07 PM.


#12 eblip

eblip
  • Members
  • 7 posts
  •  
    United States

Posted 27 February 2013 - 03:01 AM

Is the Win7 64-bit or special in any way? Did you try an plain MS Win7 32-bit ISO extracted to a USB drive?

How about creating a virtual HDD, mounting the HDD, copying the USB stick to the virtual HDD, dismounting it, then boot from it via VBox?

 

I tried this after I got off work today and it worked!  Only hiccup I encountered was the that the installed OS ended up putting the MBR on the VHD as well as setting it to active.  At first I couldn't get the installed OS to boot without the VHD being attached but once I swapped the active disk in diskmgmt then ran a startup repair from ERD the freshly installed OS was able to boot. 

 

A laborious process having to wait for the 20GB VHD creation, then a 20GB transfer, OS install, then the MBR troubleshooting but in the end it accomplished what I needed.  I want to thank you; I never would have thought to gone the virtual HDD route and it was easier than I expected. 


  • Brito likes this

#13 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 03 June 2013 - 04:36 AM

Hi.

I use VirtualBox a lot to test the Grub4Dos scripts.

 

I have Windows XP SP3 x86 and I start VirtualBox with administrative rights.


This method worked for me (found it on another site some time ago and then here): "VBoxManage internalcommands createrawvmdk -filename "%USERPROFILE%"\.VirtualBox\usb.vmdk -rawdisk \\.\PhysicalDrive1"
I even can run Linux from the USB drive...

However there is another problem: any changes made to the USB drive in the virtual machine are not visible in the host OS.
For example when Grub4dos is writing in "default" file, I can't see the new number for the menu entry in that file.
I tried setting usb.vmdk to writethrough, no change.
I tried plop boot iso, it hangs.
Before starting the virtual machine I use a tool called sync.exe to force flushing the Windows RAM buffer to USB drive. tried using it also after the virtual machine is closed, no effect.

2 workarounds:
1. I remove and reattach the USB drive. Not good when you test a lot because the USB port will be (physically) damaged very fast.
2. I use "chkdsk boot_partition_letter_on_USB_drive: /x". But the problem is that it's very slow.

Is there a better workaround...?

Thank you.



#14 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 03 June 2013 - 01:55 PM

Well, I found a solution: using mountvol command to dismount USB drive's volume(s) before starting the VM and to mount them again after closing the VM.
All can be done in a batch file so it will be very easy to use...



#15 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 03 June 2013 - 03:29 PM

How do you get writes to work at all in VirtualBox?

 

If I use  echo sdsd > /fred.txt

 

cat /fred.txt

 

in VirtualBox, it just lists the original contents?

 

P.S. Just found that if I change the vmdk type to 'Multi-attach' then writes do work!



#16 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 04 June 2013 - 07:51 AM

How do you get writes to work at all in VirtualBox?

 

If I use  echo sdsd > /fred.txt

 

cat /fred.txt

 

in VirtualBox, it just lists the original contents?

 

 

No, it will always list sdsd, which is normal (because the "read" command is inside the VM and it will access all the writes made by the VM).

 

P.S. Just found that if I change the vmdk type to 'Multi-attach' then writes do work!

 

Multi-attach is strange, it's creating a snapshot for the USB drive on my computer. Which is not good, because it will contain all the changes made in VM instead of writing them to the USB drive. That snapshot is for the other VM's (that's why it's "multi").

Anyway I tested and on my computer the real OS still doesn't see any change made in VM...

 

Currently I'm working on a Delphi program that will be better than using mountvol...

It's already working when you provide the volume letters(s) for the USB drive but my gold is to "translate" HardDisk1 to volume letter(s). Maybe even to read directly from usb.vmdk and "translate" HardDisk[n] to volume letter(s). This way it will be very "flexible"...

 

Ok, back to work...



#17 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 June 2013 - 08:09 AM

Well, just for the record, using a \\.\PhysicalDrive is NOT *exactly* like "using a USB device", see:

http://reboot.pro/to...-drive-in-qemu/

 

@DavidB

Maybe useful, maybe not :unsure::

http://reboot.pro/to...st-and-ddlistw/

 

In the tradition of boot-land reboot.pro the posted code has been botched, just in case I am attaching here a .zip.

 

:cheers:

Wonko

Attached Files



#18 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 04 June 2013 - 08:00 PM

Well, just for the record, using a \\.\PhysicalDrive is NOT *exactly* like "using a USB device", see:

http://reboot.pro/to...-drive-in-qemu/

 

I agree, but for some tests is good. Especially for testing grub4dos scripts - VirtualBox helped me to save a lot of time...

 

@DavidB

Maybe useful, maybe not :unsure::

http://reboot.pro/to...st-and-ddlistw/

 

In the tradition of boot-land reboot.pro the posted code has been botched, just in case I am attaching here a .zip.

 

:cheers:

Wonko

 

Thank you.



#19 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 04 June 2013 - 08:25 PM

Well, here is the program...
What it does: it triggers system data flush on the USB drive, it waits some time, it dismounts the mounted volumes, starts VirtualBox and it mount them back after it closes.
It can be configured in settings.ini file:
 

VM_UUID=5056175c-6ee4-41ab-91c6-0b4150b18045
USB_drive_number=1
Wait_time_to_flush_system_data=500

VM_UUID is the UUID of the virtual machine used to "boot" from USB. You can find it by making a shortcut of the VM (not VB) on the desktop and looking at its properties ("Target" field).
USB_drive_number is the disk number that you used in usb.vmdk (found in Disk Management). It can be set from 1 to 9. The default value is 1.
Wait_time_to_flush_system_data is the amount of time (ms) the program will wait after triggering the flush and before dismounting the volume. It can be set from 1 to 10 000. The default value is 500.

VirtualBox has to be installed, if it's the portable version it will not know where it's located...

It's only the first version, so it can be improved...
I tested it on my computer and it works fine but I can't be sure that it will work on any computer.

 

Later edit: attached files removed, you can find a better version on the next page of the thread...



#20 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 June 2013 - 09:06 PM

Is the UUID the same as shown in VM Manager? If not how do I create a shortcut (Oracle VM VirtualBox)?

OK - didn't spot the Machine - Create shortcut on Desktop entry!

Should the disk type be normal?



#21 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 04 June 2013 - 09:20 PM

It's not the UUID of the usb.vmdk.

In VirtualBox's interface right click on the name of the VM and choose "Create shortcut to desktop".

And, yes, it should be normal.



#22 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 June 2013 - 09:37 PM

OK - just figured it out - I didn't see the 'create shortcut' menu option!

 

Anyway - I tested in on my 7 64-bit laptop and it worked great! Writes take affect within the VM and I can see the changed files after the VM closes :clap: 



#23 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 June 2013 - 09:45 PM

Would be great if I could pick a VM if I have more than one USB drive connected (multiple entries in settings.ini, maybe add a Name entry for each Section too)? :dubbio: 



#24 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 04 June 2013 - 09:50 PM

OK - just figured it out - I didn't see the 'create shortcut' menu option!

 

Anyway - I tested in on my 7 64-bit laptop and it worked great! Writes take affect within the VM and I can see the changed files after the VM closes :clap: 

 

:) I'm glad you like my program...

 

Would be great if I could pick a VM if I have more than one USB drive connected (multiple entries in settings.ini, maybe add a Name entry for each Section too)? :dubbio: 

 

Sure, why not...

 

LE: until I will modify the program, for now you can copy the exe and the ini in other folder(s) and use them for other VMs.



#25 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 June 2013 - 10:13 PM

Is there a way to do a similar thing with QEMU? It would be great to add this into my RMPrepUSB - QEMU option??






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users