Date: Wed, 14 Oct 1998 23:19:25 -0500 From: Dan Nelson <dnelson@emsphone.com> To: Julian Elischer <julian@whistle.com>, "Justin T. Gibbs" <gibbs@plutotech.com> Cc: Terry Lambert <tlambert@primenet.com>, 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> In-Reply-To: <Pine.BSF.3.95.981014105142.2872Q-100000@current1.whistle.com>; from "Julian Elischer" on Wed Oct 14 11:08:05 GMT 1998 References: <199810140518.XAA15040@pluto.plutotech.com> <Pine.BSF.3.95.981014105142.2872Q-100000@current1.whistle.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <unit>\" where <unit> is the disk number (i.e. da0 is unit #0), and set WCE to 0." fi echo --HlL+5n6rz5pIUxbD-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19981014231925.A18446>