Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jun 2002 11:32:59 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        "Brian T.Schellenberger" <bts@babbleon.org>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Write-cache control for SCSI?
Message-ID:  <20020613163259.GA37481@dan.emsphone.com>
In-Reply-To: <20020613112509.C3E78BB2C@i8k.babbleon.org>
References:  <20020613112509.C3E78BB2C@i8k.babbleon.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--+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 <device> -e -P 3 -m 8\"
where <device> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020613163259.GA37481>