First you need recent enough software:
With this installed, the documentation does reflect the existence of this feature.
man ext4
:
casefold
This ext4 feature provides file system level character encoding support for directories with the casefold (+F) flag enabled. This
feature is name-preserving on the disk, but it allows applications to
lookup for a file in the file system using an encoding equivalent
version of the file name.
The feature must be enabled as a filesystem-wide ext4 option. Sadly, I couldn't manage to enable it on an already formatted filesystem. So using a sparse file created with dd if=/dev/zero of=/tmp/image.raw bs=1 count=1 seek=$((2**32-1))
to test on a newly created filesystem.
# tune2fs -O casefold /tmp/image.raw
tune2fs 1.45.3 (14-Jul-2019)
Setting filesystem feature 'casefold' not supported.
So when formatting, this will enable the feature:
# mkfs.ext4 -O casefold /tmp/image.raw
or to specify an other encoding rather than default (utf8). It appears that currently there is only utf8-12.1, of which utf8 is an alias anyway:
# mkfs.ext4 -E encoding=utf8-12.1 /tmp/image.raw
You can verify what was done with tune2fs:
# tune2fs -l /tmp/image.raw |egrep 'features|encoding'
Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg casefold sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Character encoding: utf8-12.1
Now to use the feature:
# mount -o loop /tmp/image.raw /mnt
# mkdir /mnt/caseinsensitivedir
# chattr +F /mnt/caseinsensitivedir
# touch /mnt/caseinsensitivedir/camelCaseFile
# ls /mnt/caseinsensitivedir/
camelCaseFile
# ls /mnt/caseinsensitivedir/camelcasefile
/mnt/caseinsensitivedir/camelcasefile
# mv /mnt/caseinsensitivedir/camelcasefile /mnt/caseinsensitivedir/Camelcasefile
mv: '/mnt/caseinsensitivedir/camelcasefile' and '/mnt/caseinsensitivedir/Camelcasefile' are the same file