One of the biggest problems with flash devices (and especially usb memory sticks) are the limited number of writes. Normally, I make a bunch of tmpfs filesystems that the user may need to run on, but I noticed that I missed /etc/mtab. Because /etc/mtab is written to by mount and possibly other utilities, a write transaction occurs on a device with limited number of writes.
By making the rootfs or the /etc directory (if on a separate partition) read-only this prevents that, but then mount, e2fsck, and a handful of other applications go haywire at not being able to read/write /etc/mtab. If /etc/mtab is a symlink to /proc/mounts, then other problems seem to happen. Here is a patch that rips out all of the /etc/mtab write operations and excepts the use to redefine _PATH_MOUNTED in /usr/include/paths.h to be /proc/mounts Also, MOUNTED in /usr/include/mntent.h may need to changed to /proc/mounts Once this is done, /proc/mounts gets correctly used and no fancy work needs to be done to get working /etc/mtab equivalent functionality. And best yet, because /etc/mtab is no longer used or written, this means one less write transaction and therefore one less write-lock. This also seems to have a side effect of improving the probability that the rootfs can be unmounted because neither /proc/mounts nor /etc/mtab are required to perform the mount/umount action. Feel free to improve this in any way necessary. -- Kevin Day
util-linux-2.13-pre7-remove_etc_mtab-1.patch.gz
Description: GNU Zip compressed data
-- http://linuxfromscratch.org/mailman/listinfo/patches FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
