Mounting a case-insensitive filesystem on Linux

Thursday, the 25th of November, 2010
closeThis post was published 2 years 6 months 25 days ago and I may have changed my mind since then or the information could be out of date.

Recently I had a web developer who was coding on a Linux server, he was used to working on Windows servers and was having problems dealing with the case sensitivity of the EXT3 filesystem. I looked into it and in addition to using the Apache mod_speling [sic] module, also decided to go a step further. As root or using sudo do the following:

  1. Create a file of the size you wish the filesystem to be, 1GB in this example:
    dd if=/dev/zero of=fat32.disk bs=1K count=1M
  2. Format the filesystem, fat32 in this example but you can use NTFS or another case-insensitive file system:
    mkfs.vfat fat32.disk
  3. Mount the filesystem and test it, you may wish to use uid= and gid= to mount it as a specific user and you’ll probably want to adjust the umask to something less permissive:
    mount /media/fat32.disk /var/www/fat32 -t vfat -o loop,owner,group,umask=000
  4. Add it to /etc/fstab so that it gets mounted after a reboot:
    /media/fat32.disk /var/www/fat32 vfat loop,owner,group,umask=000 0 0

I wouldn’t use this for production systems, in that situation I’d recommend a dedicated FAT32 or NTFS partition. If you do have to run this on a production system it should be fine for 99% of setups, it just feels like a quick hack to me.

  • Graeme
    February 24th, 2012 at 07:44

    A very interesting idea to use a disk image. Alternatively, you could simply format your Linux filesystem using JFS, and specify the -O option when you format it. This makes the JFS partition case insensitive. JFS is a IBM created file system, is really fast, journaled and can recover from just about any failure without problems. We have been using JFS in Linux productions systems for years.

    eg:
    mkfs.jfs -L MyDisk -O /dev/sda1

Leave a comment