Creating a persistent Arch Linux installation on a USB stick

I’ve been using Arch Linux for the better part of a decade now. As a result, I am so used to it that I’ll choose it for nearly any task at hand. Although Arch might not be a traditional distribution for persistent live systems, there’s really no reason to not use it to this purpose.

What follows is a list of steps to install and set up a minimal Arch Linux live USB system. In the spirit of KISS, we will go with a single-partition layout:

  • Create a single Linux type partition with fdisk or the tool of your choice on your USB device (e.g. /dev/sdc)
  • Execute # mkfs.ext4 /dev/sdc1 to create an ext4 file system on the created partition
  • Mount the resulting file system: # mount /dev/sdc1 /mnt/usbarch
  • Use pacstrap from the arch-install-scripts package to install the base package group: # pacstrap /mnt/usbarch base
  • Auto-generate an fstab file: # genfstab -U /mnt/usbarch >> /mnt/usbarch/etc/fstab
  • Take a look at the generated /etc/fstab file and adapt if necessary
  • Change root into the new system: # arch-chroot /mnt/usbarch
  • Configure the time zone: # ln -sf /usr/share/zoneinfo/Region/City /etc/localtime && # hwclock --systohc
  • Uncomment en_US.UTF-8 UTF-8 and other required locales in /etc/locale.gen, and generate them with: # locale-gen
  • Set the LANG variable in /etc/locale.conf, for example: LANG=en_US.UTF-8
  • Set a default keymap in /etc/vconsole.conf, for instance: KEYMAP=de-latin1
  • Define a hostname in /etc/hostname, for example: usbarch
  • Set a super-secure root password: # passwd
  • Install GRUB to your USB device: pacman -Sy grub && grub-install --target=i386-pc /dev/sdc
  • Finally, use the grub-mkconfig tool to auto-generate a grub.cfg file: grub-mkconfig -o /boot/grub/grub.cfg

The system should now be bootable and can be further adapted to your liking.