Creating A Portable Linux Installation On A Flash Drive (Part 1)
I like the idea behind Docker where you can set up applications to run within their own container. However the last time I played with it I had some trouble configuring it to my satisfaction and decided to look for another solution.
This led me to consider the use of USB flash drives. With their increasing capacity and decreasing cost it’s become more and more practical to install a complete system on one and dedicate it for a particular use. There are plenty of Live CD/USB distributions out there but what I’m really talking about is a portable installation upon which you can install all the support software you need and boot anywhere.
It turns out this is a lot easier to do than you might think.
Installing Linux To A USB Drive
WARNING!!! As you are doing this, be sure you are installing to the USB flash drive! Be careful and ensure you’re not overwriting your main drive by mistake! If you have any doubt, don’t do it!
The easiest way I’ve found to do this is using VirtualBox. Begin by obtaining a USB flash drive with enough capacity to comfortably hold a Linux installation and download the install media for the distribution of your choice. For this example, I’m using a 32 GB flash drive and Linux Mint 18.1.
Begin by starting VirtualBox and clicking New to create a new virtual machine. Specify a name, operating system type, and version. Click Next.
On the next screen specify the memory size. Linux Mint recommends at least 1 GB so that’s what I where I set it. Click Next.
When asked if you want to create a hard disk, choose Do not add a virtual hard disk. Click Create and Continue.
At this point you’ve created a virtual machine with no hard disk. From the VirtualBox main form click Storage and insert the installation media iso you downloaded into the virtual optical drive.
From the VirtualBox main form click USB and enable the controller appropriate to the flash drive being used. If you cannot enable the required USB controller you’ll have to download and install the VirtualBox extension pack before proceeding.
Once you’ve enabled the USB controller, click Start to start the virtual machine.
Once the virtual machine has started, right-click the USB icon in the VirtualBox tray and connect to your flash drive.
When the connection is complete perform a normal install to the USB flash drive. When the install is done, test it by rebooting you system from the drive you created. If all has gone well, you’ll have a fully functioning Linux system to which you can install any packages that will fit in the available space.