from dhelios.blogspot.com
Install scsi
yum install sg3_utils
To view the keys registered on a LUN use the following command:
$ sg_persist --in -k -d /dev/<DEVICE>
To view the reservations currently out on a device use the following command:
$ sg_persist --in -r -d /dev/<DEVICE>
Keys are 6 or 8 digit HEX numbers. Key numbers can be arbitrary. For example 0xDEADBEEF or 0x123ABC To register a key on a LUN use the following command:
$ sg_persist --out --register --param-sark=<KEY> /dev/<DEVICE>
You can take out a reservation on behalf of a key with the following command:
$ sg_persist --out --reserve --param-rk=<KEY> --prout-type=<TYPE> /dev/<DEVICE>
The reservation types are defined in the SCSI Primary Commands spec. Here are the reservation types from the sg_persist
manpage
1-> write exclusive
3-> exclusive access
5-> write exclusive - registrants only
6-> exclusive access - registrants only
7-> write exclusive - all registrants
8-> exclusive access - all registrants.
You can release a registration with this command:
$ sg_persist --out --release --param-rk=<KEY> --prout-type=5 /dev/<DEVICE>
You can unregister a key with this command:
$ sg_persist --out --register --param-rk=<KEY> /dev/<DEVICE>
You can clear the reservation and all registered keys with this command:
# sg_persist --out --clear --param-rk=<KEY> /dev/<DEVICE>
Comments
Post a Comment