Transfer a Debian installation to another partition

After the wait for the final version of AuroraOS got a bit too long and Ubuntu didn’t really work well on my 1000H, I incidentally stumbled across the Wiki for Debian on the EeePC. The project is so well documented that the installation of Debian Squeeze went surprisingly easy.

In order to get Wi-Fi working I had to compile the drivers from Ralink‘s website myself. Except for a minor glitch in context with hidden networks the device is working very good now.

Installing the eeepc-acpi-scripts package and appending “ACPI_OSI=Linux” to the GRUB entry for my current kernel helped to get all of the Function (Fn) keys working.

To play it safe, I had done the new installation on another hard disk in order to always have a way back to a working system. As soon as I had configured the Debian system to my liking I transferred it to the other larger hard disk and integrated it into the dual boot structure already residing there. First I made  tars of both the new and  the old system. The former for the  transfer, the latter as a backup.

Using a Ubuntu live system from a flash drive I performed the following steps to make the implanted Debian feel at home. I formatted the target partition and extracted the tarball in it. Then I prepared a minimal basis for the generation of new boot manager settings. Bear in mind that the paths will probably vary in your installation.

1
2
3
4
mkdir /media/debian
mount /dev/sda5 /media/debian
mount -o bind /dev /media/debian/dev
mount -t sysfs none /media/debian/sys

chrooting into the mounted file system and updating the outdated GRUB configuration finished the transfer.

1
2
3
4
chroot /media/debian
mount /dev/sda1 /boot
/usr/sbin/update-grub
/usr/sbin/grub-install /dev/sda

That’s it. update-grub automagically generates the correct menu entries for all OSes on the system and grub-install writes  the whole thing to the MBR. After a reboot the GRUB boot menu presented all bootable operating systems in the correct order and all have been working as expected so far. Nevertheless I’ll wait for a few days before wiping the install disk in case something goes wrong.