Walkero

web developer, Drupal follower, Docker ninja, JS explorer, PHP believer, Amiga enthusiast, truth seeker, parent & husband... at least for now...

Yesterday I got a new hard disk for my trustful laptop. My HP laptop runs for more than three years, every day, for more than ten hours. As you can see it's a fully working computer. If you ask why I had to change the hard disk, the reasons are safety and speed. Safety, because you never know what might happen after all that time of daily work. Speed, because the new hard disk (Seagate Momentus XT Hybrid SSD 500GB) is almost twice as fast as the previous one (Toshiba MK3252GSX 320GB). I connected the new hard disk using SATA to USB converter.

The old hard disk has installed Linux Mint 12 which I like very much, including all the software I use. This has to be moved to the new hard disk and here it is how I managed to do it.

First of all I used GParted live cd, which helped me to copy the partitions from the Toshiba HD to the new Seagate. Although that the hard disks are not exactly the same in size, GParted can copy partitions and data, while you can change the partition size too. So, I kept my "boot", "root" and "swap" partitions exactly the same, but I increased the "home" partition to have all the spare space.

To copy the partitions using GParted is very easy. First of all you have to attach all the hard disks at the computer and boot with the GParted Live CD. When it starts up, it shows the window of GParted, viewing the first of the hard disks and it's partitions. From the select box at the top right corner you can change the currently using hard disk.

Choose the new hard disk and install "Partition Table" in it, from the menu. After that you can copy the partitions from the old hard disk to the new. The way to do that, is to activate the old hard disk, right click on the first partition and select "Copy" from the popup menu. Go now to the new hard disk, right click on the grey partition bar and select "Paste" on it. A window will come up where you can set up the size of the new partition. Do the same for all the partitions, one by one. When you copy all the partitions click "Apply" to perform this jobs. Lay back now, because it will take some time. For me the 320GB hard disk copied in around 200 minutes. Last thing to do is to activate the boot flag at the "boot" partition.

If you try to boot with the new hard disk you will see only a cursor at the top left corner blinking, which means that the Grub is not installed correctly. What you have to do is to install Grub and update it's configuration, and here is how you can do it.

Use your live CD of the linux Mint 12 to boot. Keep your new hard disk attached. Open a terminal and do the following.

Get root access

$ sudo su

Install the Grub v2 at the system

apt-get install grub2

Find the hard disk and partitions you have on your computer

fdisk -l

Mount the "root" partition of your new hard disk

mount /dev/sdb2 /mnt

Install the Grub at the new hard disk

grub-install --root-directory=/mnt /dev/sdb

Mount necessary folders of the new "root" hard disk. If you don't do that, the following commands will show errors

mount -o bind /dev /mnt/dev
mount -o bind /proc /mnt/proc
mount -o bind /sys /mnt/sys

chroot /mnt bash

sudo update-grub

After the above reboot your system with the new hard disk and this will boot just fine. At least it did for me.

#linux #linux mint
- 3 min read