[j-nsp] disaccord in output of "df" and "df <mount-point>" in Junos

Vincent Bernat bernat at luffy.cx
Mon Jan 9 04:38:25 EST 2017


 ❦  9 janvier 2017 09:58 +0200, Martin T <m4rtntns at gmail.com> :

> /dev/bo0s3f     1264808  844256 319368    73%    /cf/var
> /cf/var/jail    1264808  844256 319368    73%    /jail/var
> /cf/var/log     1264808  844256 319368    73%    /jail/var/log
[...]

> As seen above, none of the mount-points matches /var/log. Now when I
> execute "df /var/log", then I expect it to be on /(and thus on
> /dev/da0s2a file-system), but for some odd reason it seems to be
> associated with /cf/var(and thus on /dev/bo0s3f file-system):
>
>
> $ df /var/log
> Filesystem  512-blocks   Used  Avail Capacity  Mounted on
> /dev/bo0s3f    1264808 844616 319008    73%    /cf/var
> $
>
>
> Or another example where output of "df" and "df <mount-point>" do not match:
>
> $ df /usr
> Filesystem 512-blocks    Used Avail Capacity  Mounted on
> /dev/md1      1063984 1063984     0   100%    /junos
> $
>
>
> What causes Junos(or underlying FreeBSD) to behave like that?

Unfortunately, there is no "stat" command that would help to have a
better picture. df will "stat" the file you provide to get the device it
is stored on and there search the device and its mountpoint to display the
result. Therefore, any "bind" mount is ignored. The mount point is not
translated to account for any chroot/jail the current process is running
in.

For /var/log, your shell is currently rooted in /jail, so the "absolute"
path is /jail/var/log which is in fact bound to directory /cf/var/log
whose mountpoint is /cf/var whose device is /dev/bo0s3f.
-- 
How apt the poor are to be proud.
		-- William Shakespeare, "Twelfth-Night"


More information about the juniper-nsp mailing list