How does df total differ for bind mounts?

QuestionsQuestions8 SkillsProDec, 19 2025
0180

That is exactly where the --total command can become a bit misleading!

When you have a bind mount, you are essentially mounting the same directory in two different locations. To the Linux kernel, these look like two different mount points, so df reports them as two separate entries.

Here is how it affects the total:

1. The "Double Counting" Effect

Because df --total simply sums up every row in its report, it will count the capacity and usage of a bind mount twice.

Example Scenario:
Suppose you have a 100GB disk (Partition A) and you bind mount a folder from it to another location.

  • /dev/sda1 (Original): 100GB total, 40GB used.
  • /mnt/data_bind (Bind): 100GB total, 40GB used.

When you run df -h --total, the summary line will report:

  • Total Size: 200GB (Incorrect!)
  • Total Used: 80GB (Incorrect!)

In reality, you only have 100GB of physical space, but df treats them as unique filesystems.

2. Why does df do this?

df operates at the level of the mount table. It doesn't check if two mount points share the same underlying hardware device before doing the math. It assumes every line item in the output is a distinct "pool" of storage.

3. How can you tell if this is happening?

You can use the -a (all) or -T (type) flags to investigate, but the best way is to look at the Filesystem (source) column:

df -h --total

If you see the exact same device name (like /dev/vdb) appearing on multiple lines with the exact same Size, Used, and Avail values, you are looking at a bind mount (or multiple partitions on the same disk). The --total on the bottom will be inflated.

Practical Tip:

If you want a more "realistic" view of physical hardware usage without the double-counting of bind mounts, it is often better to use:

df -h -x tmpfs -x devtmpfs

This filters out the virtual memory mounts, though it will still show bind mounts if they exist on physical disks.

In your current VM, the /etc/hosts entry you see in your history (/dev/vdb) is a common example of how specialized mounts can make the total look much larger (128G) than the actual primary disk

0 Comments

no data
Be the first to share your comment!