Linux du command question

Posted on 2012-08-17
Last Modified: 2012-08-17
I'm not sure where it is reporting correct or not, but here is the output from the box.

# df  -h  |  grep  -i  tmp
tmpfs                 2.0G     0  2.0G   0% /dev/shm
/dev/mapper/vg-tmp    2.0G  148M  1.8G   8% /tmp

As you can see 148 Meg used

When I use du commad, it shows only  62+19+ .016 +.004,  I'm not sure where those 60 Meg come from?  Isn't  it suppose to show only 80 M ?

#du  -sh  *
4.0K    x.log
16K     lost+found
19M     x123.log
62M     z123.log
Question by:mokkan
    LVL 40

    Expert Comment

    the file system space is of two type:

    1- files, directories (data)
    2- filesystem overhead blocks

    When you use the df command then you get used space by both

    when you use the du command then you get info about files and directories only.

    So, the output is not the same

    Author Comment

    Thank you very much. How do we calculate the overhead blocks?
    LVL 40

    Expert Comment

    it depends on the file system type, but it is between 5 to 10% of the partition size.

    Author Comment

    Thank you very much. The problem is df is showing as free, but there is a disk full message. I belive it is due to inode. How can i create  inode manually to reproduce the problem?
    LVL 40

    Expert Comment

    you can not create inodes. inodes are created while creating filesystem and on some types of filesystems they are created dynamically when it is needed by the OS.

    What is the problem you are trying to solve?

    Some times you see filesystem usage over 100% and this is because the inode space is used for files and dir. If you see file system full then try to delete some files like logs, etc.

    Author Comment

    thank you very much.  It looks like inode space is used for directory and files.  From the inode number, can we find out how much space on the specific file system?
    LVL 40

    Accepted Solution

    the inode holds info related to a file or a directory like starting block, size, owner, permissions, etc. inode number can't tell you size of the file system. The filesystem has internal table of allocated and free disk blocks and based on that it knows how much space is allocated and how muck is free.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Suggested Solutions

    Title # Comments Views Activity
    vSphere client error 503 5 54
    Making an image of a VMWare Client 3 54
    best way to import vmdk in esxi 6? 13 47
    VM MAC COnflict 6 54
    In this article, I am going to expose some of the hidden, undocumented, unsupported features and functions of the VMware vSphere Hypervisor (ESXi). VMware vSphere ESXi 4.x, and ESXi 5.0 does not officially support Raw Disk Mapping of Local Stora…
    About FreeBSD Jails In FreeBSD, jails are a way of doing operating system level virtualization.  The basis of FreeBSD jails is chroot (, which changes the root directory of processes.  As a…
    This tutorial goes over how to archive and restore FreeBSD jails that are managed by ezjail.
    This video shows you how easy it is to boot from ISO images for virtual machines with the ISO images stored on a local datastore on the ESXi host.

    760 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

    10 Experts available now in Live!

    Get 1:1 Help Now