Question

Which command to find total hard disk space?

Asked by: shawnk

Which command to find total hard disk space in most Solaris platform? df -k isn't enough.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2003-07-31 at 21:32:23ID20696495
Tags

disk

,

solaris

,

space

,

command

,

hard

Topic

Sun Solaris

Participating Experts
11
Points
0
Comments
13

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. df -k
    hi.... when i run df -k , i got below info. /dev/vx/dsk/appl 5040814 2255694 2734712 46% /appl /dev/vx/dsk/oracle_db 13685127 2490620 11057656 19% /oracle_db /dev/vx/dsk/raid5/vol02 20643801 8898932 11538431 44% /oracle_db/fas /dev/vx/dsk/raid5/vol01 ...
  2. df -k reporting incorrect disk space
    I'm running Solaris 2.6 on Ultra 60 machines. When I run df -k on the root patition on one machine it reports that the root partition is 63% full while another machine with the same configuration reports only 7%. I run du -k / | sort -n on both machines and get the same tot...
  3. How to get hard disk space in Java, on Solaris?
    How to get hard disk space in Java, on Solaris? thanks!
  4. df -k for sub dirs
    df -k gives the space info for "top" directories. Is there a way to run df -k for all sub directories as well and display the output by the free space desc order? In that case, I know which directories and/or sub directories having an issue at once.
  5. does du -ks and df -k report comparable numbers
    does du -ks and df -k report comparable numbers. Trying to relate how much disk space is being used in a directory and all it's subdirectories compared to all that's being used on that slice.
  6. df -k is gives same result in different locations ?
    Will df -k give same result when we execute this in different location!!

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: jleviePosted on 2003-07-31 at 21:51:48ID: 9046152

Since you say that 'df -k' isn't suitable, I'd assume that you wan to know the actual disk size as opposed to the usage of file systems on the disk(s). To find the disk size I'd just run format on each disk and get the total disk size by looging at the partition table or the disk ID if it shows the size.

 

by: OtetelisanuPosted on 2003-07-31 at 22:33:24ID: 9046316

Look man for
prtvtoc
and
du -k

 

by: colsey79Posted on 2003-08-01 at 01:53:22ID: 9047080

Another easy way is to run "iostat -En"  If the disk is a Sun supported disk, it usually says it's size in the "Product" field.

eg... This disk is a 36GB disk in a V480

c1t1d0          Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: SEAGATE  Product: ST336704FSUN36G  Revision: 0826 Serial No: 0102D1E7DA Size: 36.42GB <36418595328 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0

Note how the product code ends in SUN36G - that's the size of the disk.

FYI: format shows the same product code info, but without the error counts etc.

There is one problem with this...older IDE disks didn't have the size part of the product code. However, you can always take the product code and stick it into the
"Search handbook" field at http://sunsolve.sun.com

Oh, and one more thing... if you use Solaris 9, you can use the -h flag for "human readable" in the du, df and ls commands... it makes things so much easier to read file and disk sizes.

Of course, if you want the total space for the system, you would need to add all the values you have collected manually.

 

by: NisusPosted on 2003-08-02 at 10:01:00ID: 9054606

Hi,

To see all of the slices on all of the disks the easiest thing is:

prtvtoc /dev/rdsk/*s2

To see all disks do this:

format < /dev/null

Both command should be run as root.

Regards, Nisus
http://www.omnimodo.com

 

by: prasadklkPosted on 2003-08-05 at 06:50:36ID: 9080583

Use this script to get the total diskspace, Used disk space and available disk space.

#!/bin/sh

count=0
for i in `df -k|tail +2|awk '{print $2}'`
do
count=`expr $count + $i`
done
echo "Total Disk Space : $count"

count1=0
for i in `df -k|tail +2|awk '{print $3}'`
do
count1=`expr $count1 + $i`
done
echo "Total Disk Used  : $count1"

count2=0
for i in `df -k|tail +2|awk '{print $4}'`
do
count2=`expr $count2 + $i`
done
echo "Total Available Space : $count2"
                                             

 

by: dturner32257Posted on 2003-08-06 at 07:28:48ID: 9091363

Do you want to know the total space mounted, total space formatted, or total space available on the hard disks?

df -k will show total space mounted
du -k shows the space used and I don't think you asked for that

to get the space formatted and the total space available on the disks themselves you really need to use the command format and select each disk one at a time.

For example, on one of my older servers, I select disk 0, p for partition, then p for print to get;

Total disk cylinders available: 2733 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       0 -   67       50.47MB    (68/0/0)    103360
  1       swap    wu      68 -  404      250.12MB    (337/0/0)   512240
  2     backup    wm       0 - 2732        1.98GB    (2733/0/0) 4154160
  3        var    wm     405 -  836      320.62MB    (432/0/0)   656640
  4        usr    wm     837 - 1510      500.23MB    (674/0/0)  1024480
  5 unassigned    wm    1511 - 2022      380.00MB    (512/0/0)   778240
  6 unassigned    wm       0               0         (0/0/0)          0
  7       home    wm    2023 - 2732      526.95MB    (710/0/0)  1079200

Slice 2 represents the whole drive and we can see this drive has 1.98 GB space available in 2,733 blocks.

Slice (Part) 0 is the root partition taking 50.47MB
Slice 1 is the swap taking 250.12MB
and so on...

To see which slices are mounted you can issue the command...

cat /etc/vfstab

# cat /etc/vfstab
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr          ufs     1       yes     -
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c0t1d0s1       -       -       swap    -       no      -
/dev/dsk/c0t0d0s0       /dev/rdsk/c0t0d0s0      /       ufs     1       no      -
/dev/dsk/c0t0d0s4       /dev/rdsk/c0t0d0s4      /usr    ufs     1       no      -
/dev/dsk/c0t0d0s3       /dev/rdsk/c0t0d0s3      /var    ufs     1       no      -
/dev/md/dsk/d0          /dev/md/rdsk/d0         /export/home    ufs     2       yes     -
/dev/md/dsk/d1          /dev/md/rdsk/d1         /data   ufs     2       yes     -
/dev/dsk/c0t0d0s5       /dev/rdsk/c0t0d0s5      /opt    ufs     2       yes     -
swap    -       /tmp    tmpfs   -       yes     -

 

by: THOMEPosted on 2003-09-15 at 10:21:08ID: 9364513

"df -k" shows how much is either used / free for mounted filesystems, how come prtvtoc does not show this?  Also, what about raw partitions on a disk?

 

by: CetusMODPosted on 2004-03-21 at 07:58:50ID: 10644152

PAQed - no points refunded (of 50)

CetusMOD
Community Support Moderator

 

by: CadburyKatPosted on 2004-04-13 at 10:42:16ID: 10815704

Hello,

To see total disk space used on Solaris 8 and before you can use du -k {some mount point}  as in du -k /var  On Solaris 9 or later you can use du -k also, but you can also use du -h which displays a number in a human understandable format (k,m,g).

One caveot (There is always one).  If you execute this command on a mount point which has another mount point below it, it will add all sub mount points up also.

I.e. du -k / will add all disk space used on you system.


 

by: akhopkarPosted on 2004-04-14 at 12:57:39ID: 10827182

I would like to add to this ,

If you give the command
iostat -E
it will show you every disk on the system with size , and make . You can grep , awk the fields you like for processing . Also will show the disk errors if any , and does not require root access either .
I feel this is the most effective command to get disk space

 

by: shawnkPosted on 2004-04-20 at 23:50:08ID: 10875668

Thanks for the additional tips.

akhopkar,
That command you have given is really useful. Thanks

 

by: akumar25455Posted on 2004-05-24 at 14:15:33ID: 11146742

Have you tried du -ks ?!!

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...