Accessing long filenames (directories) via SMB

Windows can enable long filename support via the registry, but long filenames are not supported in TrueNAS and SMB access. I’m not sure which side is causing the problem, but I’d like to know if it’s possible to improve this in the future.

1 Like

How long of filenames are we talking about? The problem generally is that it’s one thing to do this on a local filesystem, and another to do it on a server. In the latter case you start breaking clients in new and interesting ways if they don’t expect the change. Are you talking about path length or actual length of the file’s name?

The complete filename (including the directory) would look something like: /mnt/pool/longfoldername/longfilename.mp4

In an SMB share, it would typically be \server\Data\Video\longfoldername/longfilename.mp4

More than 256 bytes in a file name is not going to happen. It will most likely break a large number of SMB clients. Longer paths with multiple components is possible.

```
smb: \aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb> allinfo foo
altname: foo
create_time: Tue Nov 25 20:22:24 2025 CST
access_time: Tue Nov 25 20:22:24 2025 CST
write_time: Tue Nov 25 20:22:24 2025 CST
change_time: Tue Nov 25 20:22:24 2025 CST
attributes: A (20)
```
Have you tested this?

Yes, the actual issue is an excessively long path. On Windows, removing the path length limit (MAX_PATH) allows files to be read and written normally on the local disk, but when I try to move the file to the TrueNAS’s SMB, it fails to write.

I recently searched for software issues and found that its users and developers have already resolved the issue of the software reading long-path files via SMB, so I believe this might be a Samba or TrueNAS problem.

I also tested it; on a Windows server with long path support enabled, another Windows machine with long path support enabled can access the SMB share normally. The Android app can also access it normally.

Is that the registry edit? If so, I wouldn’t say that it’s been resolved in a way that Microsoft feels is good enough. When they feel confident with it I would expect them to enable it by default.

hmm is there also a zfs limit? I think I am experiencing some strange issues with file path/name lengths while transferring stuff from a synology NAS. Both via sftp and smb.

Some of the paths just look like they are truncated with random character names in the title, but if I use file browser on truenas, the actual names of the directories seem fine. However, these file locations/files won’t seem to transfer over correctly and will error out when trying to move them.

That is related to invalid characters for SMB protocol.

Are there any plans to support long paths (or improve related services)? I think this might be a bug.

The same long paths work fine in Windows and Debian(using Windows as the SMB server),

but in TrueNAS’s SMB service, it gives the following error:

Fastcopy: The filename, directory name, or volume label syntax is incorrect: 123
Windows Explorer: The specified filename is invalid or too long.

You have yet to provide specific examples. None of us can guess at what you are seeing. Feel free to use Report a Bug in the GUI (smile icon) or top, upper right of the forums Report a Bug if you don’t want to list items publicly.