Cloning Kubuntu

created: 1223292508|%e %B %Y, %H:%M
TAGS: linux ubuntu

How to clone a nicely running Linux configuration to a new system. I did this with a Kubuntu set-up but it's a general technique that will work with any Linux box.

Here is what happened: I have Kubuntu running very nicely on a Thinkpad X61, and I wanted to get a second-hand X40 for traveling. If you don't know these machines, they're worth looking at. Light, tough, and they run for up to 8 hours on one charge if you push the right buttons. Last week at a random meeting I noticed that about half the participants seemed to have the same little notebook. The X40 is the older version of this ultralight model.

I got my second hand X40, and of course Kubuntu installs fine. But I wanted to clone my existing, tweaked notebook. Most explanations assume the drive sizes are the same but my X61 has a 160 Gb drive and the new (old) X40 a 40-gig drive.

So here is how I got a perfect copy onto the smaller machine. You will need a portable USB drive, or a large USB stick.

Make your backups

First, create a tar file of all system files:

sudo bash
cd /[root directory on removable media]
tar -czf system-backup.tar.gz --one-file-system /bin /etc /lib /sbin /usr /var

Second, create a tar file of your home directory

sudo bash
cd /[root directory on removable media]
tar -czf home-backup.tar.gz --one-file-system /home/myname

Prepare the target system

I installed Kubuntu from the same CD I'd used originally. This ensures I have the same Linux kernel version.

Restore the backups

I attached my USB disk (and confirmed KDE's proposal to mount and browse the disk) and opened a shell window. Then I restored the two backups:

sudo bash
cd /
tar -xzf [path to removable disk]/system-backup.tar.gz
tar -xzf [path to removable disk]/home-backup.tar.gz


That was it. My X40 is now a perfect mirror of the X61, including all configurations, stored passwords, ssh keys, etc.

Bookmark and Share

Rate this post:

rating: +1+x

Comments: 0

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License