Solved

Linux, total disk space

Posted on 2012-03-12
5
403 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CLI command keep running after close 7 73
Redhat upgrade 1 69
How to check if the Cron job is running or not ? 12 87
cmake and message 1 26
Fine Tune your automatic Updates for Ubuntu / Debian
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

752 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