[CentOS] hard drive failing in linux raid

Adriano Frare alfrare at e-alinux.com
Wed Nov 8 01:51:02 UTC 2006

I tested RAID 1 with differents size hard disk , it is work.

You need first, execute command sfdisk -l /dev/hd_GOOD > partitions.txt
Second execute command sfdisk /dev/hd_NEWDISK < partitons.txt.

After recover process normal RAID recover.

I hope to help you

Adriano Frare

Aleksandar Milivojevic wrote:
> Joseph Cheng wrote:
>> Hello all. I have a server with a linux software raid1 setup between
>> two drives of the same model....one hard drive as primary ide master
>> and second hard drive as secondary master. Now primary master hard
>> drive is displaying a lot of SMART errors so I would like to remove it
>> and replace with another drive....different brand but same size.
>> Partitions are /dev/md0 till /dev/md5. I think I know what to do based
>> on mdadm man page and this list's archives but there is no harm in
>> confirming right? ;) From this post
>> http://lists.centos.org/pipermail/centos/2006-April/063076.html I plan
>> on removing the old partitions from the array like this..... mdadm
>> /dev/mdx -r /dev/hdax. Then I will shut down the server, replace the
>> hard drive, make the server boot from second IDE drive and hopefully
>> boot into Centos. From there do I have to manually create each
>> /dev/mdx partition and then re-add them like this....mdadm /dev/mdx -a
>> /dev/hdax ? That is what I am not sure about whether I have to
>> partiton the drive exactly like the old one or if Centos mdadm can do
>> some magic for me with a blank drive. TIA!!
> Couple of things to watch out.
> What boot loader are you using?  If it is Grub, check if it was 
> installed on partition, not in MBR of first drive.  If it was in MBR, 
> there is a good chance you don't have it mirrored on second drive. 
> You'll need working boot loader (most likely Grub) on second drive in 
> order to boot from it.
> Disk size...  It is next to impossible to find "different brand but same 
> size".  If the label says 80GB, it means "somewhere around 80GB".  You 
> want to look at LBA count (it's printed almost on all hard drives, but 
> often hard to find in specifications).  It's basically the number of 
> sectors that the drive has.  You want the drive that has at least the 
> number of sectors as your existing drive(s).  If you already got the new 
> drive and it is few sectors short, all is not lost.  You'll just have a 
> bit of additional work.  You'll need to shrink some partition.  Swap 
> partition is usually good candidate since it doesn't contain any data. 
> You can also shrink a partition that holds file system, but if you make 
> mistake you might end up loosing some data.  Another thing to keep in 
> mind when shrinking partitions is that Linux stores RAID metadata at the 
> end of the partition.  If you are shrinking partition that holds Linux 
> RAID device, the best thing (if it was RAID 1 volume) is to ditch the md 
> device for it, shrink the file system to smaller size, and recreate md 
> device.  Your data should survive the operation.  When shrinking file 
> system, have in mind you'll need to have some extra space of RAID 
> metadata information at the end of partition (you'll need to shrink file 
> system to be smaller than the final partition size).
> You'll need to partition the new drive manually.  Remember to tag 
> partitions as "Linux raid autodetect" (by default fdisk will tag them as 
> "Linux").  Tag for Linux raid autodetect is fd.  New partitions must be 
> the same size (in blocks) as the partitions you are replacing or larger. 
>  If you make them larger, the extra space will be unused.
> If your boot loader was installed in the partition, it'll get mirrored 
> automatically.  If it was in MBR, you'll have to install it by hand onto 
> the drive you just replaced.
> The rest should more or less go smooth.
> ------------------------------------------------------------------------
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos

More information about the CentOS mailing list