From owner-freebsd-questions Thu Jun 13 9:36: 7 2002 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 EAE2A37B40C for ; Thu, 13 Jun 2002 09:35:57 -0700 (PDT) Received: (from dan@localhost) by dan.emsphone.com (8.12.3/8.12.3) id g5DGWx1F056821; Thu, 13 Jun 2002 11:32:59 -0500 (CDT) (envelope-from dan) Date: Thu, 13 Jun 2002 11:32:59 -0500 From: Dan Nelson To: "Brian T.Schellenberger" Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Write-cache control for SCSI? Message-ID: <20020613163259.GA37481@dan.emsphone.com> References: <20020613112509.C3E78BB2C@i8k.babbleon.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="+QahgC5+KEYLbs62" Content-Disposition: inline In-Reply-To: <20020613112509.C3E78BB2C@i8k.babbleon.org> User-Agent: Mutt/1.3.99i X-OS: FreeBSD 5.0-CURRENT X-message-flag: Outlook Error 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 --+QahgC5+KEYLbs62 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In the last episode (Jun 13), Brian T.Schellenberger said: > I know that ATA device control write cache with > > sysctl hw.ata.wc > > but what do I use to control/check write caching with the a SCSI device? Caching is a per-device setting stored on the drive itself; you only need to set it once, and the drive will remember it forever. I've attached a script that will check all the SCSI disks on your system and warn you if WCE is enabled. > (And, for that matter, DMA -- or does that not apply to the SCSI world?) DMA is purely a matter between the motherboard and the SCSI card, and unless you're running a 10-year-old ISA Adaptec 1520, is always used. -- Dan Nelson dnelson@allantgroup.com --+QahgC5+KEYLbs62 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[0-9]*\)).*$/\1/p") for i in $units do if camcontrol modepage $i -m 8 -P 3 2> /dev/null | grep -q "WCE:.*1" ; then camcontrol devlist | grep "(.*$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\" where is the disk name (i.e. da0), and set WCE to 0." fi echo --+QahgC5+KEYLbs62-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message