14

If I compare this

$> sudo mount | grep sdb
/dev/sdb1 on /windows type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096)
/dev/sdb2 on /store type ext4 (rw)

with this

$> sudo df -h | grep sdb
/dev/sdb1               94G   59G   35G  63% /windows

I see /dev/sdb2 is missing. But if I run this:

$> df -h /dev/sdb2
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb2       367G  342G  6.2G  99% /store

It's there. Why might this be happening?

I do not have a /etc/udev/rules.d/99-hide-disks.rules file. Also note

$> grep store /etc/fstab
# /store was on /dev/sdb3 during installation
UUID=760630a7-223f-42e4-aecf-de92e32f12b9 /store          ext4    defaults        0       2

Full output of df:

Filesystem            1K-blocks      Used Available Use% Mounted on
/dev/sda5              14287344   7560960   5977584  56% /
none                          4         0         4   0% /sys/fs/cgroup
udev                    8140000   8140000         0 100% /dev
tmpfs                   1631016     68292   1562724   5% /run
none                       5120         4      5116   1% /run/lock
none                    8155080     23212   8131868   1% /run/shm
none                     102400        24    102376   1% /run/user
/dev/sda7              73385208   4711820  64922580   7% /home
/dev/sdb1              97650684  61264484  36386200  63% /windows
/dev/sda2                 97280     32492     64788  34% /boot/efi
/store/var/tmp        384466988 357170340   7743728  98% /var/tmp
/home/me/.Private      73385208   4711820  64922580   7% /home/me

Full output of mount:

/dev/sda5 on / type ext4 (rw,noatime,errors=remount-ro,discard)
proc on /proc type proc (rw,nodev,noexec,nosuid)
sysfs on /sys type sysfs (rw,nodev,noexec,nosuid)
none on /sys/fs/cgroup type tmpfs (rw,uid=0,gid=0,mode=0755,size=1024)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /sys/firmware/efi/efivars type efivarfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,nodev,noexec,nosuid,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,nodev,noexec,nosuid,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
none on /dev/.bootchart/proc type proc (rw,relatime)
/dev/sda7 on /home type ext4 (rw,noatime,discard)
/dev/sdb1 on /windows type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096)
/dev/sda2 on /boot/efi type vfat (rw)
/dev/sdb2 on /store type ext4 (rw)
/store/tmp on /tmp type none (rw,bind)
/store/var/tmp on /var/tmp type none (rw,bind)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nodev,noexec,nosuid)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,noexec,nodev,none,name=systemd)
/home/.ecryptfs/me/.Private on /home/me
Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202
spraff
  • 2,106
  • 5
  • 37
  • 58
  • The partition might appear in `df` as `/dev/disk/by-uuid/something`. You should grep for `/store` instead of `sdb`. – user49740 Apr 18 '15 at 10:59
  • Is it shown if you just run `df`? I'm wondering whether the `grep` is doing something strange, perhaps it is aliased to something. Can you see `sdb2` in the full output of `df`? – terdon Apr 18 '15 at 13:17
  • Nope and nope. Full output of [df](http://pastebin.com/avp4g3xq) and [mount](http://pastebin.com/L9iq2fcf). – spraff Apr 18 '15 at 13:44
  • What do you get if you just exec `df -h | grep sdb`, without `sudo`? Almost looks like your superuser and regular user have different views into the filesystems as seen by `df`. – hBy2Py Apr 18 '15 at 14:22
  • Could you post the output of `ls -l /etc/mtab` and full contents of `/proc/self/mounts`? – u1686_grawity Apr 20 '15 at 16:07
  • What happens if you use `df -aT`? That should show all the filesystems, including the "dummy" ones. (This shouldn't be the problem since your mount output shows sdb2 as ext4, but we should rule it out.) – hackerb9 Nov 15 '17 at 18:03
  • I see this as well, and I think I figured out why I see it (don't know if you have the same situation). I have three nfs mounts and are all exported from the same filesystem on the remote system. df only shows the space available/used. It makes no sense to list them mulitple times, they are all the same. But mount shows all of them. – dviljoen Aug 12 '19 at 15:42

1 Answers1

8

The reason why

sudo df -h | grep sdb

did not output any line related to sdb2 on your system is because the output of sudo df -h did not contain any reference to sdb2. To verify this, look through the output of df -h manually. There is a reference to sdb1 and to /store/var/tmp, but nothing about sdb2. (It is only listed when /dev/sdb2 is provided explicitly as an argument to df, as in your third code snippet.) This is technically the question you asked.

Implicit in the question is also why df -h does not output a line related to /dev/sdb2 when it clearly is mounted. To find that out would require more information about your system; for example, see this 2014 bug report for Red Hat explaining that changes in /etc/mtab can create duplicates that df tries to reduce. This could cause mounted partitions not to surface.

Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202
Mike Chapman
  • 336
  • 2
  • 7
  • 5
    The first part seems excessive to me; I'm pretty sure the asker is aware of how `grep` works. Still +1 from me for digging this bug report up. – Kamil Maciorowski Nov 29 '17 at 11:38
  • It wasn't painfully obvious why grep didn't return a line for sdb2, I had to look several times at it before realizing, so I thought I would first point that out. Thanks for helping out with the mini-Markdown, I’m still getting the hang of formatting. – Mike Chapman Nov 29 '17 at 12:00