Booting from USB

This is for discussing general topics about how to use VirtualBox.
Post Reply
punXter
Posts: 3
Joined: 24. Feb 2011, 15:34
Primary OS: FreeBSD
VBox Version: OSE other
Guest OSses: Windows

Booting from USB

Post by punXter »

Hello :) I use raw disk (usb drive) for my guest OS (FreeBSD). I finished guest installation and then I tried to boot from that USB on real machine. But for some reason it failed. What I should do to boot from that USB on real machine?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Booting from USB

Post by Sasquatch »

No idea, maybe it's the real machine that's the problem. I've had a laptop that said it could boot from USB, but when I hooked up my external hard drive to it, it would fail, as where it would just boot on my PC. This was without VB or anything, just a plain Linux installation on the drive directly. And yes, the MBR was on the external drive properly.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
punXter
Posts: 3
Joined: 24. Feb 2011, 15:34
Primary OS: FreeBSD
VBox Version: OSE other
Guest OSses: Windows

Re: Booting from USB

Post by punXter »

Thank you for your reply, Sasquatch. Well, USB boots ok. I think problem is in controllers (ide on raw vs scsi on usb) and disk geometry. So I tried to walk it around. I created new virtual machine and added scsi controller. Then I added virtual hard disk which is kinda same size as my usb sitck. Geometry was still wrong but looked similar to the real one. Then i copied hard disk's vdi image (fixed size image) to usb stick:

Code: Select all

dd if=HardDisk.vdi of=/dev/sdb skip=72
72 blocks are virtual box stuff. after that blocks begins disk image. And now I can boot :) woohoo :) now i need to fix file system (was too big for my usb) and it should work fine :) i'll post here when i'll get working version :)
punXter
Posts: 3
Joined: 24. Feb 2011, 15:34
Primary OS: FreeBSD
VBox Version: OSE other
Guest OSses: Windows

Re: Booting from USB

Post by punXter »

okay.. so. finally i got what i wanted :) usb stick which boots nicely both from real machine and virtual machine.

what i did: i created vdi with the right fixed size to fit usb stick (was moving bytes till i got the right size, trial and error and dd'ed it to usb... oh that was a pain. a pain of lack of brain), then i found boot sector and cut everything before it. dd to usb. tadam! works :)

so main points:
* scsi controller!
* right vdi size to fit usb
* find boot loader in vdi!

thank you virtualbox ^^ now i can hack my secret machine while working on a day job :))
Post Reply