Bug 13570 - CIFS Mount Used Size descrepancy
Summary: CIFS Mount Used Size descrepancy
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.15.9
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Steve French
QA Contact: cifs QA contact
Depends on:
Reported: 2018-08-13 14:18 UTC by Terrance
Modified: 2022-09-03 21:56 UTC (History)
1 user (show)

See Also:

Incorrect Space when using Samba share being reported (2.12 KB, application/vnd.tcpdump.pcap)
2022-09-03 21:53 UTC, Terrance
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Terrance 2018-08-13 14:18:47 UTC
The server and client are both using Ubuntu 16.04.  I have setup both Samba and NFS on the server.  I have installed both cifs-utils and the nfs utils on the client.

When I run `df -h` on the server I get the following output:

terrance@terrance-ubuntu:~$ ssh 'df -h'
/dev/md1p1       15T  7.4T  6.4T  54% /media/storage

Then I go and set up both mounts on my client for testing:

terrance@terrance-ubuntu:~$ df -h   15T  7.4T  6.4T  54% /media/NAS
//        15T  8.1T  6.4T  57% /cifs/server

The first one listed above is the NFS mount.

As a test last night I copied an 18GB file to my server and the CIFS mount reported now 8.4T used.  When I deleted the file it went back to 8.1T used.  There is no way 18GB = 300GB.

What is the reason for the discrepancy in the used size calculations for the CIFS mount?  

Thank you!
Comment 1 Terrance 2018-08-16 14:14:05 UTC
Just tested in 18.04 with the same issue.

apt-cache policy cifs-utils 
  Installed: 2:6.8-1
  Candidate: 2:6.8-1
  Version table:
 *** 2:6.8-1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status
Comment 2 Terrance 2020-10-29 14:36:08 UTC
Just checked with Ubuntu 20.04 LTS and it too has the exact same issue even with a newer version:

apt-cache policy cifs-utils
  Installed: 2:6.9-1ubuntu0.1
  Candidate: 2:6.9-1ubuntu0.1
  Version table:
 *** 2:6.9-1ubuntu0.1 500
        500 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     2:6.9-1 500
        500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
Comment 3 Terrance 2022-08-19 18:51:18 UTC
Still occurring in Ubuntu 22.04 LTS

smbd --version
Version 4.15.9-Ubuntu

apt-cache policy cifs-utils
   Installed:  2:6.14-1ubuntu0.1
   Candidate:  2:6.14-1ubuntu0.1
Comment 4 Enzo Matsumiya 2022-08-25 14:57:16 UTC
Hi Terrance. Can you provide a network trace of the timeframe when you do a "df -h" please?

This way we can check if:

- the server sends unexpected info and the client just pass it on as-is to userspace
- the server sends expected info, but the client modifies it somehow
- the server sends unexpected info and the client modifies it to something else even

Comment 5 Terrance 2022-09-03 14:17:34 UTC
Hi Enzo!

What command output are you looking for?  I don't think I am familiar with doing a network trace of the timeframe for df.  Can you please tell me a command that I can run so that I can get you that output?
Comment 6 Enzo Matsumiya 2022-09-03 19:22:34 UTC
You can do something like this, with tcpdump package installed:

<in terminal 1>
> $ sudo mount.cifs <...mount options...> // /cifs/server

<in terminal 2>
> $ sudo tcpdump -i eth0 -s 0 -w wrong-df.pcap port 445

(of course, replace "eth0" with the network interface that connects to

<back to terminal 1>
> $ df -h

<go back to terminal 2>
> press ctrl-c to terminate tcpdump capture

Then you attach the new file "wrong-df.pcap" here please, along with the size shown by "df -h" in terminal 1, and the size you expected to see.

A "df -h" output from the server side at the same time you see the discrepancy would be nice as well.
Comment 7 Terrance 2022-09-03 21:53:49 UTC
Created attachment 17506 [details]
Incorrect Space when using Samba share being reported

File containing incorrect Space when using Samba share being reported
Comment 8 Terrance 2022-09-03 21:55:16 UTC
Top line is the Samba mounted share and the bottom line is the exact same share mounted on NFS.

Filesystem                 Size  Used Avail Use% Mounted on
//        15T  9.1T  5.5T  63% /media/Samba   15T  8.3T  5.5T  61% /media/NAS
Comment 9 Terrance 2022-09-03 21:56:45 UTC
Sorry, NFS share is correct.

terrance@terrance-ubuntu:~$ ssh 'df -h'
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           368M  3.3M  364M   1% /run
/dev/md0        455G  320G  112G  75% /
tmpfs           1.8G   16K  1.8G   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
/dev/md1p1       15T  8.3T  5.5T  61% /media/storage
tmpfs           368M  120K  367M   1% /run/user/1000