Migrating an Arch Linux Installation to a New Machine: Listing Pacman and AUR Installed Packages and Mounted Drives
If you're a Linux user, you may have experienced the frustration of your computer "dying" and needing to transfer your existing Linux installation to a new machine. This can be a daunting task, especially if you're using a distribution like Arch Linux, which requires more manual configuration than many other distributions. In this article, we'll cover the steps you need to take to migrate your Arch Linux installation to a new machine, focusing on listing Pacman and AUR installed packages and mounted drives.
Listing Pacman and AUR Installed Packages
Before you begin the migration process, it's important to take an inventory of the packages you have installed on your current system. This will ensure that you don't miss any essential packages during the migration process. Arch Linux uses the Pacman package manager to manage its packages, but it also has access to the Arch User Repository (AUR) for additional software. To list all the packages you have installed using Pacman and the AUR, you can use the following commands:
# List Pacman installed packages
pacman -Qqe | sort > pacman\_packages.txt
# List AUR installed packages
pacaur -Qq | sort > aur\_packages.txt
These commands will create two text files, pacman\_packages.txt and aur\_packages.txt, which contain a list of all the packages installed on your system using Pacman and the AUR, respectively. The sort command is used to sort the packages alphabetically, making it easier to review the list.
Mounting Drives
Before you can migrate your data to your new machine, you need to ensure that your drives are properly mounted. This is an essential step, as it ensures that your data is accessible during the migration process. To list the currently mounted drives on your system, you can use the following command:
# List mounted drives
lsblk
This command will display a list of all the drives currently mounted on your system, along with their mount points. Make a note of the mount points for any drives that contain data you want to migrate to your new machine.
Migrating to the New Machine
Now that you have a list of your installed packages and the mount points for your drives, you can begin the migration process. Start by installing Arch Linux on your new machine, following the official installation guide. Once you have Arch Linux installed on your new machine, you can begin migrating your data.
To migrate your installed packages, copy the pacman\_packages.txt and aur\_packages.txt files to your new machine. Then, use the following commands to install the packages:
# Install Pacman packages
sudo pacman -S --needed - < pacman\_packages.txt
# Install AUR packages
pacaur -S --needed - < aur\_packages.txt
These commands will install all the packages listed in the pacman\_packages.txt and aur\_packages.txt files. The --needed flag ensures that only packages that are not already installed are installed.
To migrate your data, connect the drives containing the data to your new machine. Then, mount the drives using the same mount points you noted earlier. Once the drives are mounted, you can copy the data to your new machine using the cp or rsync command.
- List Pacman and AUR installed packages using the
pacman -Qqeandpacaur -Qqcommands, respectively. - List mounted drives using the
lsblkcommand. - Install Arch Linux on your new machine, following the official installation guide.
- Copy the
pacman\_packages.txtandaur\_packages.txtfiles to your new machine and install the packages using thepacman -S --needed - <andpacaur -S --needed - <commands, respectively. - Connect the drives containing the data to your new machine, mount the drives using the same mount points you noted earlier, and copy the data to your new machine using the
cporrsynccommand.