1

I have a software RAID 1 setup on CentOS 6.9 with two HDDs (SDA & SDB). SDB's smart self-test began throwing errors this week:

Device: /dev/sdb [SAT], Self-Test Log error count increased from 0 to 1

Thus, this morning I set it to a failed state using mdadm and removed SDB and inserted a new HDD. The commands I ran are:

smartctl --all /dev/sdb
cat /proc/mdstat 
mdadm --manage /dev/md1 --fail /dev/sdb1
mdadm --manage /dev/md1 --remove /dev/sdb1
mdadm --manage /dev/md5 --fail /dev/sdb5
mdadm --manage /dev/md5 --remove /dev/sdb5
mdadm --manage /dev/md3 --fail /dev/sdb3
mdadm --manage /dev/md3 --remove /dev/sdb3
mdadm --manage /dev/md2 --fail /dev/sdb2
mdadm --manage /dev/md2 --remove /dev/sdb2
cat /proc/mdstat 
shutdown -h now

The top command allowed me to see the HDDs Serial number to ensure I pulled the correct drive.

After putting a new drive in the servers BIOS simply give me an error (along the lines of) install a proper boot device and restart the machine.

My assumption is that (somehow) I mistakenly only had the MBR on SDB (only a guess). Thus, it will not boot with SDB removed. I tried putting SDB back into the machine and it just clicks (of course) and gives me the same error of install a proper boot device and restart.

Can anyone make any suggestions on how to get this machine to boot so that I can recover all of my data? SDA should still be a good HDD. Further, if there is a way to boot from SDA then I should be able to install a new SDB and allow the software RAID to sync.

UPDATE:

Thanks to RalfFriedl I have the server booted from a LiveCD.

I have used:

sfdisk -d /dev/sda | sfdisk --force /dev/sdb

to partition the new SDB just like SDA.

Thanks!

2

It's a good idea to make sure both drives can boot while they both still work. Unfortunately, many installers don't do this right.

As your other disk doesn't boot, you need a live or rescue CD. If you have the proper infrastructure in place, you can also boot from network. Once your rescue system is running, create a partition table on the new drive matching the old one and add the partitions to the RAIDs. If you have the time, wait for the arrays to sync. Otherwise start with your boot partition. Now do a bind mount on dev, proc and sys, chroot to your root partition and reinstall the boot loader.

This is what I use for such cases

mount /dev/md/root /mnt
for i in /dev /proc /sys; do mount --bind $i /mnt$i; done
chroot /mnt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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