Solved

Linux, total disk space

Posted on 2012-03-12
5
388 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

823 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