Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determinig the size of a virtual SCSI harddisk 1

Status
Not open for further replies.
Jan 13, 2003
105
Hi all,

I am trying to find out the size of a Virtual SCSI harddisk, when it is not yet included in a VG and you do not have access to the VIO-Server. I need that for scripting, especially for automated creation of volumegroups with the proper PP-Size. The old-fashioned way to cast a: lsattr -El hdiskx gives no output regarding the size, so there is maybe another way?

Thanx for your ideas


mad

Advanced Interactive eXecutable
 
Does

lscfg -vl hdiskX

give any info?


HTH,

p5wizard
 
Sure, but not the information I needed ;-)

lscfg -vl hdiskx gives output similar to this:

hdisk2 U91113.550.65D7223-V8-C2-T1-L83000000000 Virtual-SCSI-disk

Well, a workaround for scripting would be to put these disk in a temporary VG, look fot the size and exportvg the VG. But that would be the last way....

mad

Advanced Interactive eXecutable
 
or use dd to estimate the size if you don't want to risk putting a disk that belongs to another (as yet unknown) VG in a temp VG and ruin the data:

Code:
#!/bin/ksh
# find out number of GB on any disk
# # #
disk=$1           # /dev/hdiskN format
blocksize=1000000 # dd-read a block of 1Mbyte
startcount=9999   # at address 9999000000 -> 10GB
# # #
# read the designated block
while dd if=$disk of=/dev/null \
      bs=${blocksize} skip=${startcount} count=1 2>/dev/null 
do
 # # #
 # increment to next GB 
 ((startcount=startcount+1000))
done
# # #
# size must be 1GB less than point we are now
((startcount=startcount-999))
((sizeGB=startcount/1000))
echo "${disk} is ${sizeGB} GB"

# timex disksize.ksh /dev/hdisk1
/dev/hdisk1 is 36 GB

real 1.24
user 0.07
sys 0.24


Takes a bit of time, but in any case less than creating a temp VG... ;-)



HTH,

p5wizard
 
How about `lspv hdisk0 | grep TOTAL PPs` ?

"If you always do what you've always done, you will always be where you've always been."
 
I didn't read correctly... Your disk in not part of you VG yet


"If you always do what you've always done, you will always be where you've always been."
 
If you have root you can issue
odmget -q "name=hdisk10 and attribute=size_in_mb" CuAt


"If you always do what you've always done, you will always be where you've always been."
 
hello rzs0502,

all these things do not work with virtual disks! So the output from the odmget-command are pretty similar to those you will get from the lsattr-command.

@p5wizard : THx for that, but 2 minutes are more than I need for creating and removing a VG... Anyway, exciting way...
mad

Advanced Interactive eXecutable
 
that's 1.24 seconds... (but bootinfo -s has the exact size in 0.00 seconds ;-)) My script only gives a rough estimate.

But bootinfo should also know about the size of VSCSI disks - I guess it just does an lseek(fd,0,SEEK_END) on the disk device and then divides the resulting address by 1048576



HTH,

p5wizard
 
@hirschaj: Absolutely, bootinfo -s does the trick. This info was really valuable for me!

Thx to all for the help, and:

@p5wizard: I got confused about the
real 1.24
user 0.07
sys 0.24

I thought of:

real 1m24,00s
user 0m7,00s
sys 0m24,00s

mad

Advanced Interactive eXecutable
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top