Confirming Flush Behavior on the System
You can tune your system's ZFS and flash storage flush behavior by updating the physical-block-size
and cache-nonvolatile
property values in the sd.conf
file. See Ensuring Proper Cache Flush Behavior for Flash and NVRAM Storage Devices.
The following sdpropcheck.sh
script enables you to confirm that the flush behavior you specified in sd.conf
is reflected for the specified disk on the running system:
#!/bin/ksh # # A script to check that cache-nonvolatile and physical-block-size properties in # sd.conf have been successfully applied to the specified disk that is handled by # sd(4D) driver. These sd.conf properties match the un_f_suppress_cache_flush # and un_phy_blocksize sd_lun structure elements on the running system, # respectively. # if [[ $# -ne 1 ]]; then echo "Compare the physical-block-size and cache-nonvolatile property values of a disk on a running system with the values specified in the sd.conf file." echo "Usage: $0 cXtYdZ" exit 1; fi # # Use the iostat output to obtain the device instance of a disk that uses the # sd driver. # sd=`iostat -x $1 2>&1 | grep sd | nawk '{print $1}' | sed s/sd//` printf "Values for %s on the running system:\n" $1 # # Use mdb to obtain the value of the sd_lun structure's un_phy_blocksize element # in decimal format, which is the form used by the associated physical-block-size # property value in sd.conf. # printf " - physical-block-size (un_phy_blocksize):" echo '*sd_state::softstate 0t'$sd' | ::print -H struct sd_lun un_phy_blocksize' \ | mdb --kernel | cut -d'=' -f 2- # # Use mdb to obtain the sd_lun structure's un_f_suppress_cache_flush element # value as a Boolean string (true or false), which is the form used by the # associated cache-nonvolatile property value in sd.conf. # printf " - cache-nonvolatile (un_f_suppress_cache_flush): " cache_nv=$(echo '*sd_state::softstate 0t'$sd' | ::print struct sd_lun \ un_f_suppress_cache_flush' | mdb --kernel | cut -d'=' -f 2-) if [ $cache_nv == 0 ]; then echo false else echo true fi # # Show the physical-block-size and cache-nonvolatile settings in the sd.conf # file. # echo "\nValue of the physical-block-size property in the sd.conf file:" grep "physical-block-size" /kernel/drv/sd.conf /etc/driver/drv/sd.conf echo "\nValue of the cache-nonvolatile property in the sd.conf file:" grep "cache-nonvolatile" /kernel/drv/sd.conf /etc/driver/drv/sd.conf
The sdpropcheck.sh
script uses the iostat
and mdb
commands to obtain configuration information about the disk that is controlled by the sd
driver.
The mdb
command obtains the values for the sd_lun
structure's un_phy_blocksize
and un_f_suppress_cache_flush
elements. These elements correspond to the physical-block-size
and cache-nonvolatile
properties in the sd.conf
file, respectively.
Note that the form of the structure element values differs from the sd.conf
property values. The un_phy_blocksize
element specifies a hexidecimal value rather than a decimal value. The un_f_suppress_cache_flush
element specifies a Boolean value rather than true
or false
.
The following sdpropcheck.sh
script output shows a block size of 512
and the cache flush value as false
. This output shows that neither the physical-block-size
property nor the cache-nonvolatile
property is set explicitly in the sd.conf
file, so the default values of these properties are used.
# ./sdpropcheck.sh c0t5000CCA02D101AD0d0
Values for c0t5000CCA02D101AD0d0 on the running system:
- physical-block-size (un_phy_blocksize): 512
- cache-nonvolatile (un_f_suppress_cache_flush): false
Value of the physical-block-size property in the sd.conf file:
Value of the cache-nonvolatile property in the sd.conf file:
If you set the physical-block-size
property value to 4096
and set the cache-nonvolatile
property value to true
, the sdpropcheck.sh
script produces the following output:
# ./sdpropcheck.sh c0t5000CCA02D101AD0d0
Values for c0t5000CCA02D101AD0d0 on the running system:
- physical-block-size (un_phy_blocksize): 4096
- cache-nonvolatile (un_f_suppress_cache_flush): true
Value of the physical-block-size property in the sd.conf file:
/etc/driver/drv/sd.conf:sd-config-list="ATA 2E256-TU2-510B00","disksort:false,
cache-nonvolatile:true, physical-block-size:4096";
Value of the cache-nonvolatile property in the sd.conf file:
/etc/driver/drv/sd.conf:sd-config-list="ATA 2E256-TU2-510B00","disksort:false,
cache-nonvolatile:true, physical-block-size:4096";