Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save richardsonlima/dcee7db664b48daf3f35dcebe4b49e2c to your computer and use it in GitHub Desktop.
Save richardsonlima/dcee7db664b48daf3f35dcebe4b49e2c to your computer and use it in GitHub Desktop.
HOW TO CONVERT A VIRTULBOX VM TO A BOOTABLE DRIVE
JUL 5, 2017
This is quite easy so I was surprised that I couldn’t find a walk-through anywhere…so here’s one :) This is specifically for a VM of Ubuntu, so it’s possible there may be other hurdles in place for different operating systems.
STEP 1
Create a VM normally in VirtualBox (or use an existing one), install the operating system, and add any programs or files you want to have readily available on the bootable disk.
STEP 2
This is the tricky part, you can use Virtual Box to convert a vdi to an iso, but you have to do it from the terminal. On my machine it wouldn’t work at all in windows default terminal, but I have Cygwin installed, and was able to use that. You first need to cd into the directory where Virtual Box is installed, and run the following command. The folder structure is specific to my machine and will most likely need to be changed on yours.
1
"/cygdrive/p/Programs/VirtualBox/VboxManage.exe" clonehd 'F:/Documents/Virtualbox/Ubuntu_2017/Ubuntu 2017.vdi' 'F:/Documents/Virtualbox/Ubuntu_2017.iso' --format RAW
More simply you need to run something like this:
1
VboxManage.exe clonehd 'vdi_location.vdi' 'where_generated_iso_will_be_location.iso' --format RAW
STEP 3
Use rufus to install the ISO as a bootable image on your USB drive
And that’s about all you need to do! Then you can take a carbon copy of your VM with you wherever you go :) Great for travelling, which was my need.
HOW TO CLONE A SPECIFIC SNAPSHOT
Basically you need to switch the VDI location with the UUID of the specific snapshot you want, to get the UUID go to:
File > Virtual Media Manager
Under Hard disks find the VM you want and it will have each snapshot listed under it. Copy and paste the UUID field from the snapshot you want and switch to use this command in Step 2:
1
"/cygdrive/p/Programs/VirtualBox/VboxManage.exe" clonehd UUDI 'F:/Documents/Virtualbox/Ubuntu_2017.iso' --format RAW
More simply you need to run something like this:
1
VboxManage.exe clonehd UUDID 'where_generated_iso_will_be_location.iso' --format RAW
If you've VirtualBox installed, then you can convert VDI (VirtualBox drive image) file into IMG format by using VBoxManage command, then copy into the physical disk, e.g.
VBoxManage clonehd --format RAW file.vdi file.img
Then you can use dd command to copy the file into the physical partition:
dd if=./file.img of=/dev/<partition_here>
Note: Use sudo if required. Be careful when specifying the right device in /dev.
@mbaleprince
Copy link

please remind me after testing............

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment