I’ve been running Arch for awhile now and one of the items on my todo list as been to create a USB rescue stick in case my installation ever gets borked with an upgraded. The process of creating a stick is really straight forward and I thought I would document the steps I used here. The first thing someone should review is the Arch Installation Guide and it will be referred to at various points. This guide assumes you are already running Arch Linux on your PC.
The first step is to partition and format the stick. I used GParted but any similar tool will do. In GParted I created a GPT table on the stick followed by two partitions. The first partition is FAT32 and only 384 MB in size, it will be the EFI boot partition. Remember to set the boot flag for the EFI partition. The second partition will contain the Arch Linux installation and it’s set to Ext 4. The screenshot below of GParted shows the final configuration.
The next step is to get the Arch Linux install scripts on the PC you are going to use to create the USB rescue stick. This is simply done with the following command:
[bash]
pacman -S arch-install-scripts
[/bash]
Next we need to mount the partitions on the stick, replace [x] in the commands below with the right letter for your USB stick.
[bash]
mount /dev/sd[x]2 /mnt
mkdir -p /mnt/boot
mount /dev/sd[x]1 /mnt/boot
[/bash]
Once the stick is mounted we can install Arch Linux on it and generate an initial fstab:
[bash]
pacstrap -i /mnt base base-devel
genfstab -U -p /mnt >> /mnt/etc/fstab
[/bash]
Next, follow the install guide as per the System Configuration (https://wiki.archlinux.org/index.php/installation_guide#Configure_the_system) section and use arch-chroot to switch to the stick and do an initial configuration of the new install.
I chose to use rEFInd as the boot loader as it is very straight forward to install and configure. To install and do an initial configuration run the following from the change root shell (i.e. Within arch-chroot /mnt) remembering to once again replace the [x] with the letter for your device.
[bash]
pacman -S refind-efi
refind-install –usedefault /dev/sd[x] –alldrivers
[/bash]
Once this is done, go into /etc/fstab and note the UUID for the second partition (the EXT4 partition) on the stick. edit the file /boot/EFI/BOOT/refind.conf and add the following at the end of the file, replace the UUID in the options line with your UUID that you noted from /etc/fstab.
[text]
menuentry “Linux Rescue” {
icon EFI/BOOT/icons/os_linux.png
loader /vmlinuz-linux
initrd /initramfs-linux.img
options “rw root=UUID=[YOUR UUID HERE]”
}
[/text]
I would also recommend commenting out all of the other menuentry items besides this one but that’s optional.
Once done, exit arch-chroot and re-start your computer. Using the BIOS boot menu, select to boot from the stick and if everything went well it should boot to a text based login. At this point you can continue configuring Arch for your specific needs.