943,519 Members | Top Members by Rank

Ad:
Feb 25th, 2009
0

disk size in mb solaris

Expand Post »
Hi,

I am writing a script to get information on disks for Solaris 10, does anyone know of a way to print out the size of each disk on the system in MB i know how to get it in GB and could do some number manipulation however it would be better if I could get it in Mb originally!

Regards

Chris
Similar Threads
Reputation Points: 38
Solved Threads: 15
Posting Pro in Training
chris5126 is offline Offline
412 posts
since Feb 2006
Feb 26th, 2009
0

Re: disk size in mb solaris

Hey There,

You coud use the output of format, although if you wanted to automate, you'd have to pipe the right commands to it and then do some processing on the other end, eg, for disk 0:

Quote ...
(echo 0;echo p;echo p)|format
The partition print shows size in MB - You really just need slice 2, since that represents the entire disk.

Also, I believe:

Quote ...
iostat -En DIskname
or
Quote ...
iostat -En
<-- For everything and then parse it with sed/awk/what-have-you

may give you this info, but I don't have a SUn machine in front of me to verify.

Best wishes,

Mike
Reputation Points: 102
Solved Threads: 47
Posting Whiz
eggi is offline Offline
399 posts
since Oct 2007
Feb 26th, 2009
0

Re: disk size in mb solaris

Hi,

i worked out using iostat -En is the best way. However now im left with vaules in GB or/and MB so i need to get these into a standard form. I know i can use awk but im rubbish at it.
Maybe you could help I need a script that takes a value checks the units e.g if its GB it will times the value by 1024 then remove the GB from the end if its in MB it will just remove the MB and if its in KB it will divide by 1024 and remove the KB. Can you help im rubbish with awk! The vaules will be in a file called $TMP and can be put back into there afters and they have to all be to 2 decimal places any help would be much apreciated.

e.g

1204MB
2.42GB
2000000KB

Should become:
1024
2478.08
1953.12
Reputation Points: 38
Solved Threads: 15
Posting Pro in Training
chris5126 is offline Offline
412 posts
since Feb 2006
Feb 27th, 2009
0

Re: disk size in mb solaris

Hey there,

That can be done. Try this first though, since I find that "human readable" output is usually off. I would grab the information in kb and convert that to Mb. It will probably be more accurate than the output you generally get.

Which leads me to ask: Do you require specificity in your output to a great degree or are you looking for broad strokes (like 1.2Mb is fine even if it's technically 1.2475Mb)?

Thanks,

Mike
Reputation Points: 102
Solved Threads: 47
Posting Whiz
eggi is offline Offline
399 posts
since Oct 2007
Feb 27th, 2009
0

Re: disk size in mb solaris

Hi,

1.2 MB would be fine and all values will only be to two decimal places, but yes the human readable output is normally off by a few kb but for what i need it for its accurate enough. If that makes sense :-) . Thanks for you help by the way Mike it is apreciated.

Chris
Reputation Points: 38
Solved Threads: 15
Posting Pro in Training
chris5126 is offline Offline
412 posts
since Feb 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: questions for bashdb
Next Thread in Shell Scripting Forum Timeline: Which shell program does XP pro use?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC