Linux: Case-INSENSITIVE Filesystem

15,860

Solution 1

Necromancing.
Answering my own question.
This is indeed possible.
Variant 1:
Create a .dsk-file of size X-MB (with dd), then make a JSF-filesystem on that file, with option O (OS2 compatibility - = case insensitive)
Then loop-mount that file into a desired folder.

(apt-get install jfsutils)
dd if=/dev/zero of=jfs.dsk bs=1048576 count=150
mkfs.jfs -O jfs.dsk
mkdir -p /mnt/jfs
mount /volumes/jfs.dsk /mnt/jfs -t jfs -o loop
umount /mnt/jfs/

Variant 2:
When you install the OS, manually partition the disk, and create another partition with format JFS, which you mount to wherever you want to have it.
When everything is up and running, you can reformat that partition with (warning - this will erase all data on that partition - make sure you selected the proper one, and don't have any data on it, yet):

unmount the mounted partition

umount /web

reformat:

mkfs.jfs -O /dev/hda5

remount the partition

mount /dev/hda5 /web

Now run

blkid

and you get the new partition-uuid.
Now go to /etc/fstab, and replace the old uuid for /dev/hda5 with the new one.

If you're doing this wrong, see also
Welcome to emergency boot mode...

Solution 2

There's a case insensitive ext3 driver, but, frankly, running such a thing in production would scare me a bit, since you're rolling your own custom kernel with patched-in drivers. (Yeah, yeah-- we did that all the time "back in the day", but that was, like, 1997...)

There's a FUSE implementation, ciopfs, that implements case insensitivity as well. That would be a lot less scary to me to use in production than a patched kernel.

You could also use a case-insensitive filesystem, like VFAT, for the /var/www folder hierarchy. I'd use a loopback mount in that case, such that you don't have to mess with your disk partitioning.

Solution 3

If you're talking about case insensitivity ONLY within apps running under Mono, you can use the IOMAP environment variable to tell mono to ignore case just like Windows does.

See the details on its use here: http://www.mono-project.com/IOMap

Share:
15,860

Related videos on Youtube

Quandary
Author by

Quandary

Mind the gap.

Updated on September 17, 2022

Comments

  • Quandary
    Quandary over 1 year

    What methods are there to make the Linux filesystem case-INSENSITIVE ?

    I have asp.net applications developed on Windows, but there are always issues with capitalization/spelling on mono when putting it on Linux.

    One way is to mount a localhost SMB share to /var/www. Are there any others ?

    • Aaron Tate
      Aaron Tate about 14 years
      Wouldn't it be easier to fix the application than hack the os to work around the broken app?
    • Zoredache
      Zoredache about 14 years
      Is this web app being served through apache, you could use mod_speling.
    • Shadur
      Shadur about 9 years
      This sounds like a pretty obvious case of "Or you can teach your web developers to be consistent with their file naming, on pain of pain"
  • Quandary
    Quandary almost 14 years
    ciopfs is crap, i tried it, it does only map lowercase to lowercase, ignoring any uppercase...
  • porton
    porton over 11 years
    @Quandary Run awk '/^ciopfs/ {print $2}' /proc/mounts and that will output the name of the directory to use. After you run ciopfs a/ b/ you should not access or modify files under a/.
  • Michael Shigorin
    Michael Shigorin over 8 years
    @Quandary the lowercase constraint is written right on the project's page and is pretty obvious tbh, did you try to improve it to handle your use case or at least RTFM before use?
  • Andrew Henle
    Andrew Henle over 6 years
    So you've been dealing with this for seven and a half years?!?! You'd think by now the "developers" you're dealing with would have made it out of primary/elementary school.
  • Quandary
    Quandary over 6 years
    @Andrew Henle: No, we actually chose another solution - a case-sensitive windows partition (ext3). Now the issue resurfaced with .NET Core, and this is the solution I came up with. Now I have a case-insensitive Linux-partition without needing fuse/ciops, smb, hfs/hpfs+, a hacked extX-fs, loop mount or any of that crap. This is the proper way. And so far, nobody actually answered the question satisfactorily in the last 7 years, so I thought I would.
  • Jorge Yanes Diez
    Jorge Yanes Diez about 4 years
    Thank you, I got it working. For people looking at this in 2020, be aware the linux kernel 5.2 and e2fsprogs 1.45 added casefold support for ext4. See this: unix.stackexchange.com/questions/558977/…
  • Quandary
    Quandary almost 4 years
    This looks more like a mono-bug than a case-sensitivity issue.