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

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

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

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

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

This question has already been answered. Start a new discussion instead.