df and sub-mounts...

If none of the more specific forums is the right place to ask

df and sub-mounts...

Postby rsi » 2018-04-30 11:51

Hello!
Is there any way to get the right free space with df on sub-mounted partitions?
Just to explain...

Main-folder to mount is /opt/myfolder.
Code: Select all
mount /dev/sdb1 /opt/myfolder
mount /dev/sdc1 /opt/myfolder/subfolder
df /opt/myfolder


So, 'df' gives only the free space of /dev/sdb1, but not the free space on /dev/sdc1.
In my opinion is this a wrong behavior of 'df' or there should be an option to force the free space of all mounts in that folder together.

Is there any command-line tool, that gives the correct free space back?

Thank's for help!
Last edited by rsi on 2018-04-30 16:22, edited 1 time in total.
rsi
 
Posts: 15
Joined: 2014-10-20 00:52

Re: df and sub-mounts...

Postby bw123 » 2018-04-30 15:16

I'm not sure what you want to see, but play with some wild cards, and check out the man page for df

Code: Select all
$ df --total /opt/myfolder /opt/myfolder/*
User avatar
bw123
 
Posts: 3184
Joined: 2011-05-09 06:02
Location: TN_USA

Re: df and sub-mounts...

Postby rsi » 2018-04-30 16:20

To explain for what I need this, it's for the samba "dfree command" directive, because samba gives only the free size of the first mounted device back, but not the sub-mounted device.
But now, I've written my own shell script to give the correct size back to samba with all sub-mounted devices calculated.
But thank's for the hint with the --total option. This makes it easier in my script. I missed this.
But samba 4.5.x seems still not using the "dfree command" directive.
Last edited by rsi on 2018-04-30 16:30, edited 2 times in total.
rsi
 
Posts: 15
Joined: 2014-10-20 00:52

Re: df and sub-mounts...

Postby dilberts_left_nut » 2018-04-30 16:29

rsi wrote:This gives only the free size of /dev/sdb1, but not the free size of /dev/sdb1 + /dev/sdc1.

Than, you did not read the man page correct or did not understand it.
AdrianTM wrote:There's no hacker in my grandma...
User avatar
dilberts_left_nut
 
Posts: 4854
Joined: 2009-10-05 07:54
Location: enzed

Re: df and sub-mounts...

Postby rsi » 2018-04-30 16:33

dilberts_left_nut wrote:
rsi wrote:This gives only the free size of /dev/sdb1, but not the free size of /dev/sdb1 + /dev/sdc1.

Than, you did not read the man page correct or did not understand it.

Not directly, I simply overlooked the "--total" option.
rsi
 
Posts: 15
Joined: 2014-10-20 00:52


Return to General Questions

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable