Debian Raid 1 Recovery
  • Note: this is to guide you add a new hard drive,/dev/sdb.
  1. Step 1: find the failed disk or partition
    • Use following commands to check:
      • cat /proc/mdstat
  2. Step 2: Replace and prepare the hardware
    1. Shutdown the server and power it off.
    2. replace the failed disk.
    3. if the failed disk is /dev/sda, you need to
      • connect the working RAID disk (/dev/sdb) to /dev/sda
      • connect the new disk to /dev/sdb
    4. start the computer.
  3. Step 3: Copy partition table from /dev/sda to /dev/sdb.
    1. Run following command:
      • sfdisk -d /dev/sda | sfdisk /dev/sdb
    2. If there is an error, you try:
      • sfdisk -d /dev/sda | sfdisk —force /dev/sdb
  4. Step 4: Remove any remains of a previous RAID array from /dev/sdb
    1. Run following command to find the /dev/sdb partitions:
      • fdisk -l /dev/sdb
    2. Run following commands to remove previous RAID array from /dev/sdb:
      • mdadm —zero-superblock /dev/sdb1
      • mdadm —zero-superblock /dev/sdb5
      • mdadm —zero-superblock /dev/sdb6
      • mdadm —zero-superblock /dev/sdb7
      • mdadm —zero-superblock /dev/sdb8
      • mdadm —zero-superblock /dev/sdb9
      • mdadm —zero-superblock /dev/sdb10
  5. Step 5: Add /dev/sdb partitions into the RAID
    1. Run following commands to add the partitions to the RAID:
      • mdadm -a /dev/md0 /dev/sda1
      • mdadm -a /dev/md1 /dev/sda5
      • mdadm -a /dev/md2 /dev/sda6
      • mdadm -a /dev/md3 /dev/sda7
      • mdadm -a /dev/md4 /dev/sda8
      • mdadm -a /dev/md5 /dev/sda9
      • mdadm -a /dev/md6 /dev/sda10
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License