Ubuntu – the maximum length of a file path in Ubuntu

directoryfilenamefilesfilesystem

Having used Windows systems for a long time, I know that at a certain point, an error window can appear when files and folder names become too long.

This happened to me when I tried to backup files with SFTP from a server to a folder in (for example):

D:(Windows drive partition)/Temporary/Projects/2015-06/Websites/Guitar-Site/Images/Logos/Manufacturers/Instruments/Basses/(long file name).png

As you can see, I tend to build very specified folder paths sometimes and if a file name happens to be long as well, NTFS might not be able to save it this way.

I'm currently worrying about my physical backups, as the folder path on my backup drive will add /backups/(drive name)/... to all file paths.

Is there any such limit (or a similar one) in ext4/Ubuntu that I would have to look out for?

Best Answer

The max filename length is 255 bytes. Found in the wiki page for ext4.

And a maximum path of 4096 characters. Found in this Unix&Linux SE Question.

Although, I did find this wiki article that does not specify a max file path in ext4.