http://askubuntu.com/questions/556911/how-to-create-an-iso-image-from-vdi-file/#answer-816885
TEST THIS STUFF AND UPDATE THE ASKUBUNTU ANSWER IF NECESSARY. If the USB stick can be used with a second VM, add that to the answer.
Test this procedure using Damn Small Linux and make sure it works as expected. More thoughts about DSL on USB stick here.
If you want to use the USB stick with another VM later, you can do the following, and make sure that both /dev/disk1 and usbstick.vmd have permissions of 777 and are owned by (in my case) wware/staff.
VBoxManage internalcommands createrawvmdk -filename usbstick.vmdk -rawdisk /dev/disk1
Take this last bit with a grain of salt - my notes say that I didn't have much luck running the USB stick subsequently on a VM, and I concluded that I should do any additional work beyond that point on the NUC.
http://askubuntu.com/questions/693719/how-to-boot-from-a-usb-drive-in-virtualbox#answer-693729 Once the USB stick is prepared, it can be used to boot up a Virtualbox instance too. So you can use the USB stick anywhere you have a normal laptop running VBox.
That's not how you want to prep the USB stick. Do this instead, in the ~/VirtualboxVMs directory.
VBoxManage clonehd --format RAW Ubuntu/Ubuntu.vdi ubuntu.img
diskutil unmountDisk /dev/disk1
dd if=ubuntu.img of=/dev/disk1 bs=1m # this takes a LONG time
VBoxManage internalcommands createrawvmdk -filename usbstick.vmdk -rawdisk /dev/disk1
Make sure permissions on both /dev/disk1 and usbstick.vmdk are 777 and owner is wware/staff. Then you can start a Virtualbox VM using the VMDK to connect to the USB stick, and hopefully the stick also works with the Intel NUC.
So having now done this, here is my conclusion. Do the dd and just plug the silly USB stick into the hardware, don't try to put it back into VirtualBox. It's cool enough that you can start on VirtualBox and end up on physical hardware, you don't need more coolness than that.
Also, you want to make sure to get rid of any VBox client stuff left on the USB stick after the transfer, so do something like this, possibly multiple times:
sudo updatedb
locate -i vbox
locate -i vbox | xargs sudo rm -rf
It would be better never to install the VirtualBox guest additions in the first place. They're handy, but you'll want to blow them away afterwards. Better to do stuff with a shared folder.
If you decide you do want to bring the thing back into VirtualBox, you probably want something like this:
VBoxManage convertfromraw /dev/disk1 FoobarImage.vdi --format VDI
Well this is fun. I just wish there were a cheaper way to use the stick on the road. I'll keep thinking about that.
It may be that QEMU is the better way to do this. That's interesting, but I don't want to choose right now to be my giant QEMU Learning Curve.
- http://askubuntu.com/questions/638718/how-to-boot-from-a-live-usb-stick-in-a-virtual-machine
- https://makandracards.com/makandra/1192-using-qemu-to-quickly-test-an-iso-or-bootable-usb-drive
- http://unix.stackexchange.com/questions/37779/how-do-i-boot-from-a-liveusb-using-qemu-kvm
You can run QEMU on a Mac host.