From: G M. <gmc...@bt...> - 2013-01-28 11:22:13
|
Yes, here is a script that uses the 3ware command line utility (tw_cli) to regenerate smartd.conf. #!/bin/bash # # Written by G. McAlister, January 28th 2013 # # Simple (i.e. not much error handling) script to build the smartd.conf file for a 3ware raid controller. # # The problem this script solves is that the vports assigned by the controller to each drive at boot time is not persistent # from one boot to the next, and smartd requires addressing the drives by their vport number, so the smartd.conf file # may (will?) have inconsistent drive addresses after each boot. # The solution here is to use the 3ware command line utility tw_cli to find the allocated vports and to build a fresh # smartd.conf file using them. # # This script must be run as root. # Set up the smartd.conf file. In production, this would, of course, go in the /etc directory. smartfile="smartd.conf" firstline="This smartd.conf file was automatically generated by the smart_3ware script" driveline="/dev/twa0 -d 3ware,x -a -o on -S on -R 5! -I 194 -I 9 -s(S/../.././01|L/../../6/01) -m gmc...@bt..." declare -a vports # Find the controller using "tw_cli show", find the line starting with "c" and return the first field of that line. c=$(tw_cli show | awk '/^c/ {print $1}') # Find the vports using the "show drivestatus" command of tw_cli # We want the lines beginning with "p" and a "drive status" of "OK". The first field of this line is the vport vports=( $(tw_cli "/$c" show drivestatus | awk '(/^p/) && ($2 ~ /^OK$/) {print $1}') ) nports=${#buff2[@]} # Save the old smartd.conf file if necessary if [ -e "$smartfile" ] then mv "$smartfile" "$smartfile".sav fi # Create the smartd.conf file, and add the first line touch "$smartfile" echo "$firstline" > "$smartfile" # For each vport, replace the ",x" in the driveline with the vport and add the line to the smartd.conf file for port in "${vports[@]}" do echo "$driveline" | sed s/,x/,$port/ >> "$smartfile" done exit 0 # # Ends I hope this may be useful for others with the same problem. -----Original Message----- From: Alex Samorukov [mailto:ml...@os...] Sent: 25 January 2013 22:29 To: G McAlister Cc: sma...@li... Subject: Re: [smartmontools-support] Problem with 3ware 9690SA RAID - SOLVED On 01/25/2013 07:13 PM, G McAlister wrote: > Hi, > It seems that the VPort changed after a reboot, so the drives that I > thought were causing a problem were actually empty VPorts. > > I can confirm that I can access all drives when I use the correct VPort. > > Now I need a robust way to ensure that the VPort specified in > smartd.conf is indeed the correct VPort for that drive, even after a reboot. I think you can regenerate smartd.conf on boot with some shell magic and 3ware utility. Correct fix should be to implement DEVICESCAN for 3ware, i can try to do this, but i will need hw access. ---------------------------------------------------------------------------- -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d _______________________________________________ Smartmontools-support mailing list Sma...@li... https://lists.sourceforge.net/lists/listinfo/smartmontools-support |