Linux » Man Pages
find in page
sgmodetool - display and edit Mode Pages for SCSI, Fibre Channel
devices accessed using the Linux SG subsystem.
sgmodetool [-D] [-B Byte from Start of Page] [-P Page No.] [-F Ref.
Field No.] [-V New Field/Byte Value] [-o Output LogFile] -d Device
sgmodetool is an interactive utility for scsi disks accessed using the
Linux SG driver. It sends a Mode Sense(6) command to the device to get
the modepages, displays them in a tabular format, allows the user to
change various fields in those pages and then sends a Mode Select(6)
command to the device to save the changed modepages. More information
about the Mode Sense(6) and Mode Select(6) commands can be found in the
SCSI Primary Commands-2 (SPC-2) reference documents.
In the interactive mode sgmodetool is invoked with the -d devicename
option. A logfile to store modepage modifications should also be spec-
ified using the -o logfile option. For example :
sgmodetool -d /dev/sg3 -o target3.log
If a logfile is not specified, modepage changes are stored in sgmod-
etool.log in the current working directory of the user. The logfile is
intended to facilitate the user to make the same change on multiple
devices (all supporting the modepages being edited). For example
(assuming the logfile is target70.log):
sh target3.log /dev/sg4
will copy the modepage changes made on /dev/sg3 to /dev/sg4.
-P Page No.
specifies the number of the modepage to be edited. Both decimal
and hex values (preceded by 0x) are acceptable.
-F Ref. Field No.
Specifies the Reference no. of the modepage field being edited.
Cannot be used with the -B option. Both decimal and hex values
(preceded by 0x) are acceptable.
The new value to be placed in the specified field/byte of the
page. Both decimal and hex values (preceded by 0x) are accept-
-B Byte No.
Specifies the byte no. from the start of the page. Bytes are
numbered starting from 0 and include the bytes forming the page
header. This option cannot be used with the -F option. Both
decimal and hex values (preceded by 0x) are acceptable.
-D Load Default Values. This option changes the current values in
the modepage ( specified using -P ) to their default values.
In the interactive mode an invalid choice results in the default option
(specified in ) being chosen. For example :
Do you wish to modify this ModePage (y/n) ? [n] :
Any keystroke other than 'y' or 'Y' will result in 'n' being chosen.
Modepage changes can result in loss of system data and this facility
ensures that the user is fully aware of the changes being made.
1) sgmodetool -P 0x1 -F 16 -V 0x1024 -d <device>
In this example Field 16 (in the tabular representation) of Page 1 gets
changed to 0x1024.
2) sgmodetool -P 0x1 -B 16 -V 0x24 -d <device>
In this example the 16th byte of Page 1 gets changed to 0x24.
3) sgmodetool -P 0x1 -D -d <device>
In this example the current values of ModePage 1 are changed to their
/dev/sg* - the Linux SG driver device
This command is normally usable only by the superuser, because the
standard permissions of the devices in /dev restrict access to other
Enable Write Caching
sgmodetool can be used to set the Write Cache Enable (WCE) bit on scsi
or fibre channel drives. To enable write caching on these drives, the
following command line can typically be used :
sgmodetool -P 0x8 -F 8 -V 0x1 -d <device>
This command line assumes that the drive implements Modepage 8 (Caching
Parameters). The WCE bit is the 8th field (in the tabular representa-
tion) of Page 8.
If your drive does not implement Modepage 8, please refer to it's docu-
mentation to find an alternate location for the Write Cache Enable bit.
Output converted with
what's new |