disk size in mb solaris

Thread Solved

Join Date: Feb 2006
Posts: 399
Reputation: chris5126 is an unknown quantity at this point 
Solved Threads: 14
chris5126 chris5126 is offline Offline
Posting Whiz

disk size in mb solaris

 
0
  #1
Feb 25th, 2009
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
If my post helped add to my rep!
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 399
Reputation: eggi will become famous soon enough eggi will become famous soon enough 
Solved Threads: 47
eggi eggi is offline Offline
Posting Whiz

Re: disk size in mb solaris

 
0
  #2
Feb 26th, 2009
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:

(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:

iostat -En DIskname
or
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
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 399
Reputation: chris5126 is an unknown quantity at this point 
Solved Threads: 14
chris5126 chris5126 is offline Offline
Posting Whiz

Re: disk size in mb solaris

 
0
  #3
Feb 26th, 2009
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
If my post helped add to my rep!
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 399
Reputation: eggi will become famous soon enough eggi will become famous soon enough 
Solved Threads: 47
eggi eggi is offline Offline
Posting Whiz

Re: disk size in mb solaris

 
0
  #4
Feb 27th, 2009
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
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 399
Reputation: chris5126 is an unknown quantity at this point 
Solved Threads: 14
chris5126 chris5126 is offline Offline
Posting Whiz

Re: disk size in mb solaris

 
0
  #5
Feb 27th, 2009
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
If my post helped add to my rep!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC