Monday, June 19, 2006

Cloning my notebook...and then mutating it!

Who said that only rich doctors were allowed to clone? I've just cloned my 3 year old notebook on to my brand new Acer TravelMate 4200 notebook that I got from my office.

While the operation wasn't extremely easy, given that I had about 30GB to clone accross a 100MBps shared LAN, it was relatively easier than reinstalling all my 500 odd packages. Given my preference for Gentoo Linux, this would have resulted in a considerable amount of down time waiting for everything to compile. Instead I had a workable system that was identical to where I left off.

Cloning 101



Cloning a GNU/Linux box is relatively simple. I booted both machines off two Knoppix LiveCDs, and then proceeded to configure the network cards on each notebook, so that they can ping each other. Then I partitioned my new notebook's hard drive, wiping out windoze, but keeping the hidden recovery partition just in case (i needed to return it). If you thought that this required creating partition sizes identically to the old notebook, then think again. I was able to utilize my new 80GB hard drive as I pleased, evenleaving some unpartitoned space to play with in the future.
Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

 Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1         509     4088511   12  Compaq diagnostics
/dev/hda2   *         510         521       96390   83  Linux
/dev/hda3             522         770     2000092+  82  Linux swap / Solaris
/dev/hda4             771        7617    54998527+   5  Extended
/dev/hda5             771        2637    14996646   83  Linux
/dev/hda6            2638        7617    40001818+  83  Linux

So as you may have noticed that unlike the doctors, we are not cloning the body but instead the soul.

# mkdir /mnt/install

Ater creating the install mount point, next I formatted the different partitons and mounted them, but in the following order:

  • format /dev/hda5 and mount to /mnt/install
    • # mkreiserfs /dev/hda5; mount /dev/hda5 /mnt/install; mkdir /mnt/install/{boot,home}
  • format /dev/hda2 and mount to /mnt/install/boot (I prefer a seperate /boot partition)
    • mkfs.ext2 /dev/hda2; mount /dev/hda2 /mnt/install/boot
  • format /dev/hda6 and mount to /mnt/install/home
    • mkreiserfs /dev/hda6; mount /dev/hda6 /mnt/install/home
Next I mounted the different partitions from my old notebook in a similar manner (without the formatting steps..duuh!).

By using rsync tool that was already installed on knoppix, I could now begin the cloning process by issuing the following commands.

On the old notebook

# /etc/init.d/rsync start

On the new notebook

# rsync -av root@ip_of_old_notebook:/mnt/install/ /mnt/install/

..and after about a few hours later the system would have completely been cloned.

Unfortunately as my hard drive layout (body) wasn't compatible with the old one, I needed to reconfigure the /mnt/install/etc/fstab and /mnt/install/boot/grub/menu.lst files and change the partitions to the correct values.

Finally, I installed the boot loader, GRUB on the new machine and rebooted it.

# grub-install --root-directory=/mnt/install/boot /dev/hda

kernel panic!

Ok so it didn't exactly go smooth, but only because I used a custom kernel that was optimized for my old notebook. After recompiling a new kernel with drivers for the acer notebook, and rebooting, I was able to get it to work like a charm. If you're using a standard stock kernel, then you are unlikely to have these issues.

One other point to keep in mind is to have some sort of automatic hardware detection deamon running so that you don't have to manually specify drivers. For this, redhat systems use the Kudzu package or something similar while debian systems tend to use the Discover package. I ofcourse opted to manually configure my drivers the Gentoo way!

Introducing Mutations...



I've already done a bit of mutation by modifying a couple of files, but ultimately the whole point of running Gentoo is to optimize it for my hardware. This is going to take a bit of time, as it requires me to recompile the complete system with new compiler flags (aka USE flags). I've already started download all the package sources and hopefully within a day or two I can finish that. I am eager to see how long it will actually take to compile the system, (while I work on it ofcourse), since it has got 1GB of ram and an intel Duo Core Centrino processor (see full specs below).

dsc00104.jpg


For anyone purchasing a new notebook thats worth value for money, the Acer TravelMate 4200 is an excellent choice IMHO. And if you want to fully utilize its power then an OS such as Gentoo or any other GNU/Linux disto for that matter is *the* excellent choice!

Processor: Core Duo T2300 1.66 GHz
Motherboard chipset: Intel 945GM
Memory: 1GB DDR2 SDRAM (upgraded)
Hard drive: 80 GB ATA 5400rpms
Optical drive: DVD Super Multi writer
Connectivity: Ports 4 x USB 2.0; RJ45 (LAN); RJ11 (modem); VGA-out, Bluetooth,Built-in devices 1 x Type II PC Card slot
Network: Ethernet 10/100/1000, Wireless LAN 802.11a, 802.11b, 802.11g
Display: Graphics hardware Intel Graphics Media Accelerator 950, 224MB
Screen: 15.4 inch, TFT (widescreen) 1,280 x 800
Dimensions: 358 x 269 x 33.8 mm
Weight: w/battery 2.98 kg
Other: Disk Anti-shock protection, Quick charge (80% in 1hrs)

See Also

No comments: