« Back to all recent discussions

How to configure Samba share to sort alphabetically?

NickbaNickba Posts: 5  Junior Member
edited January 28 in Questions
Hello,

I have a NAS326 and I have some devices that cannot sort alphabetically on clients end. I need to configure need the NAS326 to sort alphabetically. I tried to edit the smb.conf, but it didn’t work.


#NAS_Jan_2020

Answers

  • MijzelfMijzelf Posts: 1,073  Heroic Warrior Member
    AFAIK Samba doesn't do any sorting at all. That is left to the client.

    What did you try to change in smb.conf?
  • NickbaNickba Posts: 5  Junior Member
    Hello,

    Thanks for replying. I have a Synology NAS and it does have an option to sort alphabetically.

    I put this in the smb.conf:

    vfs objects = dirsort

    Does anyone have any tip to make it work?






  • MijzelfMijzelf Posts: 1,073  Heroic Warrior Member
    OK. A vfs module is a sort of plugin. In this case the module is part of the samba suite. The NAS might have a stripped down version which doesn't contain this plugin. Don't know if that is possible.

    How did you test the smb.conf change? Did you restart samba after that?

    /etc/init.d/samba.sh restart

    An other option is to sort the files on the NAS itself. This is only feasible on mainly static shares, as new files aren't added alphabetically.

    Sorting is easy:
    su
    cd /path/to/share
    mkdir tmpsort
    mv * tmpsort/
    mv tmpsort/* .
    rmdir tmpsort

    Note the dot at the end of the 2nd mv. The theory here is that the shell will exchange the * by an (alphabetically sorted) list of filenames, and mv will move them in that sequence. As the move is within the same filesystem, it's only administative, and blazing fast.

  • NickbaNickba Posts: 5  Junior Member
    Hello Mijzelf,

    Thanks again for replying.
    Yes, I did restart samba after I changed the smb.conf and it didn't work.

    I tried your suggested static solution, it moved the the files ok, but when I tested on the network, the files didn't sort alphabetically. Maybe samba pick the files randomly to show the list if  vfs objects = dirsort cannot be used.

    Do you know if there is a way to configure the NFS plugin app to sort alphabetically? I am asking because the clients also support NFS. 


  • NickbaNickba Posts: 5  Junior Member
    edited February 16
    Hello again,

    I installed OMV on an old PC and it accepts the option vfs objects = dirsort and works perfectly.

    Do you know a simple method of installing OMV on the NAS326?


  • MijzelfMijzelf Posts: 1,073  Heroic Warrior Member
    OMV runs on top of Debian. So https://forum.doozan.com/read.php?2,88619

Sign In or Register to comment.