On Wed, Apr 27, 2011 at 02:10:27PM -0500, Peter Samuelson wrote:
>
> [Roger Leigh]
> > This also permits the mount options for filesystems mounted in the
> > initramfs (e.g. /dev, /run, /sys, /proc etc.) to be set in
> > /etc/fstab; the filesystems are remounted with the options from
> > /etc/fstab if already mounted during rcS. The mount options for /run
> > are also made stricter when possible.
>
> I hope there are no traps for the unwary in remounting tmpfs
> filesystems, like the one that hit me in ext3, Bug #520009. I put
> "data=writeback" in the / entry of /etc/fstab. This caused the system
> to become unbootable, and the initramfs-tools maintainer concluded that
> it's my fault for being too stupid to notice that you have to duplicate
> information between /etc/fstab and the boot loader config. He
> WONTFIXed it because it is "much to big special case to start an fstab
> parser on". ("fstab parser" meaning, I guess, getmntent(3).)
>
> So, yeah, I hope tmpfs doesn't have any flags you're not allowed to
> change in a remount.
I've not seen any issues so far. Remounting with the various size options
and noexec/nodev etc. all appear to work.
However, the code which does the remounting is a general routine used for
all filesystems; it gets run for each filesystem mounted by mountkernfs/
mountdevsubfs, so it will include procfs and sysfs and devpts. Not seen
any issues so far though--they all appear to cope with remounting just
fine; I haven't tried any particularly exotic options though...
I had a look at #520009. Not too impressed with the response given that
parsing fstab, even in shell where there isn't a convenient interface
to getmntent(), is simple:
# Find a specific fstab entry
# $1=mountpoint
# $2=fstype (optional)
# returns 0 on success, 1 on failure (not found or no fstab)
read_fstab_entry () {
# Not found by default.
found=1
if [ -f /etc/fstab ]; then
exec 9<&0 </etc/fstab
while read MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MNT_PASS MNT_JUNK
do
case "$MNT_FSNAME" in
""|\#*)
continue;
;;
esac
if [ "$MNT_DIR" = "$1" ]; then
if [ -n "$2" ]; then
[ "$MNT_TYPE" = "$2" ] || continue;
fi
# Found
found=0;
break
fi
done
exec 0<&9 9<&-
fi
return $found
}
So to get the mount options, you just
read_fstab_entry / && echo "Mount options for rootfs: $MNT_OPTS"
So grabbing the root mount options to feed to update-grub/
update-initramfs or whatever needs to have the options is hardly
difficult. If that's something which needs implementing, feel free
to use the above if it helps.
Regards,
Roger
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
Attachment:
signature.asc
Description: Digital signature