Jun 16 2009

mdadm软raid1恢复过程

Category: 技术ssmax @ 14:27:50

把坏了的硬盘拔下来,换一个一样大小的上去(不一样也行,自己fdisk去。。)

1、

sfdisk -d /dev/hda > p.hda

获取好的硬盘(hda)的分区表。

2、

sfdisk /dev/hdc < p.hda

把新的硬盘(hdc)按hda的格式分区。

3、

mdadm /dev/md0 -a /dev/hdc1

mdadm /dev/md1 -a /dev/hdc2

把hdc的各个区重新挂在到md各个区上,然后就会自动rebuilding

 

mdadm –detail /dev/md1
/dev/md1:
        Version : 00.90.03
  Creation Time : Tue Jun 16 04:34:12 2009
     Raid Level : raid1
     Array Size : 8675008 (8.27 GiB 8.88 GB)
  Used Dev Size : 8675008 (8.27 GiB 8.88 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 1
    Persistence : Superblock is persistent

    Update Time : Tue Jun 16 13:36:08 2009
          State : clean, degraded
 Active Devices : 1
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 1

           UUID : 8a120f41:7d361001:89682acf:84cae7b6
         Events : 0.6

    Number   Major   Minor   RaidDevice State
       0       3        2        0      active sync   /dev/hda2
       2      22        2        1      spare rebuilding   /dev/hdc2

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.