I want to find the mount options for /var. I can get a list of mounts and their options with mount. but how do I find the right one for a particular file? I could start with the filename (/var) and chip away at it until the directory matches a mount point, but is there already something that can do this?

1 Answer 1


statvfs contains some options for any given file's path on the mounted filesystem in its f_flags member.

You can also parse /etc/mtab or /etc/fstab.

Beware of the listed options however, since some are just ignored by the kernel depending on the kernel config/options, and since you can't know what the kernel will do, you should limit to the minimum set of options.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .