-
-
Save gistbucket/b98e02101f61634cfeaf566a43cd03cc to your computer and use it in GitHub Desktop.
Vagrant environment that lets you copy a virtual disk image into a physical USB disk using qemu-img
This file contains hidden or 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
# this lets you easily convert a virtual disk image into a physical disk. | |
# | |
# # Usage for converting a vmdk on the host to an attached physical USB disk | |
# | |
# vagrant up | |
# vagrant ssh | |
# qemu-img info /vagrant/box-disk1.vmdk | |
# sudo qemu-img info /dev/sdb | |
# sudo qemu-img convert -p /vagrant/box-disk1.vmdk /dev/sdb | |
# | |
# NB you need to install the VirtualBox Extension Pack. | |
Vagrant.configure("2") do |config| | |
config.vm.box = "ubuntu-16.04-amd64" | |
config.vm.provider "virtualbox" do |vb| | |
vb.linked_clone = true | |
vb.memory = 1024 | |
vb.customize ["modifyvm", :id, "--usb", "on"] | |
#vb.customize ["modifyvm", :id, "--usbehci", "on"] # USB 2.0 | |
vb.customize ["modifyvm", :id, "--usbxhci", "on"] # USB 3.0 | |
# see https://www.virtualbox.org/manual/ch03.html#settings-usb | |
# list devices with VBoxManage list usbhost | |
vb.customize [ | |
"usbfilter", "add", "0", | |
"--target", :id, | |
"--name", "USB DISK", | |
"--manufacturer", "TODO", | |
"--product", "TODO"] | |
end | |
config.vm.provision "shell", inline: <<-SHELL | |
apt-get update | |
apt-get install -y qemu-utils | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment