Raid-1 installation & recovery start

How to start with raid-1, by musznik.

  • * You neeed separate ext2 /boot partition – easest way is to add pendrive or third disk with that mount point
  •  /boot partition should be on stable ground, connect hdd to sata-1 input! to prevent from disk name change after failure.
  1. create software raid druing debian installation
  2. create exactly same partitions on /dev/sdc1 and /dev/sdd2 (disk one and two)
  3. assign proper mount point to raid partitions (/ for /dev/md0, /var for /dev/md1 etc)
  4. create small partition for /boot on external drive (additional hdd or usb)
  5. assign grub to partition where is /boot
  6. thats is..

ok? but my one disk fail! how to start with one disk in raid-1 on debian?

  1. grub cannot start system, but it still able to load linux kernel (ufff) from external /boot partition
  2. you can run system on one disk using below procedure
    1. stop all md* devices
      [code]mdadm –stop /dev/md*[/code]
    2. recreate raid-1
      [code]mdadm –assemble –scan[/code]
    3. we need “mkconf” command from /usr folder
      1. ​find partition where is /usr
      2. mount that folder
        [code]mkdir /tmp/help
        mount -t ext4 /dev/md0 /tmp/help[/code]
      3. backup current configuration and create new one
        [code]mv /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf.old
        /tmp/help/usr/share/mdadm/mkconf > /etc/mdadm/mdadm.conf[/code]
  3. prepare new disk
    1. create exactly same partition size as working hdd (you can use degradated disk with old data, which was removed for test?)
    2. using this command
      [code]sfdisk -d /dev/sda > sfdisk /dev/sdb[/code]
    3. associate new hdd with raid-1
      [code]mdadm –manage /dev/md0 –add /dev/sdb1
      mdadm –manage /dev/md1 –add /dev/sdb5
      mdadm –manage /dev/md2 –add /dev/sdb6[/code]
    4. and so one…
    5. watch rebuilding process
      [code]watch -n 1 cat /proc/mdstat[/code]

 

There might be problem with SWAP partition. First stop whole swap (swapoff) or just restart system.