Boot from bootable USB drive in VB?

Discussions related to using VirtualBox on Windows hosts.
DavidB3
Posts: 2
Joined: 3. Jun 2013, 07:44
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Linux Fedora 18

Re: Boot from bootable USB drive in VB?

Post by DavidB3 »

Hi.

I use VirtualBox a lot.

I have Windows XP SP3 x86 as host OS 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.
I tried plop boot iso, it hangs.
I tried also to change usb.vmdk to writethrough, no change.
Before starting the virtual machine I use a tool called sync.exe to force flushing the Windows RAM buffer to USB drive. I 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 start and close the VM many times because the USB port will be (physically) damaged very fast.
2. I use "chkdsk partition_letter_on_USB_drive: /x" for every partition on USB drive. But the problem is that it's very slow.

Is there a better workaround...? Preferably a setting or at least a command/tool that can be started in a batch after the VM is closed...

Thank you.

Regards, DavidB
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Boot from bootable USB drive in VB?

Post by mpack »

DavidB3 wrote:However there is another problem: any changes made to the USB drive in the virtual machine are not visible in the host OS.
Well of course not. A disk drive can only be owned by one PC at a time. You shouldn't be accessing the drive in raw mode from a VM while it's still mounted in the host. To do so invites corruption of the drive - this is precisely the reason why raw disk access is described as dangerous and "expert only" in the manual. As to why the host does not see VM updates to the drive - the reason for that should be obvious to anyone qualified to use the feature.
DavidB3
Posts: 2
Joined: 3. Jun 2013, 07:44
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Linux Fedora 18

Re: Boot from bootable USB drive in VB?

Post by DavidB3 »

mpack wrote:
DavidB3 wrote:However there is another problem: any changes made to the USB drive in the virtual machine are not visible in the host OS.
Well of course not. A disk drive can only be owned by one PC at a time. You shouldn't be accessing the drive in raw mode from a VM while it's still mounted in the host. To do so invites corruption of the drive - this is precisely the reason why raw disk access is described as dangerous and "expert only" in the manual. As to why the host does not see VM updates to the drive - the reason for that should be obvious to anyone qualified to use the feature.
I know all these, even if you indirectly called me "unqualified", but since you guys (for a long, long time) refused to implement USB Boot you left me no other good choice. On other forums/blogs/sites they said I shouldn't ask here about this because it's a "touchy" subject for you.
They were right. I try to talk nice to you, you don't offer a solution, but suggest that the user is "unqualified". And when people like me protest you use half truths like "if you don't like it go pay for a program like VMWare" and so on...
You may had once (a long time ago) the desire to help others but it somehow dyed on the "way"... That's very sad...
BTW, I use this raw access for months in VirtualBox but I was very careful so I NEVER had data corruption.
I will search for a solution WITHOUT you.
But I will still report errors and test Beta versions so I can help the development of VirtualBox, even if you guys don't deserve it. But I will not be doing it for you...

Don't bother to reply but, if you do, you'll write for others not for me, because I won't be here to read it.
Just ban my account and don't care. I'm sure you've already used to it by now.
Good readens to me.

Still, I wish you a long and happy life....
Martin
Volunteer
Posts: 2561
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Boot from bootable USB drive in VB?

Post by Martin »

- You should have mentioned/known that you need to unmount the raw device from the host before attaching it to the guest.
- If you do it that way correctly you wouldn't have a problem with the host not seeing the changes done by the guest.

Also this "solution" has nothing to do with USB boot because from the guest point of view it is just a direct attached disk accessed throut SATA or IDE.
You can use it to get some system booted but it doesn't help to try/test/debug a USB boot process.
ArmandH
Posts: 1
Joined: 26. Oct 2013, 13:59

Re: Boot from bootable USB drive in VB?

Post by ArmandH »

Trick is combination of adding the usb stick in VM and using the plop live cd to boot from
Can't seem to add urls yet as its my first post :-(

Check in youtube watch + this behind it v=aSS1bOF7sDA

How to Boot from USB in VirtualBox
indecline
Posts: 3
Joined: 5. Jan 2014, 17:25

Re: Boot from bootable USB drive in VB?

Post by indecline »

1. Open cmd.exe with the admin rights
2. Type

Code: Select all

C:

Code: Select all

cd "%PROGRAMFILES%\..\Program Files\Oracle\VirtualBox\"

Code: Select all

VBoxManage internalcommands createrawvmdk -filename "%USERPROFILE%\USB-HDD-connector.vmdk" -rawdisk \\.\PhysicalDrive1
ps: PhysicalDriveX is your usb key ( you can see the right number in Computer manage > Disk management )
3 Load a new created usb disk in your C://Users/PROFILE/USB-HDD-connector.vmdk as PRIMARY IDE
4 In order to boot from usb in windows you need to remove a assigned letter in windows . Disk management - Have phun!
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Boot from bootable USB drive in VB?

Post by mpack »

I take it you didn't actually read the thread above. Using rawdisk is not the same as booting from USB, just as booting your VDI hosted on a SATA drive doesn't mean the guest sees it as SATA. Intentions are everything. If your goal is to test USB booting, you can't do that in VirtualBox.
indecline
Posts: 3
Joined: 5. Jan 2014, 17:25

Re: Boot from bootable USB drive in VB?

Post by indecline »

yeah but it works , im here because i was looking for this solution and its the first link on google and i think this will help a lot of people. I was referring to a subject "Boot from bootable USB drive in VB? "
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Boot from bootable USB drive in VB?

Post by mpack »

It doesn't work. What you have got working is something entirely different.
indecline
Posts: 3
Joined: 5. Jan 2014, 17:25

Re: Boot from bootable USB drive in VB?

Post by indecline »

what do you mean ?
I have setup a bootable usb drive with persistent Ubuntu 7.10 install on it. I would like to be able to boot from this in VB.
If there is no way to load a usb, this method helped me. Its just a tweak, but it worked , because otherwise its possible, i get managed to boot all my bootable keys with this method through vb.

I dont understand why the method is bad ? Because on every computer you need to create a virtual disk again and again ? Can you explain ?
Locked