Install and run GNU/linux Mint 11 from a usb memory stick
In this post I will briefly go through the steps of creating a Mint 11 installation on a memory stick. Some of the things may be specific for my own setup i.e. hardware, choice of distro etc. However, most of it will be of general applicability I hope. Basically there are three ways to run a linux installation off a usb memory stick/SSD memory card etc.
- Make a live usb from an installation medium by using e.g. Universal USB installer from windows or Start-up disk creator on Ubuntu/Mint. Any changes made during a live session will be lost upon reboot.
- Make a live usb, but also enabling persistence. This way it is possible to store files, chages to the profile, add additional packages with apt etc.
- Make a “real” installation on the usb stick as if it was just another hard disk.
Although the second point seems to work surprisingly well, due to security reasons I chose a real installation. Actually I started off with method 2 and installed from one usb to another (no cd-rom/dvd drive in my laptop). The first usb was prepared from my windows installation with the universal USB installer. The second usb was prepared with the gparted tool from within Mint (running from the first usb). An ext2 extended partition was made covering the entire 8 GB disk space.
Installation was started from the Mint 11 Live desktop icon. Once the installer is running choose to do a manual disk partition. In the first Try I chose to install alongside Windows, but it was not possible to control the size of the swap space. Swap ended up taking up 4 GB space (equal to ram amount), leaving too little room for the installation (with 1 GB reserved for a fat partition). This made the installation incomplete rendering the usb un-bootable.
Remember to place the boot loader on the usb device
Add a ext2 primary partition iwth the “/” (root) mount point.
Do not bother making a swap partition if you have a sufficient amount of RAM. The installation was ended (self-explanatory). On reboot GRUB would not boot into the newly installed Mint system on my usb stick since it was now /dev/sdb insted of /dev/sdc during installation (Live USB was /dev/sdb). In order to change that I followed the steps outlined here. I basically follwed the steps outlined (except booting from the Mint Live usb stick used for the original installation). Before running update-grub2 I corrected the file /mnt/etc/defaults/grub and corrected any references to sdc to sdb. This seemed to fix the boot problems.
After the installation I made the following modifications based on advice found on the web, in order to improve system response and memory stick lifetime (minimizing writes).
- Changed /tmp to RAM. Add the following line to /etc/fstab:
tmpfs /tmp tmpfs nodev,nosuid,noatime,noexec,size=1G 0 0Change the size to whatever seems fit.
- All entries in /etc/fstab are added the noatime option. The should eliminate file system writes for files that are read.
- To minimize disk write during browser session the cache can be located in RAM e.g. for chromium the following line is added to /etc/fstab
cache-chromium /home/username/.cache/chromium tmpfs rw,noatime 0 0
Delete already existing cache and recreate:
rm -r /home/your_user/.cache/chromium
See also this page.
- The also applies to firefox. See e.g. the description here (3. point).
- It is recommended in several places to use the noop scheduler (or deadline) instead of the default (completely fair scheduler) for solid state storage. I have tried this but didn’t find any positive difference.
- I also considered adding some of the /var stuff into RAM, but I haven’t come so far yet.
This was my steps in getting a Mint 11 sysstem up and running from a USB stick.