Gentoo Wiki


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc



This article deals with the case where you want to install a machine with the same architecture (i.e. i686) as another machine.


Before you can start to actually copy data from the source machine to the target machine you have to prepare the target host in terms of partitioning, filesystems and networking.

Boot target machine from CD

Download the latest Gentoo Minimal CD/InstallCD which matches your architecture, burn it to a CD and boot the target machine with this CD.

Partitioning & File Systems

Note: This article assumes that your hard disk is named /dev/hda, if it should be called differently (e.g. /dev/sda) you have to change the commands below accordingly

Check partitioning of the source machine:

source# fdisk -l /dev/hda

Apply the same partitioning from the source to the target machine

target# fdisk /dev/hda

Finally, create the file systems on the target machine.

See the Gentoo Wiki for more information on partitioning and creation of file systems. The right link for you to the Wiki depends on your language and on your machine's architecture, most people will find appropriate hints here

If you created the standard partition layout as recommended by the Gentoo handbook (boot, swap and root partition) then you can create the file systems with the following commands:

target# mke2fs /dev/hda1
target# mke2fs -j /dev/hda3
target# mkswap /dev/hda2

You might want to enable the swap right now:

target# swapon /dev/hda2


The file systems on the target host need to be mounted. We assume that you use the recommended mount points from the Gentoo Install CD which is /mnt/gentoo for the new root partition and /mnt/gentoo/boot for the new boot partition.

target# mount /dev/hda3 /mnt/gentoo
target# mkdir /mnt/gentoo/boot
target# mount /dev/hda1 /mnt/gentoo/boot


If you are lucky your network adapter is detected automatically by the Gentoo Install CD while booting. In many cases - when DHCP is used - you already got an IP address assigned. Check if your network card is ready and what is your IP address:

target# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:BA:8F:61:7A
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::50:ba8f:617a/10 Scope:Link
          RX packets:1498792 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1284980 errors:0 dropped:0 overruns:0 carrier:0
          collisions:1984 txqueuelen:100
          RX bytes:485691215 (463.1 Mb)  TX bytes:123951388 (118.2 Mb)
          Interrupt:11 Base address:0xe800 

If your output looks like the one above your network seems to be ready and your IP address is in this example

Next, check if there is a connection between the two computers. Find out the IP address of the source machine using ifconfig (lets assume and try to reach it from the target:

target# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=2.37 ms
64 bytes from icmp_seq=2 ttl=64 time=2.83 ms
64 bytes from icmp_seq=3 ttl=64 time=1.64 ms

If you should not be able to ping the source machine from the target and vice versa you have to solve this problem before proceeding. Possible reasons for network problems are:

Please consult network HowTos for more help on this if problems persist.

Copy Data

Copy the data from each partition of the source machine to the corresponding partition of the target.

Note: The content of the swap partition does not need to be copied, it is sufficient to create a new swap partition on the target machine as shown above

On the target machine give root a known password

target# passwd

After that start sshd with:

target# /etc/init.d/sshd start

Boot partition

Usually on a Gentoo system the boot partition is not mounted, thus we do this first on the source machine:

source# mount /boot

Now we can copy the content of the boot partition to our target host:

source# tar cvzp /boot | ssh tar xzp -C /mnt/gentoo

Do not forget to clean up:

source# umount /boot

Root partition

Warning: On the source machine you MUST work from the root directory "/" otherwise relative links will not be copied to the target machine correctly. This is probably a bug in tar.

On the source machine enter:

source# cd /
source# tar cvzp / --same-owner --preserve --one-file-system --exclude=/dev --exclude=/proc --exclude=/tmp --exclude=/usr/portage/distfiles 2>/tmp/progress.log | ssh tar xzp --same-owner --preserve -C /mnt/gentoo

Progress can be followed on the source machine with:

source# tail -f /tmp/progress.log

You can watch the progress on the target host:

target# watch -n 5 df -h /dev/sda3

Finally, clean up:

source# rm /tmp/progress.log

Update the target machines config

Change Environment

Mount /proc and /dev in the new environment:

target# mkdir /mnt/gentoo/proc
target# mount -t proc none /mnt/gentoo/proc
target# mkdir /mnt/gentoo/dev
target# mount -o bind /dev /mnt/gentoo/dev

Change our environment to the new system:

target# chroot /mnt/gentoo /bin/bash
target# env-update
target# source /etc/profile


We have to add the directories which are not copied from the source machine:

target# mkdir /tmp

UDEV Network Adapter Rules

The hardware address of your network adapter is configured in /etc/udev/rules.d/70-persistent-net.rules. You either have to delete the old lines from this file or you update the hardware address. You can identify the hardware address for the network adapters in the target machine with ifconfig.


Activate grub on boot:

target# grep -v rootfs /proc/mounts > /etc/mtab
target# grub-install --no-floppy /dev/hda


Don't forget to update

Problems on the target machine

Wrong permissions are due to missing users before copy.

Postfix complained about wrong permissions. Fix it with:

# chown -R postfix:root /var/spool/postfix/*
# chown -R postfix:postdrop /var/spool/postfix/public /var/spool/postfix/maildrop /var/spool/postfix/maildrop
# chown root:postdrop /usr/sbin/postdrop /usr/sbin/postqueue
# chmod u=rwx,g=rsx,o=rx /usr/sbin/postdrop /usr/sbin/postqueue
Retrieved from ""

Last modified: Fri, 05 Sep 2008 06:38:00 +0000 Hits: 7,378