Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've a linux server with 2 IDE HD & Raid (hda - hdb)

I've changed the "BAD" hdb with a new:

mdadm --fail /dev/md2 /dev/hdb3

mdadm --fail /dev/md0 /dev/hdb2

mdadm --fail /dev/md1 /dev/hdb1

mdadm --remove /dev/md1 /dev/hdb1

mdadm --remove /dev/md0 /dev/hdb2

mdadm --remove /dev/md2 /dev/hdb3

... change hdb .... fdisk the new hdb ..... and:

mdadm --add /dev/md1 /dev/hdb1

mdadm --add /dev/md0 /dev/hdb2

mdadm --add /dev/md2 /dev/hdb3

Now I need to rebuild the grub/mbr for new hdb

Is it the correct way?


root (hd0,0) <-- ???

setup (hd0) <-- ???



share|improve this question
up vote 2 down vote accepted

When the RAID array has finished to resync, run:

root (hd1,0) 
setup (hd1) 

Here there is a full howto.

share|improve this answer

Instead of using grub on each drive. You can just copy the mbr over.

To copy the MBR from sda into a file called /mbrbackup:

dd if=/dev/sda of=/mbrbackup bs=512 count=1

Now to restore the image to sdb

dd if=/mbrbackup of=/dev/sdb bs=446 count=1

MBR is divided into 3 sections

  1. Bootstrap . 446 bytes

  2. Partition table. 64 bytes

  3. Signature. 2 bytes

See for source.

share|improve this answer
Thanks for this howto! – SmV Oct 5 '10 at 15:34
It is trivial to use grub when you have two disks but it is a nuisance when you have 16 or more disks, and this copying approach is much quicker in those situations. The only thing to be careful of is not to copy the empty MBR over the good MBR. It can easily happen if you don't pay attention. – Richard Holloway Oct 5 '10 at 15:45

Will this work?

dd if=/dev/sda of=/dev/sdb bs=446 count=1
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.