Casefold partition and the /etc/fstab

Zorin Pro 17.3 AMD64

For gaming i made a partition with the casefold option, because windows games and mods come with underscore and upperscore names. This has to be done while formatting a partiton and is visible in it's features.

dumpe2fs 1.46.5 (30-Dec-2021)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg casefold sparse_super large_file huge_file dir_nlink extra_isize metadata_csum

The kernel has to support casefold, should be so since around 2020
eric@athena:/home$ cat /sys/fs/ext4/features/casefold
supported

So chosen the mount point and have a dry test

eric@athena:/home$ sudo mount -t ext4 -O casefold UUID=32d6d0ec-85d0-4502-add2-bfccf2532527 /home/games
eric@athena:/home$

Success! Now let's do this permanent in fstab

Partition for games

UUID=32d6d0ec-85d0-4502-add2-bfccf2532527 /home/games ext4 defaults,casefold,x-gvfs-show,x-gvfs-name=games 0 1

Mount through fstab
eric@athena:/home$ sudo mount /home/games
mount: /home/games: Falscher Dateisystemtyp, ungültige Optionen, der Superblock von /dev/sda1 ist beschädigt, fehlende Kodierungsseite oder ein anderer Fehler.

Fail and this is strange, why success by hand and fail via fstab? Who like to check this at home, maybe with an usb key.

Can GVFS be unable to handle that?

If you remove the casefold option, does it work? If yes, you can then enable the file attribute with:

chattr -R +F /path/to/mountpoint

That's a nice workaround, did research this problem and found 15 year old kernel reports about that. Bugged fstab mount with casefold on ext4, but same can be done by hand without problems.

Warning: Keeping casefold in the fstab, results to a crashing bootup into the emergency environment :face_in_clouds:

Common tip seems to be the good old XFS, so i made a usb key with "version=ci" for testing reasons.

(Casefold demonstration)
eric@athena:/mnt$ echo "Try this out" >readme
eric@athena:/mnt$ cat ReAdMe
Try this out
eric@athena:/mnt$ touch TEST
eric@athena:/mnt$ touch test
-rw-r--r-- 1 eric eric 13 Apr 19 19:20 readme
-rw-r--r-- 1 eric eric 0 Apr 19 19:21 TEST

Edit: Another solution, is to reenable /etc/rc.local, you have to set a systemd starter for it. Then mount the ext4 partition with casefold from it, what will workaround the dreaded race condition from fstab. :+1:

Post 9 to get rc.local functionality

Hanselinux

1 Like

Looking a bit more into this, and I just noticed that you used the option -O (uppercase) which has no effect unless used with -a. This is why the mount command seemed to work, except that it only mounted the partition without any additional attributes.

So I tried on my end and turns out that using the lowercase form doesn't work, either. There's an error logged that you can see through dmesg:

[ 1092.689065] ext4: Unknown parameter 'casefold'

I'm not sure how this would work with other types of file systems but I haven't been able to find any examples that allow the use of this option while mounting an EXT4 partition.

This also explains why leaving the casefold option in the fstab entry causes a boot error as it's just not a valid option, at least when mounting EXT4 partitions.

As far as I can tell, you must enable it explicitly by running the chattr command once the partition has been mounted. Unfortunately, it has to be completely empty:

This attribute can only be changed in empty directories on file systems with the casefold feature enabled.

chattr(1) - Linux manual page

On the bright side, you only need to add this attribute once and thereafter it should work fine like any other partition.

Can you share what you've run inside rc.local to mount this partition? I suspect this is only working because you've already added the attribute to the file system. Could you check if this is the case?