Page 1 of 1
Booting from USB
Posted: 24. Feb 2011, 15:40
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?
Re: Booting from USB
Posted: 26. Feb 2011, 17:41
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.
Re: Booting from USB
Posted: 2. Mar 2011, 12:02
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

Re: Booting from USB
Posted: 3. Mar 2011, 17:37
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

)