The idea to have a proper Linux installation on a Flash drive is about as old as my current Ultrabook, the Fujitsu U904 which I bought in winter 2013. Well, I finally got a fast and large enough Flashdrive (a tiny USB 3.0 32GB Sandisk, there are faster drives, but it is actually enough for openSUSE) and proceeded to fiddle with setting it up - and it works.
Basically I have openSUSE installed on a flash drive - which I can load in VirtualBox or alternatively if I enable booting from external media, I can plug it in and boot my laptop from there instead while still retaining Windows. What is it good for? It is useful when I need more performance than a Virtual Machine will give me - most of all it is a way of having a Linux VM externally without filling up my (too small) SSD.
So how did I do it:
- Download and install VirtualBox 5.1.x or newer - it is what I used, it is free and works.
Other virtualisation techniques? Try if you want.
- Download your distro of choice - I used openSUSE Tumbleweed.
- Download and install the VirtuaBox extensions - we need those to ensure we have EFI support as well as USB3.0 support. Lacking these will most likely cause issues with any USB 3.0 device as they do not seem to get native support in VirtualBox otherwise...
- Set up a virtual machine in VirtualBox - you can assign a disk, but most importantly, add the flash drive and enable EFI support.
- Install the OS onto the flash drive. If you set up an internal disk you can delete that in VirtualBox.
OpenSUSE will default to BTRFS for the root drive with snapshots - on a small flashdrive, disabling snapshots, using ext4 (or another file system) or not splitting partitions for /root and /home may be required.
- If all goes well, victory. You may need to point VirtualBox at the USB key again if you remove it to boot the VM, but it should work.
- If you have enabled EFI in Virtualbox it writes the required files to a dedicated partion. In my case I enabled booting from the USB port and booted into Tumbleweed just fine.
- A USB Flash drive may not be designed for the write loads it gets as a result - I have no idea what impact this will have on its lifetime. It could fail in 2 days or 20 years, I just do not know. I suspect some kind of USB SSD with wear levelling would be best - or a very high end flash drive with wear levelling. Only YOU are responsible for YOUR data.
- I may be too impatient of the shutdown when booting from the USB drive without a VM does not complete. At least it seemed to hang. However past openSUSE releases had issues where it took a long time to shut down, so maybe I'm just too impatient.
-> A couple of updates later this works fine, this could have been a bug in the initial install or kernel. All seems well right now.
And with no no responsibility for the content hosted on these sites: