From owner-freebsd-questions Thu Jul 5 8:49:29 2001 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id A551137B403 for ; Thu, 5 Jul 2001 08:49:22 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.11.3/8.11.3) id f65FnIa08300; Thu, 5 Jul 2001 10:49:18 -0500 (CDT) (envelope-from dan) Date: Thu, 5 Jul 2001 10:49:17 -0500 From: Dan Nelson To: Bill Moran Cc: Dale Hagglund , freebsd-questions@freebsd.org Subject: Re: SCSI bad block remapping Message-ID: <20010705104917.A6471@dan.emsphone.com> References: <3B327713.46173EC5@iowna.com> <863d8curun.fsf@ponoka.battleriver.com> <20010704205514.A13653@dan.emsphone.com> <86pubfubp7.fsf@ponoka.battleriver.com> <3B4482DC.C3CF1B6C@iowna.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ikeVEW9yuYc//A+q" Content-Disposition: inline In-Reply-To: <3B4482DC.C3CF1B6C@iowna.com> User-Agent: Mutt/1.3.19i X-OS: FreeBSD 5.0-CURRENT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In the last episode (Jul 05), Bill Moran said: > Dale Hagglund wrote: > > Since this piqued my interest, I tracked down the horse's mouth. > > According to the the SCSI-3 Block Commands specification, when a > > REASSIGN BLOCKS command is issued the data contained in blocks > > being remapped may be modified. Also, the command can fail because > > it needs to remap a larger region than the one specified. However, > > from the documentation of AWRE and ARRE, it appears that blocks are > > reassigned automatically only if the drive firmware can recover the > > data. > > > > It looks like the upshot is that you can, as you suggested, turn on > > automatic sector remapping without fear of silent data loss. > > This is good to know. Thank you for taking the time to look into the > specs for us, Dan. Now that I know that it is safe to turn on sector (Dale?) > remapping, I still don't know _how_ to do it. I'm also still curious > about what's going on with a drive that crashes because of bad > sectors one day, and then (once reformatted) runs with no problems > for over a week (and still running ...) A couple years ago, I wrote a script to check the WCE bit of SCSI drives. Here's the same script modified a bit to check ARRE and AWRE, plus the original for good measure :) -- Dan Nelson dnelson@emsphone.com --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=awrecheck #! /bin/sh echo Checking SCSI drives for auto reallocation: numbad=0 # get a list of direct-access devices known to the system units=$(camcontrol devlist | sed -n -e "/,da[0-9]*/s/.*,da\(.*\))/\1/p") for i in $units do result="$(camcontrol modepage da$i -m 1 -P 3 2> /dev/null | grep '^A.RE .*: 0' )" if [ "$result" != "" ] ; then camcontrol devlist | grep ",da${i})" echo "$result" echo numbad=$(($numbad + 1)) fi done if [ $numbad -gt 0 ] ; then s= [ $numbad -ne 1 ] && s=s echo "\ $numbad device$s with ARRE or AWRE unset. To reset, run \"camcontrol modepage -e -P 3 -m 1\" where is the disk (i.e. da0), and set AWRE and ARRE to 1." else echo "All drives are OK" fi --ikeVEW9yuYc//A+q Content-Type: message/rfc822 Content-Disposition: inline Date: Wed, 14 Oct 1998 23:19:26 -0500 From: Dan Nelson To: Julian Elischer , "Justin T. Gibbs" Cc: Terry Lambert , Don.Lewis@tsc.tdk.com, freebsd-fs@FreeBSD.ORG, freebsd-scsi@FreeBSD.ORG Subject: Re: filesystem safety and SCSI disk write caching Message-ID: <19981014231925.A18446@emsphone.com> References: <199810140518.XAA15040@pluto.plutotech.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=HlL+5n6rz5pIUxbD X-Mailer: Mutt 0.94.3i In-Reply-To: ; from "Julian Elischer" on Wed Oct 14 11:08:05 GMT 1998 X-OS: FreeBSD 2.2.7-STABLE X-Keywords: X-UID: 1962 --HlL+5n6rz5pIUxbD Content-Type: text/plain; charset=us-ascii In the last episode (Oct 14), Julian Elischer said: > Hey everybody.. > look, we're in violent agreement here but haven't noticed it.... > > 7/ to allow for this to be achieved easily, there should be an easy > way to ensure that the write cache is turned off. Possibly as simple > as a good example in camctl.8 . I humbly submit the following script, to be added to /etc/security, or periodic/weekly, /etc/rc, or wherever. It's dependant on the exact output of "camcontrol inquiry" and "camcontrol modepage", but does the job. -Dan Nelson dnelson@emsphone.com --HlL+5n6rz5pIUxbD Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=cachecheck #! /bin/sh echo Checking SCSI drives for write-cache: numbad=0 # get a list of direct-access devices known to the system units=$(camcontrol devlist | sed -n -e "/,da[0-9]*/s/.*,da\(.*\))/\1/p") for i in $units do result=$(camcontrol modepage -m 8 -P 3 -u $i 2> /dev/null | grep WCE) if [ "$result" = "WCE: 1 " ] ; then camcontrol devlist | grep ",da${i})" numbad=$(($numbad + 1)) fi done if [ $numbad -gt 0 ] ; then s= [ $numbad -ne 1 ] && s=s echo " $numbad device$s with WCE set. To reset, run \"camcontrol modepage -e -P 3 -m 8 -u \" where is the disk number (i.e. da0 is unit #0), and set WCE to 0." fi echo --HlL+5n6rz5pIUxbD-- --ikeVEW9yuYc//A+q-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message