|
To enable the write cache you can use the
format(1M)
command:
i_like_corruption# format -e
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t0d0
/pci@1c,600000/scsi@2/sd@0,0
1. c0t1d0
/pci@1c,600000/scsi@2/sd@1,0
Specify disk (enter its number): 1
selecting c0t1d0
[disk formatted]
/dev/dsk/c0t1d0s0 is in use by zpool zfs_tar. Please see zpool(1M).
FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
repair - repair a defective sector
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
inquiry - show vendor, product and revision
scsi - independent SCSI mode selects
cache - enable, disable or query SCSI disk cache
volname - set 8-character volume name
! - execute , then return
quit
format> cache
CACHE MENU:
write_cache - display or modify write cache settings
read_cache - display or modify read cache settings
! - execute , then return
quit
cache> write
WRITE_CACHE MENU:
display - display current setting of write cache
enable - enable write cache
disable - disable write cache
! - execute , then return
quit
write_cache> display
Write Cache is disabled
write_cache> enable
write_cache> display
Write Cache is enabled
write_cache> q
Now, of course, be careful when you do this as data corruption can happen!
It was nice for me to do this as i was taking a simple v20z with a single SCSI disk to run some prelim specSFS numbers, and the write cache will mitigate (somewhat) the synchronous writes/commits. Of course you need much more than a single SCSI disk to get real specSFS numbers.
Or if you want to be snazier,
Neil
wrote a script to do this:
i_like_corruption# write_cache display c0t1d0
Write Cache is disabled
i_like_corruption# write_cache enable c0t1d0
Write Cache is enabled
i_like_corruption# write_cache display c0t1d0
Write Cache is enabled
i_like_corruption#
Here's the script:
#!/bin/ksh
#
# issue write cache commands to format(1M).
# commands can be to individual disks or all disks.
#
# usage: write_cache [-v] display|enable|disable all|
# E.g.:
# write_cache disable all
# write_cache -v enable c2t1d0
id=`id | sed -e 's/uid=//' -e 's/(.*//'`
if [ $id != "0" ] ; then
printf "No permissions"
exit 1
fi
# tmp files
cmds=/tmp/write_cache_commands.txt.$$
disks=/tmp/all_disk_list.txt.$$
silent=-s
if [ "$1" = "-v" ] ; then
# in verbose mode turn off silent format option
silent=
shift
fi
cat > $cmds << EOF
cache
write_cache
$1
EOF
if [ "$2" = "all" ]; then
echo disk | format 2>/dev/null | fgrep ". c" \
| nawk '{ print $2 }' > $disks
for i in `cat $disks`
do
format -e $silent -f $cmds $i 2>/dev/null
if [ "$silent" = "-s" ]; then
# print write cache state using recursion
printf "%s : " $i
write_cache -v display $i | fgrep "Write Cache is"
fi
done
else
format -e $silent -f $cmds $2
if [ "$silent" = "-s" ]; then
# print write cache state using recursion
write_cache -v display $2 | fgrep "Write Cache is"
fi
fi
rm -f $cmds $disks
Oh yeah, make sure its in your PATH. It can be run like this:
hodur# write_cache enable c4t2d0
Write Cache is enabled
hodur# write_cache disable c4t2d0
Write Cache is disabled
hodur#
(2006-08-04 10:31:28.0/2006-02-01 11:49:46.0)
Permalink
Trackback: http://blogs.sun.com/erickustarz/en_US/entry/enabling_the_write_cache
|