Skip to content

Instantly share code, notes, and snippets.

@breenie
Created July 11, 2017 11:44
Show Gist options
  • Select an option

  • Save breenie/5f91e2cd39fa1e42024db1c2c79b2821 to your computer and use it in GitHub Desktop.

Select an option

Save breenie/5f91e2cd39fa1e42024db1c2c79b2821 to your computer and use it in GitHub Desktop.
Repairing RAID 1 partitions
#!/usr/bin/env bash
pi@raspberrypi:~ $ sudo mdadm --create /dev/md2 --metadata=0.90 --raid-devices=2 --level=raid1 /dev/sda5 missing
mdadm: /dev/sda5 appears to be part of a raid array:
level=raid1 devices=2 ctime=Wed Feb 16 00:00:17 2011
Continue creating array? y
mdadm: array /dev/md2 started.
pi@raspberrypi:~ $ sudo mdadm --examine /dev/sda5
/dev/sda5:
Magic : a92b4efc
Version : 0.90.00
UUID : ba694bf5:d260853b:fe2970c7:3724fbef (local to host raspberrypi)
Creation Time : Tue Jul 11 11:24:52 2017
Raid Level : raid1
Used Dev Size : -1369434496 (2790.01 GiB 2995.75 GB)
Array Size : 2925532800 (2790.01 GiB 2995.75 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 2
Update Time : Tue Jul 11 11:24:52 2017
State : active
Internal Bitmap : present
Active Devices : 1
Working Devices : 1
Failed Devices : 1
Spare Devices : 0
Checksum : cc6d0ff9 - correct
Events : 1
Number Major Minor RaidDevice State
this 0 8 5 0 active sync /dev/sda5
0 0 8 5 0 active sync /dev/sda5
1 0 0 0 0 spare
pi@raspberrypi:~ $ sudo mdadm -A -R /dev/md2 /dev/sda5
mdadm: /dev/md2 has been started with 1 drive (out of 2).
pi@raspberrypi:~ $ sudo mdadm --examine /dev/sda5
/dev/sda5:
Magic : a92b4efc
Version : 0.90.00
UUID : ba694bf5:d260853b:fe2970c7:3724fbef (local to host raspberrypi)
Creation Time : Tue Jul 11 11:24:52 2017
Raid Level : raid1
Used Dev Size : -1369434496 (2790.01 GiB 2995.75 GB)
Array Size : 2925532800 (2790.01 GiB 2995.75 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 2
Update Time : Tue Jul 11 11:24:52 2017
State : active
Internal Bitmap : present
Active Devices : 1
Working Devices : 1
Failed Devices : 1
Spare Devices : 0
Checksum : cc6d0ff9 - correct
Events : 1
Number Major Minor RaidDevice State
this 0 8 5 0 active sync /dev/sda5
0 0 8 5 0 active sync /dev/sda5
1 0 0 0 0 spare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment