Operating System - HP-UX
1834505 Members
3218 Online
110068 Solutions
New Discussion

how to determine the mount options for a filesystem

 
SOLVED
Go to solution
Mihai Matei
Advisor

how to determine the mount options for a filesystem

Hi,

How can I determine, using C functions, the type of a filesystem (MOUNT_NFS, for example) and if a filesystem is mounted with the nosuid option?

Thanks.
6 REPLIES 6
Stefan Farrelly
Honored Contributor

Re: how to determine the mount options for a filesystem

The info you want comes from the nfsstat -m command, but it doesnt seem to have an equivalent C function as it reads kernel structures - youre going to have to call the nfsstat binary and capture its output in your C program.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Mihai Matei
Advisor

Re: how to determine the mount options for a filesystem

Thanks for your reply.
I need C functions, otherwise I can parse /etc/fstab, and get the mount options also...
Mihai Matei
Advisor

Re: how to determine the mount options for a filesystem

More info: I need data stored in the mount_data structure in vfs.h (md_fstype, md_fsopts), but I can't find any functions that read it.
Marco Santerre
Honored Contributor
Solution

Re: how to determine the mount options for a filesystem

I'm no C expert but have you looked into getmntent()
Cooperation is doing with a smile what you have to do anyhow.
Jeff Schussele
Honored Contributor

Re: how to determine the mount options for a filesystem

Hi,

The non-C way to get current mount options is:

mount -v
or
mount -p

The /etc/fstab will give you the mount options at boot time. But the FS could have been unmounted/remounted with other options or been modified with
mount -o remount,option1,option2 /dev/vg_name/lv_name /mnt_point

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Mihai Matei
Advisor

Re: how to determine the mount options for a filesystem

getmntent() seems to be the way of retrieving the info I need.

Thank you all.