Archives April 19, 2012

Thursday, 19th April 2012 - 12:54:30

bin/bash

I have been messing around with the home server. A disk has died.

Handy summary of all the mdraid devices in your machine:

driveinfo.sh:
#!/bin/bash
for q in `find /dev/ -name md\* | sort`; do echo $q:; mdadm --detail $q | grep -E "/dev/s|Array Size|Raid Level"; echo; done > driveinfo.txt;
grep "/dev/sd" driveinfo.txt | awk '{print $7}' | xargs hdparm -i | grep -E 'dev|Model' | awk '{print $1" "$6}' >> driveinfo.txt;
mail -s "mdraid info" [your email] < driveinfo.txt

This machine is a modifed intel server. Because it does not have the hotswap chassis installed with nice numbering and fixed IDs, its hard to keep track of the drives (there are 10). The idea of this is to send the info across via email so that I can look at it on my mobile or other computer while the server is down.