Solved

Linux, total disk space

Posted on 2012-03-12
5
380 Views
Last Modified: 2012-03-12
I am using RHEL 5.6

What command can I run to see the total disk space (used or free or not yet allocated) on the system

Thanks
0
Comment
Question by:Los Angeles1
  • 3
5 Comments
 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 333 total points
ID: 37709985
Issue
df -hT
du -sh /
fdisk -l
lvmdiskscan
0
 

Author Comment

by:Los Angeles1
ID: 37710054
I get the following:

-bash-3.2# usermod -g mqm -G mqbrkrs mqm
-bash-3.2# su - mqm
-bash-3.2$ exit
logout
-bash-3.2# df -hT
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda1     ext3    9.7G  3.8G  5.5G  41% /
tmpfs        tmpfs   1006M     0 1006M   0% /dev/shm
/dev/sdb1     ext3    9.9G  3.0G  6.5G  32% /opt
-bash-3.2#
-bash-3.2# du -sh /
6.7G    /
-bash-3.2#
-bash-3.2#
-bash-3.2# fdisk -l

Disk /dev/sda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1305    10482381   83  Linux
/dev/sda2            1306        1566     2096482+  82  Linux swap / Solaris

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1305    10482381   83  Linux
-bash-3.2#

Open in new window


So the df -hT says I have about 10GB per disk, and the fdisk -l says I have about 12 GB in the sda and 10GB in the sdb

Why is there a difference?

Which of these 2 commands whould I rely upon
0
 
LVL 31

Expert Comment

by:farzanj
ID: 37710092
Well, I would say fdisk is.  It gives you the sum total of the entire disk whether it is usable disk space or not (un-partitioned).
0
 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 333 total points
ID: 37710104
Also use
df -HT

There is also a difference when it uses 1000 bytes to KB vs. 1024 byes.
0
 
LVL 5

Accepted Solution

by:
1ly4me earned 167 total points
ID: 37710136
du - summarizes disk usage of each file
df - displays the amount of disk space available on the file system
fidsk - partition table manipulator

The fact you have to understand is,
fdisk display raw information about hard disk, where as other two displays logical space of file system.
Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1305    10482381   83  Linux
/dev/sda2            1306        1566     2096482+  82  Linux swap / Solaris

Open in new window

you forgot that /dev/sda2 is actually a swap space of 2GB and you cannot use that space, because its a system reserved space.
It's best to use df command for available disk space
Rajan
AskLinux
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now