[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Replacing boot drive: how to make a copy of it?

Damon L. Chesser wrote:
Alan Chandler wrote:
On Sunday 03 September 2006 23:23, Marty wrote:
Marty wrote:
Kaspar Fischer wrote:
Hi list,

I need to replace my boot disk as it starts failing (with bad blocks).
What is the easiest way to obtain, on a new harddrive (at least as
large as the old one), an exact copy of the root file system and
swap partition?

Never touch a running system -- so my intention is to *copy* the
drive instead of installing a new Debian system.

Thanks and regards,
If for example you have two identical hard drives /dev/hda and
/dev/hdb, with your root partition on /dev/hda, and you don't have
any bad blocks on either drive, then you can make a perfect sector-
-by-sector mirror using "cp /dev/hda /dev/hdb"
Addendum: I posted in haste.  Having re-read your message, since your
case involves both bad blocks and non-identical drives, I would probably opt for rsync as described below after manually setting up the partitions on the target drive.

One other suggestion. If, before you make the copy you set up the new drive as a single element of a raid 1 raid array, then replace the failing disk and add the replacement in as the second element to this array, you will then have a permanent hot standby system.

That is something I have just done, although I have a separate boot partition, and you have to independently store the boot block on to both drives (I use grub - which is very easy).

There is some good articles on the web with step by step instructions - I can't locate them right now, but a bit of googling will find them

I have one such how to at www.damtek.com the direct url is http://www.damtek.com/2006/05/raid-and-boot-dir_07.html I wrote is specifically for helping me learn RHEL, but it works for Debian AFAIK. It will certainly walk you through duplication the grub MBR, so that you will boot even if you loose the HD that currently holds your MBR (assuming that /boot and your MBR are both on the same partition, ie NOT a dual boot system with windows on the first partition). I hope that will help.


In the OP's case, just make sure you do not make the failing HD part of a raid, you will loose all your data! If you go this route, like the above poster said, make the new HD a raid1, only one member and then copy the old HD data onto it. Just trying to be extra careful with someone else's data and avoid any misunderstanding.

Damon L. Chesser

Reply to: