Arch installation guide

Guide on how to install Arch Linux on UEFI computers, using systemd-boot and f2fs, targeting USB drives. The reason for making this was that I always forgot something during an installation, so I wrote down my steps, so I could copy & paste a list of commands so I can have an installation in just a few minutes.

If you use a computer with Intel Skylake graphics or later, you can use everything listed here. If your hardware is slightly different, you can still look at it to see what's useful to you.

What&Why F2FS? F2FS is designed for flash storage, as a result a tiny USB flash drive can perform terrific for many tasks. Another good option would be btrfs with its transparent compression. What&Why systemd-boot? systemd-boot is a boot loader that is required to boot into your OS, it is small and simple, which is great for slow storage, and can boot any kind of root system. An alternative would be GRUB, though when I wrote this it couldn't boot f2fs yet, and also no zstd compressed btrfs.

This is text that you enter directly into a terminal window.

This is text that you enter directly into a text editor.

This is text that provides explanations as to what is being done. Skippable.

This is text that is completely unimportant and there's no need to read it.

Hang on, what's Arch Linux?

I've run into websites so many times where I had no clue what I was looking at, that I know that I shouldn't make one myself.

Basically, Linux is a computer operating system, like Windows or iOS or Android, and it has a bunch of variations. Android is one, Ubuntu is one, Arch Linux is one, and there are many others. This website basically outlines and explains how to put software on a USB flash drive.

Prerequisites

Partitioning

The main reason to use a virtual machine is so you always have full access to the host machine still, for resources that you might like, or just to play music in the background, or play solitaire while packages are downloading. ESP is a partition used for every UEFI installation, which is a FAT partition, which always writes changes to files whenever you access them and reducing writes is key for a USB key, so we specify the "noatime" option which stops that from happening. We use the same thing for the main partition alongside nobarrier, which disables write barriers which makes us have more throughput at the cost of increased risk of losing data during a sudden power failure. If you're opting for btrfs instead, then use mkfs.btrfs instead of f2fs, and specify ",compress=zstd" after the discard option. The three "tmpfs" mounts are making Linux use RAM to store log files and some temporary files, which again greatly reduces writes to the flash storage.

Just in case you're using the standard Arch installation image, where you only have a command line, in order to partition, you'll need to use lsblk to identify your target disk. Then gdisk /dev/sdx to create a GPT layout. cgdisk /dev/sdx to create the partitions using EF00 for the ESP, and 8200 for the swap partition.

If you're using an existing Arch installation to install from, run pacman -Sy arch-install-scripts gparted f2fs-tools --needed

Installation

Those are a lot of boot options. If you're using kernel 5.2, you can replace everything after i915 with just "mitigations=off". They're settings to reduce the impact of some theoretical security impacts, if you're reading this by the time there are real viruses which can affect you which make use of spectre/meltdown, then I highly recommend you do remove those mitigation disablers. The i915 ones help increase battery life.

Post-installation recommendations