Solved Do nullfs mounts count toward disk usage?

This is probably a very simple, bordering on stupid, question; so apologies for that.

Do nullfs mounts (of host filesystems) within a jail count toward actual disk usage?

If I mount a host filesystem in a jail as a read-only nullfs, doing du on the jail includes the (size of the) mounted filesystems. Similarly, a du on the root / seems to double-count the mounted fs - once for itself, and another time within the jail.

Of course, I can do du -x to exclude the file system mount, but that's not the point, I'm more concerned with the actual disk usage. For the purposes of this question, there is just one HDD as storage. I'm almost sure that a mounted fs shouldn't count toward actual disk usage, but it could be my naïveté.
 
Ok, I think I figured it out. The answer is, no they don't.

This can be confirmed by checking the results of zfs list, and df
 
To be honest I don't quite understand the question. If you mount a filesystem somewhere then its contents do not "add up" to (or interfere with) the filesystem on which it was mounted. The mountpoint is just that: an access point leading up to another storage space. This is simply the way mounting works, the used filesystem doesn't change any of that.

So basically mounting something using nullfs is exactly the same thing as mounting a CD somewhere (using the cd9660 filesystem). And well, if you mount a CD you only gain access to the CD, the process itself doesn't suddenly gobble up diskspace.

What can happen though is that you hide parts of your tree if you mount something on a directory which isn't empty. In that case you cannot access that data anymore because of the mountpoint (but it will become available again once you unmounted the 'blocking' filesystem).
 
ShelLuser, Yes, you're right. I got thrown off upon seeing the mounted filesystem show up in du, and it also included the mounted files in calculating the total disk usage of the jail. Then rsync -a also wanted to copy the contents of the mounted fs as well. So it took me a while to figure it out.
 
Back
Top