LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-10-2013, 12:45 PM   #1
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,906

Rep: Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026
COREUTILS 8.21 - 'df' bind mount bug.


Just thought I'd make people aware of this one in case you hit it and wonder what the hell is going on (like I did)

Quote:
df now properly outputs file system information with bind mounts present on
the system by skipping duplicate entries (identified by the device number).
Consequently, df also elides the early-boot pseudo file system type "rootfs".
Now, I can understand the idea of hiding the duplicates, but it seems that they haven't quite figured out how to suppress the bind mount rather than the original filesystem.
Code:
root@ws1:~# df
Filesystem                   1K-blocks     Used Available Use% Mounted on
/dev/mapper/rootvg-lvroot     16382888  5847268   9696760  38% /
/dev/mapper/rootvg-lvlocal    83585712 75545448   8040264  91% /local
root@ws1:~# mount -o bind /local/music /mnt
root@ws1:~# df
Filesystem                   1K-blocks     Used Available Use% Mounted on
/dev/mapper/rootvg-lvroot     16382888  5847268   9696760  38% /
/local/music                  83585712 75545448   8040264  91% /mnt
As you can see, the wrong mount is removed from the output.

So, if you do anything fancy with bind mounts then you might want to be wary of this as your filesystems may very well disappear from the output of 'df'.

As a work-around I've found that "df -a -x none -x proc -x sysfs" or "df -a -t ext4 -t tmpfs" seems to provide sensible output.

"df -a -x proc -x sysfs" seems the closest match to the previous default behaviour as far as I can tell.

I can feel an alias coming on!

Last edited by GazL; 03-10-2013 at 12:55 PM.
 
Old 03-11-2013, 06:38 AM   #2
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,906

Original Poster
Rep: Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026
replying to myself to get it off the zero-reply list.
 
Old 03-11-2013, 07:39 AM   #3
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 875

Rep: Reputation: 282Reputation: 282Reputation: 282
I think where they have gone wrong is they are going with the last one instead of the first one.

ie df parses /etc/mtab from top to bottom and each time it hits a duplicate block device it goes with the new mount instead of ignoring the new one and keeping the old one.
 
1 members found this post helpful.
Old 03-11-2013, 08:00 AM   #4
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,906

Original Poster
Rep: Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026
Just had a look in the src for df and found this:
Code:
/* Filter mount list by skipping duplicate entries.
   In the case of duplicities - based on to the device number - the mount entry
   with a '/' in its me_devname (i.e. not pseudo name like tmpfs) wins.
   If both have a real devname (e.g. bind mounts), then that with the shorter
   me_mountdir wins.  */
So, they're not acting on order, which I agree would have been a much better idea than having something as arbitrary as the length of the mountpoint decide.
Here:
Code:
root@ws1:~# df
Filesystem                   1K-blocks     Used Available Use% Mounted on
/dev/mapper/rootvg-lvroot     16382888  5847268   9696760  38% /
/dev/mapper/rootvg-lvlocal    83585712 75545448   8040264  91% /local
root@ws1:~# mount -o bind /local /mnt
root@ws1:~# df
Filesystem                   1K-blocks     Used Available Use% Mounted on
/dev/mapper/rootvg-lvroot     16382888  5847268   9696760  38% /
/local                        83585712 75545448   8040264  91% /mnt
root@ws1:~# umount /mnt
root@ws1:~# mount -o bind /local /mnt/tmp
root@ws1:~# df
Filesystem                   1K-blocks     Used Available Use% Mounted on
/dev/mapper/rootvg-lvroot     16382888  5847268   9696760  38% /
/dev/mapper/rootvg-lvlocal    83585712 75545448   8040264  91% /local
... that's just bonkers behaviour. Clearly, they haven't thought this one through fully.

Last edited by GazL; 03-11-2013 at 08:45 AM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] coreutils 8.12 bug anti_user Slackware 8 05-15-2011 06:34 PM
Bug in mount bind: files turn into directories Pepijn Schmitz Linux - Kernel 2 05-10-2010 03:34 AM
mv (coreutils) 5.2.1 - a bug? BiThian Linux - Desktop 1 09-15-2006 12:28 AM
possible coreutils bug (tr) mebaro Linux - General 3 06-15-2006 10:04 AM
BIND bug stand Linux - General 3 11-20-2002 12:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration