MemFS 2.0 - A Memory-based File System on HP-UX 11iv3

5
Usage
MemFS file systems are created by invoking the mount command with „„memfs‟‟ specified as the
file system type. Device argument is not used by MemFS as it uses swap device as the back store.
It allocates the required metadata for the file system. The metadata related to MemFS is created
from kernel memory. The metadata of MemFS is not swappable. It shares the kernel memory with
other kernel resources. The memory usage by MemFS can be limited using memfs_metamax(5)
tunable. Either the percentage of kernel memory (from 1-30%) can be specified or the actual
memory can be specified, 15% will be the default. The total number of files created on MemFS is
limited by this tunable. Although it can be restricted using a mount option per file system.
ninode=n can be specified to restrict the maximum inodes that can be created on the file system
during mount. The file system is free to grow depending on the swap space available. There is no
restriction on the file system size (tested till 512GB), but the amount of free space available on
MemFS depends on the amount of unallocated swap space at that instant even though the size of
file system was specified. The size of a MemFS file system grows to accommodate the data written
to it, but there are some inherent tradeoffs for heavy users of MemFS. MemFS data shares
resources with the data and stack segments of executing programs. The execution of very large
programs can be affected if MemFS file systems are huge in size. Thus the maximum swap space
that can be used by MemFS can be restricted using memfs_swapmax_pct(5) tunable. The
maximum usage can be restricted from 0 to 80% of the swap space, where 50% will be the
default value. This will allow administrator to ensure most programs can execute. Users who
expect to run large programs and make extensive use of MemFS should consider enlarging the
swap space for the system. In addition, the file system can also be restricted from growing by
specifying size option during mount. size=n(KB|MB|GB) will restrict the file system to grow
beyond the specified size. This will not reserve the space for that file system; the free space will
still depend on the swap space usage at that instant.
These limits can also be modified using “remount” option in addition with the modified values.
MemFS file systems are “largefiles” enabled by default, thus they support file size more than 2GB.
There is no file size limitation on MemFS (tested till 512GB). „„read only‟‟ mount of MemFS is not
supported as it could leave the file system always empty. All file types are supported, including
symbolic links and block and character special device files are supported. UNIX file semantics are
supported. Access control list (ACL) to restrict the file access is not supported. Quotas that restrict
the number of inodes and blocks usage by user or a group is not supported. Multiple MemFS file
systems can be mounted on a single system and they share the system memory and UFC. As it
provides faster access to temporary files and the data and files on MemFS are not accessible
across mounts and reboots, this is suitable for /tmp and /var/tmp.