1

I recently was having trouble with a server randomly shutting down. I figured it was signs of disk failure, so I went about removing and swapping a drive from the raid 1 mdadm array.

There were two drives in the array like this:

NAME    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda       8:0    0 931.5G  0 disk  
├─sda1    8:1    0   7.5G  0 part  
│ └─md0   9:0    0   7.5G  0 raid1 [SWAP]
└─sda2    8:2    0 924.1G  0 part  
  └─md1   9:1    0   924G  0 raid1 /
sdb       8:16   0 931.5G  0 disk  
├─sdb1    8:17   0   7.5G  0 part  
│ └─md0   9:0    0   7.5G  0 raid1 [SWAP]
└─sdb2    8:18   0 924.1G  0 part  
  └─md1   9:1    0   924G  0 raid1 /

I did not know which drive would be faulty so I chose sdb. I removed sdb from both md0 and md1, and rebuilt the array on a new hard drive overnight.

mdadm /dev/md0 --fail /dev/sdb1 --remove /dev/sdb1
mdadm /dev/md1 --fail /dev/sdb2 --remove /dev/sdb2

[replace]

mdadm --add /dev/md0 /dev/sdb1
mdadm --add /dev/md1 /dev/sdb2

In the morning it turns out that the faulty drive was sda, and the server can no longer boot.

EDIT: I should point out that the rebuilt failed overnight and the new disk was not fully rebuilt.

How can I set up the drive I took out so that it thinks it is still part of the mdadm array? I have another linux computer on hand.

Your Answer

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

Browse other questions tagged or ask your own question.