Is there any system call available in AIX to read the size of raw disk?
If I use the command "lspv -L",it only gives size of PVs on which file system is there. I need to extract the size raw disk i.e. file system is not there on the disk.
The problem is there is not a single solution to this, so i give you a list of options you have in order of preferability (is this a word? english is not my native language):
SCSI-disk and native SSA-disks (not SSA-RAID-volumes, etc.) have an attribute called "size_in_mb", which you could read. Example: to get the size of hdisk0 you can type (and get this sample information for a 18GB disk)
# lsattr -El hdisk0 -a size_in_mb
size_in_mb 18200 Size in Megabytes False
If the disk in question is in a volume group you can find out with lspv like this (output is exemplary):
# lspv hdisk4
PHYSICAL VOLUME: hdisk4 VOLUME GROUP: joker_int_vg
PV IDENTIFIER: 000bf05d981228ff VG IDENTIFIER 000bf05d95422f4d
PV STATE: active
STALE PARTITIONS: 0 ALLOCATABLE: yes
PP SIZE: 64 megabyte(s) LOGICAL VOLUMES: 4
TOTAL PPs: 1093 (69952 megabytes) VG DESCRIPTORS: 2
FREE PPs: 130 (8320 megabytes) HOT SPARE: no
USED PPs: 963 (61632 megabytes) MAX REQUEST: 256 kilobytes
FREE DISTRIBUTION: 00..00..00..00..130
USED DISTRIBUTION: 219..219..218..218..89
you could also use bootinfo, BUT: bootinfo is usually only executable by root, whereas lsattr is executable by everybody AND the bootinfo command won't work on some disks.
better use the "-o"-option of lsvg to get only the active VGs (the ones in the status VARYON), otherwise you will get a lot of error messages on the standby part of a HACMP cluster: