FLUC Filesystem for Linux

flucFS uses FUSE to mount an existing directory in some other folder. Everything written to the mounted folder is transparently converted, encrypted, compressed as defined in the configuration. If no match is found in its configuration, the data is passed through without any change. The configuration is done with the argument strings of the FLUC byte interface API. However, since flucFS is a filesystem and uses only the read and write functions of the API, the element access features of the API are not useable with flucFS.

Limitations

flucFS converts a stream, so a file in the mounted folder is written from the beginning to the end and read the same way. Seeking inside an open file and changing a part of it is not possible: a converted, compressed or encrypted stream has no fixed relation between a byte position in the original and one in the stored file. Applications that update a file in place therefore cannot work on a mounted folder; they have to write a new file.

For the same reason an archive is offered as a single file and not as a folder of its members. A configuration may write and read a container with one member -- FIO.ZIP() for a ZIP archive, FIO.FL4() for reading an existing FLAM4 archive -- but the members of an archive with more than one are not visible as separate files.

When a pattern maps a file that flucFS did not write itself, the target pattern has to be invertible, because there is no entry in the meta database to map the name back. Use [copy], which keeps the name, rather than [base], which drops the extension and cannot be reversed.

Dependencies

Kernel module

The fuse kernel module must be loaded in order to use any fuse filesystem. This kernel module is usually installed with the linux kernel.

This can be checked with

     lsmod | grep fuse

To load it, just run

     modprobe fuse

with root permissions.

In unusual circumstances, FUSE support might be built into the kernel image.

Library

flucFS depends on the FUSE user space library. This library and the required utilities are installed with

     yum install fuse fuse-libs

on RedHat Enterprise Linux or CentOS.

     zypper install fuse libfuse2

on SLES or openSUSE

     apt-get install fuse

on Debian or Ubuntu

     pacman -S fuse3 fuse2

on ArchLinux or Manjaro

Usage

The current version of the FUSE library is 3.1.1 and uses a slightly different API than older versions (starting with 2). It is possible to have both versions of the FUSE library installed at the same time. Since some Linux distributions only provide an older version (2) two executables are shipped: flucFS and flucFS2

In case only an older version is available the executable flucFS will NOT work. Use flucFS2 instead when executing any of the following commands.

To mount the folder /var/data on the folder /home/hugo/mydata execute this command:

     flucFS -l logfile /var/data /home/hugo/mydata

If this is started from within the folder /home/hugo it can be abbreviated with

     flucFS -l logfile /var/data mydata

If no logfile is specified, flucFS will NOT run as daemon and the logging is done to stderr.

By default every request is served one after the other. With -m the filesystem serves requests on several threads, which helps when more than one program reads or writes at the same time. A single sequential copy gains nothing from it, because it issues one request at a time. Requests for the same file are serialised either way, since a FLUC byte interface handle is used sequentially.

The metadata database

Below the FLUC root flucFS keeps a directory '.flucIndex' with a database. For every file written through the mount it holds the mapping between the logical name the user sees and the physical file, together with the commands that produced it and the file attributes. Without that entry a file cannot be found again through the mount, although the physical file is still there.

About seven entries per file are stored, some 1600 bytes of database each, so the default size of 64 MiB holds roughly 42000 files. A mount that has to hold more says so with -s, or with the environment variable FL_FLUCFS_MAPSIZE; both take bytes or a K, M or G suffix, and -s wins over the variable:

     flucFS -s 512M -l logfile /var/data mydata
     FL_FLUCFS_MAPSIZE=512M flucFS -l logfile /var/data mydata

The value reserves address space, not disk; the file grows with the data, and an existing '.flucIndex' adopts a larger value on the next mount. Every program that opens the same FLUC root has to be given the same value. When the database is full, a write fails with ENOSPC although the file system below has room -- that is the signal to raise the size. The database grows with every file and does not shrink when files are deleted.

Every metadata commit is durable by default, which costs two disk revolutions per file and is what makes a run of many small files slow. With -D the second flush is dropped; a run of 658 files on ext4 went from 13.3 to 9.3 seconds. The price is bounded: after a power loss or a kernel crash -- not after a crash of flucFS itself -- the metadata of the last file written is lost, so that file is no longer visible through the mount although it is still on disk. The database itself stays intact. Use -D where the mount is a conversion step that can be repeated, not where the data lives.

Unmounting

To unmount the filesystem execute

     fusermount -u /home/hugo/mydata

or, if it was not running as a daemon, just hit <Ctrl>-C

After it is unmounted, all data was written to the logfile. In case of errors, the contents will help us at limes datentechnik to figure out the cause. For further details of flucFS please see the documentation: flucFS(1)

Known issues

If a mount command fails with this message:

    fuse: failed to open /dev/fuse: Permission denied

Users NOT belonging to the group fuse are usally denied access to /dev/fuse

Solution: The preferred solution is to add the required users to the fuse group. This is done by adding them to end of the line starting with fuse in /etc/group

An alternative solution is to alter the permissions of the device node /dev/fuse to allow read and write for any user in order to mount a FUSE filesystem by a user other than root. This can be done by executing

    chmod ugo+rw /dev/fuse

If a mount command fails with this message:

    version `FUSE_2.8' not found (required by ./flucFS2)

the FUSE library is too old for the shipped flucFS2.

Solution: