Cloning Boot Hard Drive - How I Installed a New Replacement Hard Drive

So, I just replaced my openSUSE boot hard drive. I thought I would outline the process and procedures I used which was successful. What I would like to know is, could I have done this another way or done it in a better way? I would like to hear from you if you were able to replace your booting openSUSE hard drive and you did not need to reinstall openSUSE to make it work.

I decided I wanted to replace my hard drive in the least amount of time with the least amount of work. This often means buying some product to do the task, but what product might that be that could work with ext4 partitions? After doing some searching I found a program called HDClone. They actually have a free product you can download but, after trying it out, it told me it was going to take 8 hours to complete the copy. Not yet knowing any better, I decided to buy the Standard version of the product for $50 US with product download and product code sent by email. The standard product did work AND took about 20 minutes to clone a 500 GB hard drive (SATA) to a 600 GB connect to USB. I did take a chance here as I did not want to wait long enough to see if the free product would have worked. I suspect an all internal copy might have went even faster. Here is the link to the HDClone product site.

Miray Software - HDClone - Hard disk copy, hard disk backup, hard disk rescue!

So I used the HDClone product and it did copy and expand all data to the new hard drive. The hard drive to be cloned contained three partitions, SWAP, / (ext4) & /home (ext4). The / root partition was marked active and bootable and the MRB contained generic boot code. The cloned boot drive was identical after the cloning process except the two ext4 partitions where increased in proportional size to the larger hard drive size (done in Automatic clone mode).

After installing the new hard drive in place of the old one, the drive did boot, but openSUSE did not load and the kernel stopped working with many errors. So, I next booted from a GParted boot disk and mounted the / root partition which was generically called /dev/sdb2. I determined that I needed to modify the /boot/grub/device.map, /boot/grub/menu.lst & /etc/fstab files and I had to insert the /dev/sdb2 or /dev/sdb for device.map, so that the new hard drive, which did not have the same uid name as the old drive, could boot openSUSE properly. Once I made these changes, the new drive did boot and openSUSE did come up.

Finally, I opened the YaST / Partitioner in openSUSE and determined the correct UID for the newly installed hard drive and once again I modified the device.map, menu.lst file and fstab files to use the new UID in every place it was refereed to. I rebooted one more time just to make sure all was working and it was.

So what do you think? Was this the best way to do this? Would you have spent $50 to buy such a program or was I crazy to do so? In the end, it too me 45 minutes total time to make the changes required including using HDClone. It took me almost half of that time just to write this message. I would love to her your comments about my adventure in hard drive cloning.

Thank You,

Hi,

Good work but at a price.

I moved the whole works, / directories and /home, to a new HDD using the article as a guide, found via google, “Moving Your Linux Root Partition” Mon, 04/30/2007 - 22:11 — johnk. This article is written for Ubuntu so care was taken when modifying the GRUB files for openSUSE.

Yast - Partitioner was used to clone the IDE drive to the SATA drive. This set up 3 partitions on the new drive but Yast would not allow a resize, as ext4. The swap part was left intact and the other two partitions deleted and two new partitions made to occupy the available space. The new partitions were formatted, ext4, but not mounted via FSTAB at this time.

After reboot /home directory was copied to partition3. Yast-Partioner changed to mount the new /home and deselected the old. Yast-Boot Loader was used to change the GRUB files to recognise the new partition3.

After reboot and verification that the new /home was accessible and running correctly. The other / directories were copies to the new partition2. Again Yast - Partitioner was used to mount the new / directories and again Yast-Boot Loader was used to change the GRUB files to recognise the new partition2. The GRUB files were copied from the old to new HDD.

At this reboot the system was still using the MBR of the old HDD but the new HDD for / and /home directories. Again using Yast – Boot Loader the GRUB files where changed to point only to the new HDD. With these changes made Yast – Bootloader “Propose new configuration” was used and accepted. Yast then generated the MBR and new initrd on the new HDD.

GRUB files => /boot/grub/device.map, /boot/grub/menu.1st and /etc/grub.conf.

After verifying all was in order after the next reboot the old HDD was removed from the system on the next power down.

Note:

  1. grub-install is not supported by openSUSE11.3 hence the use of Yast modules.
  2. Doing a new install on the new HDD would have been easier and quicker than implementing the above. This was just an academic exercise to see if it was possible.
  3. No responsibility accepted for errors or omissions.

The above was on a 3 year old machine,
Mainboard MS-7293, intel Core 2 Duo, Radeon X1650 Pro, openSUSE11.3, kde 4.5.0.

Hello keellambert. Thanks so much for the great detail. I think that my thoughts on this overall thread was to let others know what was really involved to replace a working bootable hard drive with another, while everything is still working. I do think I would have most likely went the new install route as opposed to the trouble you went through just as you suggest. Still, one needs to know that anything is possible and that you do not have to spend $50 to make this work either. Great to hear of this successful adventure in duplicating your old hard drive to a different one.

Thank You,

Hi jdmcdaniel3,

omission

motherboard bios had to be changed before final reboot to select new SATA drive as boot device.

some time may have been saved if bios boot HDD preference had initially been set to

  1. new SATA drive
  2. old IDE drive

I had to clone my HDD twice quite recently. The reason was that I had to re-format my drive. This meant copying everything to another drive, then reformat, then copying everything back. (See iowait slows system down post #17).

As far as I can remember I did manual partitioning using gparted, then mkfs, then rsync to copy everything, then manual tweaking of menu.lst, fstab …, then manual install of grub. No additional dedicated tool was ever used.

Thanks vodoo for your comments. I have had to kind of do this when I managed to corrupt the main boot drive. By that I mean I did recover (by coping it somewhere else and then back again as you did) my /home area, but I did reinstall openSUSE. The last time was after a power supply went bad with openSUSE running. No matter what you do though, if the hard drive has the same UID, the issues are somewhat reduced on file editing. As you indicate, it is imperative to keep the GParted Boot disk around and I keep the openSUSE KDE Live CD ready as well. You can’t wait till you need these disks and then be unable to download and make them.

keellambert you are correct to mention the need to look at your BIOS settings if you replace a hard drive. In my case, I moved the new hard drive to the same exact connection as the one I replaced (which was an external eSATA drive) and the BIOS saw the new drive name, but still had it set as the boot drive. I guess this happened because it was plugged into the exact same connection. So I did go into BIOS setup to look, but there was nothing to do as it was still set to boot the drive as before.

Thank You,