Migrate installation to new hardware

From ArchWiki
Revision as of 22:43, 29 July 2018 by Probackup-nl (talk | contribs) (Command formatted as command to match the other commands on this page)
Jump to navigation Jump to search

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: Mentions rc.conf and uses links to wiki articles that don't exist anymore. (Discuss in Talk:Migrate installation to new hardware#)

This article discusses the steps required for moving an Arch Linux system to new hardware. The goal is to achieve the same ArchLinux installation, as far as installed software and configuration is concerned.

There are two different approaches to migrating an installation:

  1. Bottom to Top: Install a fresh Arch Linux system on the new hardware, afterwards restore the installed packages and configuration files.
  2. 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.

Which way you choose depends heavily on how the new system differs from your old and how exact you want to reproduce the system.

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.

Bottom to Top

On the old system

What software?

$ pacman -Qqe | grep -vx "$(pacman -Qqm)" > Packages
$ pacman -Qqm > Packages.aur

gives you a nice list of explicitly installed packages. Don't forget the software not installed through pacman (also see AUR FAQ). 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"; \

Copy to some backup space.

  • You can consider backing up /var/cache/pacman/pkg if you do not change architectures (example: from x86 to x86_64)
  • /etc should be backed up, in order to peek if necessary.

On the new system

Wiki articles

  • Read some Wiki articles concerning new hardware, for examples your new SSD.
  • Stick to the well-written installation guidelines here in this wiki. Since you are experienced, the Installation guide could be enough.
  • Try to configure as much as possible sticking to current wiki articles and forum posts.

Copy from backup space

  • Copy the pacman cache to var/cache/pacman/pkg
  • Don't forget to edit /etc/pacman.d/mirrorlist

Install software

As root, grab a cup of coffee and execute:

# xargs -a Packages pacman -S --noconfirm --needed

Top to Bottom

Merge-arrows-2.pngThis article or section is a candidate for merging with Migrating Between Architectures Without Reinstalling.Merge-arrows-2.png

Notes: please use the second argument of the template to provide more detailed indications. (Discuss in Talk:Migrate installation to new hardware#)

Move the system to the new HDDs

Note: If you are planning to keep the hard drive where the system is already installed, you can skip this section.

There are two fundamental methods for copying data between two disks, cloning an entire disk, and copying single files. For details see Disk cloning. If you want to clone the entire disk, it is required to use a live cd to do so.

At the same time there are many different methods for how to transport the data between the two drives:

  • Connect origin and destination HDDs to the same computer, either the old or the new one. Data link: old HDD -> computer -> new HDD.
  • Make use of temporary storage devices like external HDDs, or cloud backups. Data link: old HDD -> old computer -> storage -> new computer -> new HDD.
  • Transfer data over network, for example with rsync. Data link: old HDD -> old computer -> network -> new computer -> new HDD.

For the first two options, consider that you might need adapters to connect the HDDs (PATA->SATA, USB-HDD-Cases, etc.), and choose a connection that is sufficiently fast. The last two options require you to use a live system on the new computer, as it is not possible to boot from the new harddrive at this point. It is also worth to clean up your system before cloning it. See List of applications#Disk usage display for useful tools.

Update fstab

  • using /dev paths: this should change depending on how the new drives are connected to the mainboard, on the BIOS and on the new partitions scheme
  • using fs labels: should be safe
  • using UUIDs

Reconfigure the bootloader

  • because of:
    • new HDD and partitions configuration
    • new BIOS configuration
  • GRUB allows to edit entries with 'e'
  • use a live system?
  • update framebuffer mode (if new gpu)

Regenerate kernel image

  • initially the Fallback image could work
  • regenerate image
    • mkinitcpio -p linux

Update the graphic drivers

  • if changed driver (e.g. from ATI to NVIDIA) can uninstall the old drivers

Reconfigure audio

  • alsamixer volume
    • save settings

Reconfigure network

  • if need to change hostname:
    • hostnamectl
    • /etc/hosts
    • other apps using hostname: synergy, nut (network ups tools)
      • # grep -Ri 'hostname' /etc should give some hints on the files to be updated
  • if using dhcpcd with named network interfaces:
    • $ dmesg | grep 'renamed from eth' might help to find the new interface name
    • remove old # systemctl remove dhcpcd@enpXs0.service
    • activate new # systemctl start dhcpcd@enpXs0.service

See also