Hi all,
I am writing a mount/umount procedure for CD rom and getting into the problem that /etc/mtab is not in sync with /proc/mounts.
Then I am ending up with a bunch of dangling /etc/mtab entries that are not valid anymore.
Reading through mount(8) I see a -n switch (--no-mtab) which would not write into mtab, but I can't see a flag to the mount C-function call (in mount(2) or googling) that would do this.
Does anyone know how could I get this behavior?
Thank you!
Miro
Have you tried using the MS_READONLY flag to the mount syscall and below is an excerpt from the mount syscall manpage...
The mountflags argument may have the magic number 0xC0ED (MS_MGC_VAL) in the top 16 bits
(this was required in kernel versions prior to 2.4, but is no longer required and ignored
if specified), and various mount flags (as defined in <linux/fs.h> for libc4 and libc5 and in
<sys/mount.h> for glibc2) in the low order 16 bits:
.
.
.
MS_RDONLY
Mount file system read-only.
The mount sytem-call doesn't update /etc/mtab, the mount utility does.
How to fix your problem depends on what your procedure is.