Replace Failed HD

  • This assumes that sdb has failed, the active drive is sda  
  • Mark the drive as Failed
    • mdadm /dev/md0 --fail /dev/sdb3
    • mdadm /dev/md1 --fail /dev/sdb1
  • Remove the drive from RAID array
    • mdadm /dev/md0 --remove /dev/sdb3
    • mdadm /dev/md1 --remove /dev/sdb1
  • Create a new partitions for the new drive (sdb )
    • Method 1: Copy partition table from the good drive
      • sfdisk -d /dev/sda | sfdisk /dev/sdb
    • Method 2: Restore partition table from a backup file
      • sfdisk /dev/sdb < /backup/sdb.partition
    • Method 3: Create partitions manually
      • Show status of the good drive (sda) for reference
        • fdisk -l /dev/sda
      • Create a new partitions for the new drive (sdb )
        • Start fdisk /dev/sdb
          New Partition n
            Primary p
            Partition Number 1
            Start Cylinder 1
            End Cylinder 13
          New Partition n
            Primary p
            Partition Number 2
            Start Cylinder 14
            End Cylinder 144
          New Partition n
            Primary p
            Partition Number 3
            Start Cylinder 145
            End Cylinder 1044
          Partition Type t
            Partition Number 1
            RAID fd
          Partition Type t
            Partition Number 2
            swap 82
          Partition Type t
            Partition Number 3
            RAID fd
          Toggle boot flag a
            Partition Number 1
          Write and Exit w
  • Review the partition table of both drives
    • fdisk -l
  • Add RAID members
    • mdadm /dev/md0 --add /dev/sdb3
    • mdadm /dev/md1 --add /dev/sdb1
  • Check Rebuild Status
    • cat /proc/mdstat
  • After rebuild, create stage 1 grub on sdb
    • grub
    • find /grub/stage1
    • device (hd0) /dev/sdb
    • root (hd0,0)
    • setup (hd0)
    • quit