You are not logged in.

#1 2015-01-01 07:22:57

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,523

Duplicate installation to new place by pacman

Hello,

this is an attempt to describe a procedure to set a very same installation over a second partition. Mostly this intent is to avoid a huge number of downloads. So it is supposed that the host computer has a good number of packages in its cache.
I read Pacman wiki and its tips without finding details for this purpose.

I greatly welcome note and improvements.
This procedure is not tested, so small oversights may be there.
LVM, LUKS and BTRFS are separated case, it's recommended to see related wikis.

Mount the partition, by convention X stands for a letter [a to z] and Y denote a range of digit [0 to 9]. So it will take some detection to find the partition, and the partition should be already formatted of your liking.

# new_arch=/tmp/newarch
# mkdir ${new_arch}
# mount /dev/sdXY ${new_arch}

If you labeled the partitions then it's easier and just do

# mount /dev/disk/by-label/part_name ${new_arch}

That doesn't need you to find which UUID or kernel name to use.

Later prepare the pacman database into new installation

# mkdir -p /var/lib/pacman
# pacman -Syy -root ${new_arch}

First we'll install the packages from the standard repositories

# pacman -S $(< pacman -Qqn)  -root ${new_arch}

Then for any foreigner package and we are using an AUR helper we may use it, following example is for yaourt

$ yaourt -S $(< pacman -Qqm) -root ${new_arch}

That's all, the packages should be in the destination. Now we need few steps to make the new installation active. Who will use it along the normal installation may skip to install a boot loader/manager.
We generate the fstab

# genfstab -p  ${new_arch} -U >> /mnt/etc/fstab

If we have labeled partition change -U with -L
So  need to chroot into the new installation, prepare the new kernel as a normal installation and  installing a boot loader. This is a personal choice about which boot loader, so better to see this wiki.
To make sure that packages are up-to-date, in chroot mode, just do

# pacman -Syu

This command probably will ask to download latest packages, remember to adjust your /etc/pacman.d/mirrorlist according the mirror you prefer to use.
Final, all the programs use default settings. If there are particular setting to make things going, then it's needed to copy them to new installation.

Now my doubts
What happen if I do

# pacstrap ${new_arch} 

Will it uses my pacman cache?
What is the result of

# pacman -Sy --dbpath  ${new_arch}/var/lib/pacman

I suppose that the new database will be queried and updated, right?


do it good first, it will be faster than do it twice the saint wink

Offline

Board footer

Powered by FluxBB