Scroll to navigation



mount.lockfs - helper script for the mount command




/sbin/mount.lockfs is a symlink to /lib/bilibop/lockfs_mount_helper. It is used as an helper program by the mount(8) command for the 'lockfs' filesystem type entries in /etc/fstab. This script cannot be run manually, and fails if the root filesystem is not already managed by bilibop-lockfs. The expected way to run it and how it does its job are the followings:

Enable bilibop-lockfs: set the BILIBOP_LOCKFS variable to true in bilibop.conf(5) and reboot the computer; or reboot the computer and append the 'lockfs' kernel parameter to the boot commandline.
One time the future '/' is set as an union filesystem mountpoint from into the initramfs environment, the temporary and writable fstab(5) on it is modified to replace filesystem types of some entries by 'lockfs'. Options are also modified to remember the original fstype.
One time the union mount is the new root filesystem, initscripts are executed: fstab(5) is parsed by 'mount -a', and then mount(8) calls mount.lockfs with the proper arguments when a 'lockfs' fstype is encountered.
mount.lockfs parses arguments and checks if the filesystem has been whitelisted in bilibop.conf(5), or not. If it is the case, the filesystem is mounted normally and the fstab entry is modified to reflect the actual mount call. If neither the filesystem nor the mountpoint have been whitelisted, then the filesystem is mounted elsewhere and readonly, a temporary filesystem is mounted with proper options, size, permissions and ownership, and an aufs or overlay filesystem (depending on the version of your kernel) is mounted on the MOUNTPOINT given as argument with the lower/readonly and upper/writable branches previously set. The fstab entry is replaced by three lines reflecting the actual mount calls. If something fails, mount.lockfs acts as if the filesystem was whitelisted. See /usr/share/doc/bilibop-lockfs/README.Debian for details.


lockfs_mount_helper uses options and arguments as they are given by mount(8) after it has parsed the corresponding fstab(5) entry. So, options and arguments are mandatory, mount flags are optional, and all come in the following order:

Corresponding to the first field in fstab. This must be a block device, or a symlink to a block device. If this field is given with one of the UUID=* or LABEL=* formats, then the mount command translates it to the corresponding device name before to call the helper program.
Corresponding to the second field in fstab.
Generic flags passed to the mount commandline (the most usual being -v and -n).
Corresponding to the fourth field in fstab. The mount options are parsed by the helper script: if fstype=* is encountered, it is removed from the options and used to mount the readonly branch with this filesystem type. If ro, noexec, nosuid or nodev options are encountered, they are added to the list of mount options of the writable branch.




aufs(5), bilibop(7), bilibop.conf(5), fstab(5), mount(8)


This manual page has been written by Bilibop Project <>.

2015-07-14 bilibop