How to install Linux on a Flash drive with Virtualbox
Most of the articles out there that talk about how to install Linux on a flash drive bring complicated tasks for regular users that are not used to use commands and scripts. They add in their tutorials a lot of commands with filesystems mounts and unmounts procedures and etc…
This article I will try to show a simple mode of how to install Linux on a Flash Drive to be used on any type of machine that supports boot through a external device.
We are talking here about a clean installation, as we would be installing Linux on a desktop but instead of using the hard drive we will use the flash drive without having to boot the system through the CD-Rom and neither un-archive the files of the distribution installation CD.
The installation is made straight to the Flash Drive and for that we will use Virtualbox, a hypervisor to create virtual machines that permits various operation systems to be executed simultaneously on the same session.
1 – Hardware
- CPU: dualcore with 2 GHz
- RAM: 2GB
- HD: enough space to allocate the installation CD image (ISO file)
- Flash drive: at least 4gb one (8gb recommended)
You could use the Installation CD of your preferred distribution if you like.
3 – Software
- Hosting Operation System: For this purpose I used Ubuntu 11.10 but you could use anyone, even Windows :-/
- Latest Version of VirtualBox
If you use Linux you can download it from: https://www.virtualbox.org/wiki/Linux_Downloads
If you use Windows:
- Virtuabox extension Pack
Allows you Virtual Machines to recognize Flash Drives:
Configuration and Installation
After download all the necessary software you can install VirtualBox as you are used in your Distribution.
To install the extension pack you just need to double click on the file and follow the following procedures:
- Open VirtualBox
- Click on menu Machine -> New
- Click Continue
- Give the Virtual Machine a name: Example: FlashUbuntu
- OS Type select the OS that you will be installing ( In my casino online case Linux / Ubuntu )
- Click Continue
- Select how much ram memory you will allocate for this machine, between 750mb and 1gb is fine
- Click Continue
- This screen you will need to create a virtual disk . If you have a 4gb Flash drive it is recommended that you create a virtual disk for the current distribution. (virtual disk won’t be used, it is only used to by pass the installation process that requires a storage larger than 4gb.). If your Flash drive is larger than 4GB then it won’t be necessary, so uncheck the option “Start-up Disk”
- Then click on Continue and Continue again to create a a virtual machine without hard disk.
- Then click on Create
Your virtual machine was created and now we will set it up.
- Plugin in you flash drive in the USB port of you computer
- Click on menu Machine -> Settings
- New window will open and now click on the Storage tab
- On the Storage Tree side, select the empty cd-rom bellow the IDE Controller
- On the right side (Attributes) click on the cd media picture.
o If you prefer to use a Installation CD, insert now the media and click on Host Drive
o If you have an installation image file, click on Choose a virtual CD/DVD disk file and point to the image that you have.
- On the left menu click on USB
- Make sure that the USB controllers are checked
- On the right side click on the signal to add a new USB device and choose you flash drive which should be already plugged in.
- Click on OK button
Your machine is now setup e ready for the Installation.
To install your distribution follow the next steps:
- Click on Menu Machine – > Start
- Close any notice windows that might appear and press F12 key to open the boot manager of the virtual machine.
- Then press the “c” key to start it from the virtual flash drive.
- On you virtual machine, click on the menu Devices -> USB Devices and make sure that your flash drive is checked.
- When you open the installation menu select the option install on Hard Drive
- Then go over the regular installation process until you get to the partitioning session.
o If you have a 4 GB flash drive you will only have one options to select, so you can proceed normally.
o If your flash drive is larger than you will need to select ir as the disk that you will install the distribution an than you can continue the installation as usual.
The whole system will be located in your flash drive at the end of the installation when it asks you to reboot you system.
Close all the applications, reboot your computer and set it up to boot from the USB device.
All right? Now your system should start as it was stored on a hard disk.