| | |
disk size in mb solaris
Thread Solved |
•
•
Join Date: Feb 2006
Posts: 399
Reputation:
Solved Threads: 14
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
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!
•
•
Join Date: Oct 2007
Posts: 399
Reputation:
Solved Threads: 47
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:
The partition print shows size in MB - You really just need slice 2, since that represents the entire disk.
Also, I believe:
or
<-- 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
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
Also, I believe:
•
•
•
•
iostat -En DIskname
•
•
•
•
iostat -En
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!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
•
•
Join Date: Feb 2006
Posts: 399
Reputation:
Solved Threads: 14
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
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!
•
•
Join Date: Oct 2007
Posts: 399
Reputation:
Solved Threads: 47
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
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!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
•
•
Join Date: Feb 2006
Posts: 399
Reputation:
Solved Threads: 14
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
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!
![]() |
Similar Threads
- Script is not working in linux (Shell Scripting)
- samba 3.0.22 on solaris 9 (Getting Started and Choosing a Distro)
Other Threads in the Shell Scripting Forum
- Previous Thread: questions for bashdb
- Next Thread: Which shell program does XP pro use?
| Thread Tools | Search this Thread |





