Booting a physical machine using USB is much easier, but VirtualBox does not provides direct way to select boot from USB. So if you have a bootable USB drive then this article will help you to how to create VirtualBox vm using bootable USB.
For this example, I have already created a bootable USB of Ubuntu. You can visit following links for prerequisites.
- Create bootable USB
- Install VirtualBox on Ubuntu, Debian & LinuxMint
- Install VirtualBox on CentOS, RHEL & Fedora
Step 1 – Attach & Find Bootable USB
Now attach your bootable USB drive to your system and find the name of USB attached. In my case the USB drive name is /dev/sdc.
/dev/sdc1 7.5G 1.1G 6.5G 14% /media/sysadmin/new
Unmount mounted USB drive using following command
# umount /dev/sdc1
Step 2 – Create VMDK from USB
VBoxManage (VirtualBox command line) command to create raw vmdk file using USB (/dev/sdc) using following command at desired location.
# VBoxManage internalcommands createrawvmdk -rawdisk /dev/sdc -filename /opt/USB-Boot-Disk.vmdk
Read more about VBoxManage command line utility.
Step 3 – Create VM in VirtualBox
Now start the VirtualBox on your system and click New to start Create Virtual Machine wizard. Enter name of your machine ans select proper operating system type and version.
Now select the amount of memory (in MB) to allocated to new virtual machine and click Next.
In this step select Use an existing virtual hard disk file option and select vmdk file created in last step. This will attach this virtual disk with new virtual machine. Now click Create button.
At this stage your virtual machine has been created successfully. Now select the newly created virtual machine and click Start button. This will boot your virtual machine
If everything goes smooth, you will see boot options at this stage like below screen shot. You can select to Install Ubuntu or any other option as per your choice. By default it will boot as live media
Default live boot will take place and you will see screen like below. From where you can also install operating system permanently. Or you can select Install Ubuntu on above screen to start installation.
To install it permanently click on Install Ubuntu and complete the installation wizard to finish Ubuntu install on your system.