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.
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.
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
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.
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.
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?