Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The default limit of how long a filename can be on EXT3 is 255 characters. I have a unique requirement where I need much longer filenames (apparently because mod_rewrite of apache uses filenames for storing). Is there any setting I can tweak to increase this limit from 255 characters? (Or if I can change mod_rewrite setting not to use files)

share|improve this question
2  
What kind of rules you have that require it? Used mod_rewrite quite a lot, and never had this kind of problems. –  user13185 Apr 28 '11 at 14:54
    
Actually, we have a htaccess definition which rewrites the URL. One particular URL (not including the query parameter part) is more than 255 characters long and htaccess is not triggering in that case. Try it. –  Paras Chopra Apr 28 '11 at 18:45
    
I would suggest to rethink/rewrite the mod_rewrite/htaccess logic. There is no sensible reason to need 256+ character filenames. Also - if you are rewriting url to another url (and not to filename) - filesystem limits are not related. –  user13185 Apr 28 '11 at 19:02
    
This is related to serverfault.com/questions/140852/… -- can you help? –  Paras Chopra Apr 28 '11 at 20:25

1 Answer 1

This is a fixed limit in ext2/3/4, so unless you can change filesystem or the length requirement you are stuck.

Reiser is the only common filesystem that springs to mind as supporting longer filenames than that (I know someone who chose it over ext2/3 for that reason, though I forget why he needed to support very long filenames).

The length limit is per name, so you can have paths longer than 255 characters as long as individual names along the path are not over-sized. This maybe enough to deal with the situation if you can update your rules to output paths of the form "/store/200-character-dir-name/200-character-dir-name/200-character-file-name" rather than "/store/600-character-file-name". Though requiring very long names with or without splitting it into paths for shorter names seems odd enough to imply there might be an overall design problem to be addressed (I say might as there could be good reason for the requirement!).

Be aware that even if you change filesystem or use the path approach to split the long names, some tools may not like the long names/paths (some archive/compression file formats won't support either, for example).

share|improve this answer
    
On Linux PATH_MAX is 4096. It might be possible to get around that for some syscalls by changing cwd and using relative paths, though. That being said, a redesign to not need such long file names in the first place is perhaps the least painful approach. –  janneb Apr 28 '11 at 16:38
    
Yes, redesign seems to be the way to go. Although sometimes customers won't listen that there is nothing we can do to circumvent 255 charatcer approach. –  Paras Chopra Apr 28 '11 at 18:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.