Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.