# case-insensitive filesystem



## Ajax (Mar 22, 2011)

Hello everyone,

If there is any chance I could create one? Really needed for my purposes but cannot find any mention about such option either in newfs or any other utilities.


----------



## dandelion (Mar 22, 2011)

Try ZFS, e.g.
`$ zpool create -O casesensitivity=[highlight]insensitive[/highlight] ...`


----------



## Ajax (Mar 22, 2011)

ZFS is a something new to me; any variants to stay within UFS?


----------



## SirDice (Mar 23, 2011)

Ajax said:
			
		

> Really needed for my purposes


Care to elaborate?

In any case there's no way to turn UFS case-intensive.


----------



## Ajax (Mar 23, 2011)

Well, seems I'm forced to use ZFS.

The main purpose for the server is to keep stuff for Mac developers. Since OS X uses case-insensetive HFS+ by default, sometimes it could be a problem to have Help.txt and help.txt in the same folder


----------



## Pushrod (Mar 23, 2011)

Here is a Perl script that scans for such files.

Tell the developers to use lowercase all the time.


```
use strict;
use File::Find;

my @subdirs;

usage() unless @ARGV;

foreach my $dir (@ARGV) {
        next unless ((-d $dir)&&(-r $dir)&&(-x _));
        find( sub { do_it($File::Find::name) if (-d $File::Find::name) }, $dir);
}

sub do_it {
        my $d=shift;
        unless(opendir(DIR, $d)) {
        warn "I can't open $d: $!";
        next;
        }
        my %dirents;

        while (my $f = readdir(DIR)) {
        next if ($f =~ /\.{1,2}$/);
        my $lc=lc($f);
        if (defined($dirents{$lc})) {
                print "In $d:\n [$dirents{$lc}] [$f]\n";
        } else {
                $dirents{$lc}=$f;
        }

        }
        closedir(DIR);

}

sub usage {
        print "$0: scan for 'FOO' and 'foo' in the same dir\n";
        print "Usage: $0 /some/dir/to/scan\n";
        exit(1);
}

__END__
```


----------



## Ajax (Mar 23, 2011)

Thank you. Guess I can mark this as solved â€” no any case-insensitivity on UFS but there are other political and administrative solutions


----------



## phoenix (Mar 24, 2011)

There's also FAT, which is case insensitive and supported by everything.


----------



## B0o-supermario (Jun 16, 2011)

Any other case insensitive file systems optimised for BSD and for web servers?


----------



## knightjp (Jun 23, 2018)

I do have a question. Is the ZFS file system case-sensitive or insensitive?


----------



## phoenix (Jun 24, 2018)

knightjp said:


> I do have a question. Is the ZFS file system case-sensitive or insensitive?



You can configure it for both, I believe.


----------



## knightjp (Jun 24, 2018)

phoenix said:


> You can configure it for both, I believe.


I have heard that, but I would like to know which is the standard. I have heard UNIX is case-sensitive as standard; especially in the shell. But what if you run a GUI on top? Does that remain the same?


----------



## Crivens (Jun 24, 2018)

Yes.


----------



## SirDice (Jun 25, 2018)

knightjp said:


> I have heard UNIX is case-sensitive as standard; especially in the shell. But what if you run a GUI on top? Does that remain the same?


It's the _filesystem_ that's case-sensitive. The filesystem doesn't change when you run a GUI.


----------



## knightjp (Jun 27, 2018)

SirDice said:


> It's the _filesystem_ that's case-sensitive. The filesystem doesn't change when you run a GUI.


Thanks for the info. I had heard that MacOS is case-insensitive as standard with the GUI and is only case-sensitive when you are using the "Terminal"... So my assumption was that there is some kind of separation in between. 
From what I know about computers, a file system is system wide and does not change based on the interface you use - GUI or CLI.


----------



## SirDice (Jun 27, 2018)

knightjp said:


> I had heard that MacOS is case-insensitive as standard with the GUI and is only case-sensitive when you are using the "Terminal"


MacOS's HFS filesystem is case-preserving and case-insensitive.


----------



## ralphbsz (Jun 28, 2018)

By default, HFS is exactly like SirDice said.  I think the root file system has to be configured that way.  It is case-insensitive both from the GUI and from the command line.  That can lead to humorous effects, for example:

```
# touch foo
# ls
foo
# ls FOO
FOO
# ls -l FoO
-rw-r--r--  1 ralph  ralph  0 Jun 27 21:26 FoO
```

When creating another HFS file system (on a separate disk or partition), it can be configured either case-insensitive or case-sensitive, either works fine.  User's choice.


----------

