On 10/10/2012 02:00 AM, Thang Pham wrote:
That works, thanks.

From:   Raymond Higgs/Poughkeepsie/IBM@IBMUS
Date:   10/09/2012 07:56 PM

It is in /var/log/messages:

Oct  9 19:43:21 4e1d-laplace-48 kernel: [23044.656933] scsi 1:0:26:1082146832: 
Direct-Access     IBM      2107900          36.5 PQ: 0 ANSI: 5
Oct  9 19:43:21 4e1d-laplace-48 kernel: [23044.657047] sd 1:0:26:1082146832: 
Attached scsi generic sg21 type 0
Oct  9 19:43:21 4e1d-laplace-48 kernel: [23044.659692] sd 1:0:26:1082146832: 
[sdv] 4194304 512-byte logical blocks: (2.14 GB/2.00 GiB)
Oct  9 19:43:21 4e1d-laplace-48 kernel: [23044.660473] sd 1:0:26:1082146832: 
[sdv] Write Protect is off
Oct  9 19:43:21 4e1d-laplace-48 kernel: [23044.660839] sd 1:0:26:1082146832: 
[sdv] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Oct  9 19:43:21 4e1d-laplace-48 kernel: [23044.663606]  sdv: unknown partition 
table
Oct  9 19:43:21 4e1d-laplace-48 kernel: [23044.665817] sd 1:0:26:1082146832: 
[sdv] Attached SCSI disk

Or send the SCSI read capacity command like this:

root@4e1d-laplace-48.1:sg_readcap /dev/sdv
Read Capacity results:
    Last logical block address=4194303 (0x3fffff), Number of blocks=4194304
    Logical block length=512 bytes
Hence:
    Device size: 2147483648 bytes, 2048.0 MiB, 2.15 GB

Linux on 390 Port <LINUX-390@vm.marist.edu> wrote on 10/09/2012 07:32:19 PM:

From: Thang Pham/Poughkeepsie/IBM@IBMUS
Date: 10/09/2012 07:40 PM

Is there a way to find out the size of a native SCSI device attached via
FCP channel?  I do not see lszfcp or lsscsi having an option that lets you
see the size of the disk you have attached to a VM.

The size of a scsi (disk) device is the same as the block device size. This is not specific to Linux on System z nor zfcp nor SCSI. It's just common block subsystem code.

Depending on what kind of code you want to process this information with;
for scripting you could use /sys/block/<devicename>/size (and adhere to http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=Documentation/sysfs-rules.txt;hb=HEAD) (or parse the somewhat older /proc/partitions); for C code you could just use the ioctl BLKGETSIZE64 from include/linux/fs.h [see e.g. the source of 'blockdev --getsz <dev>' as an example]. All other suggestions so far basically boil down to this in the end, so I'd probably prefer to use the user space interface directly.

This requires that you had attached the LUN to Linux previously and that would include lun probing in the kernel which already did inquiry and readcapacity (if the device is a disk, e.g.) among other things so there's no need to resend those scsi commands again explicitly.

I'm not quite sure what you mean in your second sentence with regard to a disk attached to a VM. To a VM as a z/VM userid, i.e. attached to the virtual machine by the hypervisor? AFAIK this means EDEV under z/VM. I don't know of any other way of attaching a scsi disk to a VM (usually users only attach the FCP host bus adapter to a VM).
To a VM as in guest operating system? Then the previous paragraphs apply.
Or would you like to get the lun size without even attaching them to Linux or the VM? If so, then this depends on the storage type since you'd have to use out of band mechanisms (i.e. non-scsi) to query the storage target server.

Steffen Maier

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/

Reply via email to