Since Fedora util-linux 2.19, the %post script does:
rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab
We are no longer running %post scripts, so this means that /etc/mtab
is a plain file in the appliance. Usual 'mount' still updates it, but
for some reason mount.ntfs does *not* update it in Fedora 15, meaning
that you couldn't mount and then operate on NTFS partitions.
It seems better to always parse /proc/mounts (ie. what the kernel
thinks is mounted) unconditionally, rather than relying on the
capriciousness of the external mount command.
Therefore, parse /proc/mounts instead of /etc/mtab, but add a note
saying that in future we should really be parsing
/proc/self/mountinfo, but that needs a custom parser, and the format
is rather tricky:
http://lxr.linux.no/#linux+v2.6.37/Documentation/filesystems/proc.txt#L1462
FILE *fp;
struct mntent *m;
- fp = setmntent ("/etc/mtab", "r");
+ /* NB: Eventually we should aim to parse /proc/self/mountinfo, but
+ * that requires custom parsing code.
+ */
+ fp = setmntent ("/proc/mounts", "r");
if (fp == NULL) {
- perror ("/etc/mtab");
+ perror ("/proc/mounts");
exit (EXIT_FAILURE);
}