Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 need to upgrade a redhat server to RHEL 5.4 however it has a software raid mirror on it which I have never encountered before. The drives are /dev/sda and /dev/sdb and the mirror is /dev/md0. What I want to do is break the mirror, pull sdb for a backup if things go wrong, upgrade RHEL, test and if all is sweet put sdb back in to start mirroring again.

Here is what I was going to do:
1. Shutdown server
2. Pull sdb
3. Boot server
4. Upgrade RHEL (without touching partitions or filesystems)
5. Test
6. Drop server
7. Replug sdb
8. Boot server
9. Run raidhotadd /dev/md0 /dev/sdb

Will that work? Will the drive start mirroring the new system?

Similarly will I be able to swap sda with sdb if things go pear shaped to rollback?

Cheers :)

share|improve this question
up vote 2 down vote accepted

You should set the drive as faulty and remove it with mdadm before pulling it out, it's probably okay to just pull it, but it's better to put the drive to sleep before plugging it off IMO.

# where X is the partition number
mdadm --set-faulty /dev/md0 /dev/sdbX
mdadm --remove /dev/md0 /dev/sdbX

# put the drive to sleep
hdparm -Y /dev/sdb

now you can pull it out, do your upgrades, reboot etc.

After adding the drive, you must re-add it to the array to initiate resync. Since you marked sdb as faulty, it will be overwritten with data from sda after replugging.

mdadm --re-add /dev/md0 /dev/sdbX

You can check resync status in real time with

watch -n 2 cat /proc/mdstat

I'm not sure about switching the drives, you might have to destroy raid metadata on the drive that you want to become the source of resync

mdadm --zero-superblock /dev/sdbX)

halt the array, remove sda, insert sdb into sda slot, rebuild array setting drive 2 (previous sda, future sdb) as missing, after that - insert second drive and resync.

Good luck.

share|improve this answer
Thanks. Can I boot from a faulty raid device tho? If it is set to faulty and I remove sda and put sdb in slot 1, will it boot? Or will it fail on faulty raid device? – hamstar Oct 30 '09 at 4:24
Also should I run the command on only the partition or on whole drive. There are two partitions on the drives a swap and root. – hamstar Oct 30 '09 at 4:30
Run mdadm commands for partitions, hdparm is for the whole drive. You should be able to boot with configuration you've mentioned, it's software raid after all, comes at a relatively late stage in boot process, but I cannot give you my word for it. – Karolis T. Nov 6 '09 at 11:39

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.