| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
echo "$@"|grep -- "--detail" &>/dev/null |
| 4 |
is_detail=$? |
| 5 |
|
| 6 |
echo "$@"|grep -- "--brief" &>/dev/null |
| 7 |
is_brief=$? |
| 8 |
|
| 9 |
echo "$@"|grep -- "--export" &>/dev/null |
| 10 |
is_export=$? |
| 11 |
|
| 12 |
if [ $is_detail -eq 0 ]; then |
| 13 |
cat <<EOF |
| 14 |
/dev/md/localhost:fedora: |
| 15 |
Version : 1.2 |
| 16 |
Creation Time : Fri Apr 29 12:46:43 2016 |
| 17 |
Raid Level : raid1 |
| 18 |
Array Size : 1047552 (1023.00 MiB 1072.69 MB) |
| 19 |
Used Dev Size : 1047552 (1023.00 MiB 1072.69 MB) |
| 20 |
Raid Devices : 2 |
| 21 |
Total Devices : 2 |
| 22 |
Persistence : Superblock is persistent |
| 23 |
|
| 24 |
Intent Bitmap : Internal |
| 25 |
|
| 26 |
Update Time : Thu Nov 3 16:55:14 2016 |
| 27 |
State : clean |
| 28 |
Active Devices : 2 |
| 29 |
Working Devices : 2 |
| 30 |
Failed Devices : 0 |
| 31 |
Spare Devices : 0 |
| 32 |
|
| 33 |
Name : localhost:fedora (some extra BS) |
| 34 |
UUID : b0a06aba:7e656e03:1faefab3:43f07c92 |
| 35 |
Events : 423 |
| 36 |
|
| 37 |
Number Major Minor RaidDevice State |
| 38 |
3 8 49 0 active sync /dev/sdd1 |
| 39 |
2 8 33 1 active sync /dev/sdc1 |
| 40 |
|
| 41 |
EOF |
| 42 |
elif [ $is_brief -eq 0 ]; then |
| 43 |
cat <<EOF |
| 44 |
ARRAY /dev/md/fedora metadata=1.2 UUID=b0a06aba:7e656e03:1faefab3:43f07c92 name=localhost:fedora |
| 45 |
EOF |
| 46 |
elif [ $is_export -eq 0 ]; then |
| 47 |
cat <<EOF |
| 48 |
MD_LEVEL=raid1 |
| 49 |
MD_DEVICES=2 |
| 50 |
MD_NAME=localhost:fedora |
| 51 |
MD_ARRAY_SIZE=1072.69MB |
| 52 |
MD_UUID=b0a06aba:7e656e03:1faefab3:43f07c92 |
| 53 |
MD_UPDATE_TIME=1478188514 |
| 54 |
MD_DEV_UUID=dcf43d12:e6159daf:82b81713:2f6f181c |
| 55 |
MD_EVENTS=423 |
| 56 |
EOF |
| 57 |
else |
| 58 |
cat <<EOF |
| 59 |
/dev/sdc1: |
| 60 |
Magic : a92b4efc |
| 61 |
Version : 1.2 |
| 62 |
Feature Map : 0x1 |
| 63 |
Array UUID : b0a06aba:7e656e03:1faefab3:43f07c92 |
| 64 |
Name : localhost:fedora (some extra BS) |
| 65 |
Creation Time : Fri Apr 29 12:46:43 2016 |
| 66 |
Raid Level : raid1 |
| 67 |
Raid Devices : 2 |
| 68 |
|
| 69 |
Avail Dev Size : 2095104 (1023.00 MiB 1072.69 MB) |
| 70 |
Array Size : 1047552 (1023.00 MiB 1072.69 MB) |
| 71 |
Data Offset : 2048 sectors |
| 72 |
Super Offset : 8 sectors |
| 73 |
Unused Space : before=1960 sectors, after=0 sectors |
| 74 |
State : clean |
| 75 |
Device UUID : dcf43d12:e6159daf:82b81713:2f6f181c |
| 76 |
|
| 77 |
Internal Bitmap : 8 sectors from superblock |
| 78 |
Update Time : Thu Nov 3 16:55:14 2016 |
| 79 |
Bad Block Log : 512 entries available at offset 72 sectors |
| 80 |
Checksum : e97a3b71 - correct |
| 81 |
Events : 423 |
| 82 |
|
| 83 |
|
| 84 |
Device Role : Active device 1 |
| 85 |
Array State : AA ('A' == active, '.' == missing, 'R' == replacing) |
| 86 |
EOF |
| 87 |
fi |