RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1152615 - df incorrectly reports free space when filesystem is double-mounted
Summary: df incorrectly reports free space when filesystem is double-mounted
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: coreutils
Version: 6.5
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Kamil Dudka
QA Contact: Branislav Blaškovič
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-14 14:13 UTC by Byron S
Modified: 2016-07-29 13:17 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-29 13:17:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
[PATCH] deal better with over-mount devices (15.19 KB, patch)
2016-01-15 09:02 UTC, Kamil Dudka
ovasik: review+
Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1325347 0 urgent CLOSED Missing values with df command 2021-02-22 00:41:40 UTC

Internal Links: 1325347

Description Byron S 2014-10-14 14:13:20 UTC
Description of problem:

When mounting multiple devices to the same mount point, df reports only the last-mounted disk's size (total, used, free) correctly. 

Method:

Take two disks with different UUIDs and mount them on top of each other on the same mount point. For example:

Two distinct devices (output of 'blkid'):
/dev/cciss/c0d0p6: LABEL="/u1" UUID="21234567-0e66-46ed-85fd-3452e3918267" TYPE="ext3"
/dev/cciss/c0d1p1: LABEL="/u1" UUID="39876543-672a-4afc-a3b1-809508d11fcd" TYPE="ext4"

Mount them on the same mount point:

mount /dev/cciss/c0d0p6 /u1/
mount /dev/cciss/c0d1p1 /u1/

Mounted on same mount point (output of 'mount'):
/dev/cciss/c0d0p6 on /u1 type ext3 (rw)
/dev/cciss/c0d1p1 on /u1 type ext4 (rw)

Actual results:

Output of 'df':
[~]# df -h | grep u1
/dev/cciss/c0d0p6  135G   48G   88G  35% /u1
/dev/cciss/c0d1p1  135G   48G   88G  35% /u1

[~]# df -a | grep u1
/dev/cciss/c0d0p6 140956600 49251652  91688564  35% /u1
/dev/cciss/c0d1p1 140956600 49251652  91688564  35% /u1

Expected results:

Expected to see 46G, not 135G as disk

/dev/cciss/c0d0p6   46G   31G   16G  66% /u1
/dev/cciss/c0d1p1  135G   48G   88G  35% /u1

As below:

[~]# df -h | grep fubar
/dev/cciss/c0d0p6   46G   31G   16G  66% /fubar

[~]# df -a | grep fubar
/dev/cciss/c0d0p6  48077160 31604408  16472752  66% /fubar

Additional info:

[~]# fdisk -l | grep 'Disk /'
Disk /dev/cciss/c0d0: 73.4 GB, 73372631040 bytes
Disk /dev/cciss/c0d1: 146.8 GB, 146778685440 bytes

Incorrect sizes (total, used, free) are reported for c0d0.

Version: coreutils-8.4-31.el6.x86_64

Comment 2 Pádraig Brady 2014-10-14 14:27:26 UTC
There are changes in upstream and RHEL7 to deal with this.
The behavior should be to show the last device mounted at a particular point,
and previous devices are not accessible to the user (nor to df to get the stats)

Comment 4 Kamil Dudka 2016-01-15 09:02:24 UTC
Created attachment 1115059 [details]
[PATCH] deal better with over-mount devices

I have backported 5 upstream commits to address this issue.  It was non-trivial to isolate the code from the mount entry de-duplication feature, which we probably do not want to introduce in RHEL-6 at this point.  A quick demo follows:

# df
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/vda1       16381864 10641408   4901648  69% /
/dev/vdb1        1968368    35756   1832620   2% /boot

# mount /dev/vdb2 /boot
# df
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/vda1       16381864 10641408   4901648  69% /
/dev/vdb1              -        -         -    - /boot
/dev/vdb2        7743112    17592   7325524   1% /boot

# df /boot
Filesystem     1K-blocks  Used Available Use% Mounted on
/dev/vdb2        7743112 17592   7325524   1% /boot

# df /dev/vdb1
df: cannot access `/dev/vdb1': over-mounted by another device
df: no file systems processed

# df /dev/vdb2
Filesystem     1K-blocks  Used Available Use% Mounted on
/dev/vdb2        7743112 17592   7325524   1% /boot

# df -a
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/vda1       16381864 10641408   4901648  69% /
proc                   0        0         0    - /proc
sysfs                  0        0         0    - /sys
devpts                 0        0         0    - /dev/pts
/dev/vdb1              -        -         -    - /boot
/dev/vdb2        7743112    17592   7325524   1% /boot


The related upstream test could not be picked because it does not work with the legacy /etc/mtab file containing source files instead of /dev/loop* in case of loopback mounts.

A review would be appreciated...

Comment 5 Ondrej Vasik 2016-02-12 13:58:31 UTC
Makes sense, thanks for the patch. Looks sane to me... I agree with not doing deduplication effort on RHEL 6 - it is required in the case of huge amount of duplicates - when /proc/mounts is symlink to /etc/mtab - on RHEL 6 it would only cause change in behaviour and confusion.

Comment 7 Byron S 2016-02-12 16:12:29 UTC
Patch looks good, thank you!

Comment 17 Kamil Dudka 2016-07-29 13:17:42 UTC
Per bug #1325347 comment #14, closing WONTFIX.


Note You need to log in before you can comment on or make changes to this bug.