Solved

Linux, total disk space

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
awk to variable in bash 2 106
bash file 10 62
MS Access Using VBA Split Word Docx file into separate Doc for Each Page 15 42
postfix start error! 9 50
MS Access 2003 or later To MySQL Migration Project Hello All, this is my second article in the category of MS-OFFICE Automation. In internet I am not able to find any comprehensive resource on the Migration of MS Access back-end to MySQL so I fin…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Viewers will learn the different options available in the Backstage view in Excel 2013.
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.

735 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