Skip to contentSkip to conversation

Script for offsite storeage of RAID info needed for recovery

DISCUSSION Krzysztof Adamski 2 participants 2 messages May 4, 2012 – May 5, 2012 MD RAID

lore
Share & tools
lore
#0 lore raw

Reading about the heroic achievements of Neil to recover broken raids for people it is obvious that before a RAID has problems good info needs to be provided. Since usually that information is required after the fact, I'm looking for a script that I could run periodically on my computers that would collect all this info and send it someplace safe off-site.

Is there a script that I could run from cron that would collect all the needed info for a recovery of a broken raid and mail it off-site?

If there is nothing like that, then I can try writing it as long as I could get the list of commands that would give me all the needed info.

Thanks,
K

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hello, Krzysztof

I'm running the following little script as a cron job every night. It gives you:
1. the contents of /proc/mdstat
2. mdadm --detail for each md device listed in /proc/mdstat
3. mdadm --examine for each member device listed in /proc/mdstat

- -----8<----------8<----------8<----------8<----------8<----------8<----- #!/bin/sh

cat /proc/mdstat

for md in $( cat /proc/mdstat | grep '^md' | cut -d' ' -f1 | sort ); do

	echo
	mdadm --detail /dev/${md}
	echo

done

for d in $( cat /proc/mdstat | "grep" -o 'sd.\?[0-9]' | sort ); do

	echo
	mdadm --examine /dev/${d}
	echo

done
- -----8<----------8<----------8<----------8<----------8<----------8<-----

Of course, this could be extended by also listing the models and vendors of the component devices, but I've not done this for now.

I hope that helps,

Martin

Quoted 1 line · Krzysztof Adamski

[...]

- --
Get my public GPG key from pgp.mit.edu or wwwkeys.pgp.net Key ID: 0x177AFD7C
- --
Homepage: http://mwegner.net/
Powered by Gentoo Linux (http://gentoo.org/)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEAREKAAYFAk+kdpcACgkQxZfezBd6/XzyOwCfZ89Fr4XTE6+DNB0tygCJMQNP BrMAoJGktj1dDq9MBgxmSY/MPolWTWOH
=bBvQ
-----END PGP SIGNATURE-----