Arch Migration to New Hardware

linux dotfiles awesomewm git

This article discusses the steps required for moving an Arch Linux system to new hardware. The goal is to achieve the same ArchLinux installation, in terms of the installed software and configuration that is independent of the hardware.

Warning: Some of the following instructions can be dangerous: you are advised to backup all of your important data on the old system before continuing.

There are two different approaches to migrating an installation:

  • Bottom to top: Install a fresh Arch Linux system on the new hardware, afterwards restore the installed packages and configuration files, e.g. as described in dotfiles.
  • Top to bottom: Clone the old harddrive to the new harddrive, or place the old harddrive into the new system; modify configuration files where necessary.

The top to bottom approach gives a more exact reproduction of the original system than the bottom to top approach. In other hand, the bottom to top is much more clean and bound to new hardware. This article will describe bottom to top.

Introduction

There are two options according this article Base Arch Article for migration

I'm using backup my .dotfiles on gihub now: .dotfiles

So, the easier and cleaner way is process bottom to top for me.

For some stations, I have backup of whole filesystem periodically synchronized to backup repositories by restic. In this case, it is possible to use top to bottom process with restic restore.

Restic store/restore is described in another guide, and it will be part of next article. This migration will be done with bottom to top process with restore packages and .dotfiles.

Bottom to Top Process

Adapt to new hardware

Warning: For both approaches we have to account for differences between the old and hardware and change the installed drivers and configuration accordingly.

Before you begin, research aspects of the new hardware and make a list of differences. Common differences are

Hard drive vs. SSD vs. m.2

See the article SSD.

CPU vendor

If you switch the CPU, to a CPU from another vendor (e.g. Intel to AMD), change the Microcode configuration.

GPU vendor

If you changed the GPU to a GPU from another vendor (e.g. from Amd to NVIDIA) change the graphics driver.

UEFI vs. MBR boot code booting

If you switch to a more recent mainboard with UEFI, it might be preferable or required to switch from "MBR boot code" booting to UEFI booting. In this case a new EFI system partition is needed.

Bottom to top

On the old system

We define here a minimal configuration that carries over from the old to the new system which differentiates this approach from the Installation guide. Think about the configuration files from /etc and dotfiles in /home that you want to copy to the new system, as well as user data files. If you will not have access to the old system from the new system then backup up all the files that you want to copy over.

List of installed packages

pacman -Qqen > pkglist.txt
pacman -Qqem > pkglist_aur.txt

gives you a nice list of explicitly installed packages from the repositories and from the AUR. Include it in your backup if you make one.

You may also use the following script to give you a better overview of the binaries and libraries installed unbeknownst to pacman (e. g. installed via Steam, Desura or using their own install methods):

find / -regextype posix-extended -regex "/(sys|srv|proc)|.*/\.ccache/.*" -prune -o -type f \
-exec bash -c 'file "{}" | grep -E "(32|64)-bit"' \; | \
awk -F: '{print $1}' | \
while read -r bin; \
do pacman -Qo "$bin" &>/dev/null || echo "$bin"; \
done

On the new system

Installation guide first and second half

For basics about installing a new system, refer to the Installation guide. Follow the first half of the installation guide.

Continue with the installation guide from, and including the pacstrap command, up to the end, but do not reboot. Do not skip the pacstrap command as it does additional work besides the installation of packages.

Install previously installed software

Install yay first from git repo. Make installation by https://github.com/Jguer/yay

Edit pkglist.txt (and pkglist_aur.txt) and remove drivers that are not needed on the new system. Then install any other previously installed software with

pacman -S --needed - < pkglist.txt
yay -S --needed --noconfirm - < ~/pkglist_aur.txt

Pull your .dotfiles from git repository

Restore your .dotfiles from your git repository. To your home directory, or additional /etc and /usr directories according to your themes or specific additional software which have specific modifications.

fstab restore

Do not forget to check /etc/fstab and restore your settings with keep actual selection of your new devices. Add your previous mapping to sshfs, nfs, samba shares etc.

Specific software

This can be hidden problem for bottom to top process. And if you are using manually installed or very specific software, restic method is much more better. The top described script "libraries installed unbeknownst to pacman" can show which libraries are specific, and you have to install it again from scratch, or make backup by rsynch, restic, borg etc.

Previous Post Next Post