Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Tutorials»How to Boot from USB Drive in VirtualBox on Linux

    How to Boot from USB Drive in VirtualBox on Linux

    By RahulSeptember 16, 20152 Mins Read

    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.

    Advertisement

    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

    Now use 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.

    Boot from USB Drive in VirtualBox

    Now select the amount of memory (in MB) to allocated to new virtual machine and click Next.

    Boot from USB Drive in VirtualBox

    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.

    boot-usb-virtualbox-3

    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

    boot-usb-virtualbox-4

    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

    USB-Boot-Screen

    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.

    Ubuntu 1404 from USB

    To install it permanently click on Install Ubuntu and complete the installation wizard to finish Ubuntu install on your system.

    boot linux usb VirtualBox vm
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Understanding 2>&1 in Bash: A Beginner’s Guide

    How to Choose the Best Shebang (#!) for Your Shell Scripts

    Modulus Operator (%) in Bash

    Using Modulus Operator (%) in Bash

    View 6 Comments

    6 Comments

    1. Alessandro on March 2, 2020 7:53 pm

      I really want to thank you man, your tutorial helped me a lot.

      Reply
    2. sftb on July 18, 2019 8:27 pm

      Does not work with more than one Partitions!

      Reply
    3. Anonymous on May 23, 2017 7:10 am

      That is very different than booting from USB, that is booting from an internal disk that is stored on the USB.

      So when booting that way, the GUEST see the USB not as a USB, it see it as a normal internal hard disk.

      Just a tip: Try to install a Windows Guest on that USB that way, then try to boot it on real hardware, then try to install Windows on the USB using the real hardware… you will find things.

      On the other side: I use that trick to install Grub2 onto one of the USB sticks i have (real UEFI hardware refuses to see it on boot, since i want a BIOS boot, but real hardware does not have the option to boot in BIOS mode, it only supports UEFI… on firmware there is no option for Legacy, etc… as soon as possible i will sell that computer and by another one supporting both modes… but till then… i make BIOS Grub2 boot in virtual machine with VMDK trick)… and then when i test on a friends BIOS boot PC it boots Grub2 very well.

      Reply
    4. John on August 14, 2016 2:15 pm

      Created virtual disc but I don’t have permission to use the file. If I try to change the permissions I get told I don’t own the file and cannot change permissions. If I try to go through terminal I can’t get to the file and if I run virtual box with sudo from terminal all my existing machines are missing because it thinks I’m the sudo user and does not show my existing machines. Oh it’s all a bit painful.

      Reply
    5. Rodrigo on May 4, 2016 2:39 pm

      worked for me, but had to run vbox as sudo.

      i used this to remove video drivers from my live cd, they were causing ubuntu 16.04 live cd fail when running on a physical host with an nvidia video card.

      Reply
    6. raghu on October 22, 2015 10:31 am

      Hi Rahul

      Nice article, i have small doubt what will happen if we re-plugin the usb drive, whether the vm will work fine or we need to perform the troubleshoot again to make the vm work.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.