Asking for the LUN size is a SCSI operation, not an iSCSI operation. You need a SCSI command to continue. In general, the disk-level utilities such as format and fdisk will send the required SCSI commands for you.

For digging deeper at your own risk, opensolaris includes the sg3_utils family of SCSI utilities. These utilities allow access to internal levels of SCSI support. Since you are accessing the SCSI level outside of the control of the initiator OS, these utilities can cause data corruption if used improperly. But they can also be very useful in interrogating and understanding the SCSI capabilities of different kinds of SCSI targets.

In particular, the sg_readcap command can get the LUN size. You point it at the initiator-side SCSI disk that you want to send the SCSI command to.
-bash-3.2# sg_readcap /dev/rdsk/c2t600144F0E5490A0000004A8179710001d0p2
Read Capacity results:
  Last logical block address=2097023 (0x1fff7f), Number of blocks=2097024
  Logical block length=512 bytes
Hence:
  Device size: 1073676288 bytes, 1023.9 MiB, 1.07 GB
-bash-3.2# sg_readcap --long /dev/rdsk/c2t600144F0E5490A0000004A8179710001d0p2
Read Capacity results:
  Protection: prot_en=0, p_type=0
  Last logical block address=2097023 (0x1fff7f), Number of logical 
blocks=2097024
  Logical block length=512 bytes
  Logical blocks per physical block exponent=0
  Lowest aligned logical block address=0
Hence:
  Device size: 1073676288 bytes, 1023.9 MiB, 1.07 GB
-bash-3.2#
Peter C

On 08/24/09 08:52, viveks wrote:
Hi,

Can anybody tell me a way to query iscsi lun size after i login to an iscsi 
target. iscsiadm doesnt display lun size. I want a way to query the lun size 
using an (preferably) iscsi function or command. If there is no way then system 
commands will do. I can get the lun sizes using iscsi API's exposed by the 
system on other linux and windows systems. Can i do the same here?

Thanks in advance.
_______________________________________________
storage-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/storage-discuss

Reply via email to