5

I would like to utilize the performance of tmpfs/ramfs for some file operations, but the programs/processes that use these files assume a case-insensitive file system. I cannot find any documentation for tmpfs/ramfs options that would allow case-insensitivity (which I completely expect).

Are there other methods for achieving similar results? [How] can I get a case-insensitive tmpfs/ramfs?

(Note: Looking for answers for RHEL/CentOS 7, but could easily switch to another distro if it has a good solution.)

3 Answers 3

4

You can try the following to create a case insensitive filesystem in /tmp:

truncate -s 100M /tmp/vfat losetup /dev/loop0 /tmp/vfat mkfs.vfat /dev/loop0 mkdir /mnt/vfat mount /dev/loop0 /mnt/vfat 

If you don't want to use tmpfs but ramfs instead, create a RAM mount first:

mkdir /mnt/ramfs mount -t ramfs -o size=110M ramfs /mnt/ramfs 

Then follow the steps above to create the vfat placeholder file, filesystem and mount.

1

You can use the ciopfs stackable filesystem, which implements a case-insensitive filesystem on top of a case-sensitive one.

mkdir /tmp/case-sensitive /tmp/case-insensitive ciopfs /tmp/case-sensitive /tmp/case-insensitive TMPDIR=/tmp/case-insensitive myapp fusermount -u /tmp/case-insensitive 

Ciopfs is a FUSE filesystem, which is available on most Unix variants including Linux. You may need to explicitly allow the user running that application to use FUSE (I don't know whether RHEL allows users to use FUSE by default).

Stacking a filesystem will inevitably cause a small performance penalty, but it's only a CPU cost, no disk I/O cost.

0

Nowadays you can mount tmpfs with the casefold option for case-insensitivity

tmpfs has the following mounting options for case-insensitive lookup support:

Option Meaning
casefold Enable strict encoding at this mount point (disabled by default). In this mode, the filesystem refuses to create file and directory with names containing invalid UTF-8 characters.
strict_encoding Enable casefold support at this mount point using the given argument as the encoding standard. Currently only UTF-8 encodings are supported. If no argument is used, it will load the latest UTF-8 encoding available.

And similar to the case-insensitive option in modern ext4 or NTFS you need to enable it for each directory individually

This option doesn’t render the entire filesystem case-insensitive. One needs to still set the casefold flag per directory, by flipping the +F attribute in an empty directory. Nevertheless, new directories will inherit the attribute. The mountpoint itself cannot be made case-insensitive.

Example:

$ mount -t tmpfs -o casefold=utf8-12.1.0,strict_encoding fs_name /mytmpfs $ mount -t tmpfs -o casefold fs_name /mytmpfs 

https://www.kernel.org/doc/html/latest/filesystems/tmpfs.html

The feature was merged in this commit. If you don't have a new enough kernel you can apply the patch manually

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.