"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects." (Robert A. Heinlein)

Saturday, 27 October 2018

Hard disk upgrading with Clonezilla

Some time ago my desktop computer welcomed me with an unpleasant message: the main hard drive was likely to fail soon.

When you receive similar messages you never know how soon “soon” means. Since disk drives prices are reasonably low I decided not to waste time, I so bought a new, bigger, hard drive to replace the faulty one.
Upgrading the computer main drive could be a time consuming business if done “by hand” since it means copying all system and user data. Fortunately many tools exist in the Linux world to ease the process, among them Clonezilla.


Clonezilla is a, very small foot-print, Linux distribution dedicated to disk and partition backup or cloning. I already used it once to backup EEEPC original Xandros installation. I downloaded Clonezilla ISO image and installed it on a SUB disk using Unetbootin. Because of its very small size I’ve been able to install Clonezilla on a old 1GB USB drive.
Before starting Clonezilla Iinstalled the new drive on my desktop PC together with the old one and partitioned it using Gparted.
At boot Clonezilla offer some boot options, I selected the default one
Then, once the system had started, after the long language and keyboard selection menu, I’ve been shown several options. I selected to work in a “device-device” mode then selected the “local partition-to-local partition” copy mode.
I proceeded with copying partition one from the old disk to partition one in the new disk, once completed I repeated with partition two.
At last I powered of the computer, removed the old faulty disk and left the new one in its place. I restarted the system but, the new disk didn’t boot.
After a while I figured I forgot that Clonezilla, when copying partition-by-partition, didn’t copy boot information. Not a big deal, once you understand it.
Eventually I started again the system using Clonezilla and, using command line interface, I installed GRUB on the new disk.
sudo mkdir /mnt/ubuntu
sudo mount /dev/sda1 /mnt/ubuntu
sudo grub-install --boot-directory=/mnt/ubuntu/boot /dev/sda
After this my computer started, working like before.
By the Way now I have a unreliable spare 500 GB hard disk, what could I use it for?