Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer

You must log in to answer this question.

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