# Query health of Dell RAID?



## raVen (Dec 6, 2011)

I have:


```
da0 at mpt0 bus 0 scbus0 target 0 lun 0
da0: <Dell VIRTUAL DISK 1028> Fixed Direct Access SCSI-5 device
da0: 300.000MB/s transfers
da0: Command Queueing enabled
da0: 571180MB (1169777847 512 byte sectors: 255H 63S/T 72815C)
```

Any ideas how can I query health of this RAID and rebuild it if disk replaced? My system is FreeBSD 8.2p1/amd64. Thanks.


----------



## butcher (Dec 7, 2011)

See mptutil(8).


----------



## Terry_Kennedy (Dec 8, 2011)

raVen said:
			
		

> Any ideas how can I query health of this RAID and rebuild it if disk replaced? My system is FreeBSD 8.2p1/amd64. Thanks.


In addition to on-demand mptutil runs, you could add a script in /usr/local/etc/periodic/daily to get this info in the nightly report. I modified the 406.status-3ware script, thusly:


```
#!/bin/sh
#
# From:
# $FreeBSD: src/etc/periodic/daily/406.status-3ware,v 1.1.2.1 2006/03/08 22:56:28 brueffer Exp $
#

# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/periodic.conf ]
then
    . /etc/defaults/periodic.conf
    source_periodic_confs
fi

case "$daily_status_mpt_enable" in
    [Yy][Ee][Ss])
	echo
	echo 'Checking status of mpt(8) devices:'
	echo
	/usr/sbin/mptutil show volumes
	echo
	/usr/sbin/mptutil show drives

	rc=0
	;;

    *)  rc=0;;
esac
```

Enable with this line in /etc/periodic.conf:


```
daily_status_mpt_enable="YES"
```

And test it (make sure the script is marked executable):


```
(0:151) new-gate:/tmp# /usr/local/etc/periodic/daily/409.status-mpt 

Checking status of mpt(8) devices:

mpt0 Volumes:
  Id     Size    Level   Stripe  State  Write-Cache  Name
     0 (  278G) RAID-1          OPTIMAL   Enabled   

mpt0 Physical Drives:
   0 (  279G) ONLINE <WDC WD3000HLFS-0 4V02> SATA bus 0 id 1
   1 (  279G) ONLINE <WDC WD3000HLFS-0 4V02> SATA bus 0 id 9
(0:152) new-gate:/tmp#
```


----------



## AndyUKG (Dec 8, 2011)

You can also just check:

`sysctl dev.mpt.0.nonoptimal_volumes`

Rebuild will normally happen automatically,

thanks Andy.


----------

