Tutorials/Tips

Tips for installing a Linux distribution on an external hard drive

Installing a Linux distribution on an external hard drive should be easy and once installed, you should have no problem booting it from any computer. However, things are not always as trouble-free as they should be.

If you installed the Linux distribution on an MBR partitioning scheme and correctly configured the installer to install GRUB (the bootloader) in the Master Boot Record of the external hard drive, chances are it will boot from any computer, not just the one it was originally installed from.

However, if you installed the system on a GPT partitioning scheme, with an EFI Boot Partition, it will likely not boot from another computer. And that’s because the installer will most likely install the bootloader files where it thinks they should be installed (in the EFI Boot Partition of the internal hard drive), not where you specified (the EFI Boot Partition of the external hard drive).

For such a system to boot from any computer, you’ll have to modify the /etc/fstab file. If you’re new to Linux and have no idea what MBR and GPT means, read Guide to disks and disk partitions in Linux.

The /etc/fstab (fstab is for filesystems table) provides information about a system’s disk partitions and other data sources. It is automatically generated during the installation process and can be modified manually. Below is a sample fstab file taken from an installation of Ubuntu 15.04 on an external hard drive. Installation was on an MBR partitioning scheme.

During installation, the external hard drive was the third one detected. That’s why it’s /dev/sdc. The internal hard drive was /dev/sda, the first hard drive detected. And so in this sample fstab file, all references are to /dev/sdc, except /dev/sda9, the swap partition of the internal hard drive. If you have an fstab file like this one, it is save to delete a reference to the swap partition of the internal hard drive, because it’s not needed.

The next fstab file is from an installation on an external hard drive on a GPT partitioning scheme and with an EFI Boot Partition. As with the example above, the internal hard drive was /dev/sda, while the external was /dev/sdc. The key difference between this and the other one is that the bootloader files were installed in /dev/sda2, the EFI Boot Partition of the internal hard drive.

That’s why such a system will not boot from a computer other than the one it was connected to during installation. To make the system globally bootable, you’ll have to modify the reference to /boot/efi to point to the EFI Boot Partition of the external hard drive. That involves finding the UUID of that partition. No, you do not have to generate a new one. Just find the original UUID.

So how do you find the original UUID of the EFI Boot Partition of the external hard drive. On most Linux distributions (maybe all of them), you’ll find the UUID of partitions in /dev/disk/by-uuid. Here, for example, is a sanitized listing of those in an installation of Linux Mint 17.2. Note that when looking for the original UUID, you should be doing so from the computer the external drive was connected to while it was being installed.

Once you locate the UUID, modify the entry that points to the UUID of the /boot/efi line in fstab to match.

Another point to note when you’re attempting to install a Linux distribution on an external drive: Use the appropriate version of the installer. For example, if you intend to install the system on a GPT partitioning scheme with an EFI Boot Partition, use the UEFI-aware version, and the non-UEFI version, if you intend to install it using an MBR partitioning scheme.

To make sure that you use the appropriate version of the installer, access the computer’s boot menu and look for entries for the installation DVD or USB stick. Booting from the one starting with UEFI: will boot the UEFI version of the installer, while booting from the one starting with USB will boot the standard version of the installer. In Figure 1, the last two entries for the installation USB stick.

Which method do I recommend for installing a Linux distribution on an external drive? Use the MBR partitioning scheme, so you don’t have to deal with the EFI Boot Partition mess.

Computer boot menu
Figure 1: Entries in the boot menu of target computer

Subscribe to LinuxBSDos.com

Subscribe to receive the latest articles in your Inbox

I agree to have my personal information transfered to MailChimp ( more information )

Trust me, you'll not be spammed...

Please share:

We Recommend These Blockchain Conferences and Servicess

Register now for Blockchain & Decentralized Tech SuperSummit, international conference on blockchain technology in Dallas, TX (USA), April 1 - 4, 2019

Reasons to use control panel for your server

Today's valid web hosting discount codes

Learn how to trade cryptocurrencies using technical and fundamental analyses at BDT SuperSummit

Best binary auto trading software reviews by 7binaryoptions.com

Launch an SSD VPS in Europe, USA, Asia & Australia on Vultr's KVM-based Cloud platform starting at $5:00/month (15 GB SSD, 768 MB of RAM).


Leave a Comment

Your email address will not be published. Required fields are marked *

*