Created
January 17, 2014 09:31
-
-
Save mapio/8470611 to your computer and use it in GitHub Desktop.
To boot Virtualbox from a USB pendrive you must first create a virtual disk to access to it and then add it as storage.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -r USB.vmdk ]; then | |
VBoxManage storageattach "BootFromUSB" --storagectl "SATA" --port 0 --device 0 --medium none | |
VBoxManage closemedium disk USB.vmdk --delete | |
fi | |
sudo chown $USER /dev/disk1* | |
VBoxManage internalcommands createrawvmdk -filename USB.vmdk -rawdisk /dev/disk1 -partitions 1,2 | |
VBoxManage storageattach "BootFromUSB" --storagectl "SATA" --port 0 --device 0 --type hdd --medium USB.vmdk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Of course, this assumes several things, such as, the name of the VM, the name of the device where the pen is mounted and the number of partitions that it is divided in… but should be quite easy to adapt it to different setups.