How to configure Samba share to sort alphabetically?

Nickba
Nickba Posts: 17  Freshman Member
edited January 2020 in Personal Cloud Storage
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

All Replies

  • Mijzelf
    Mijzelf Posts: 2,600  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    AFAIK Samba doesn't do any sorting at all. That is left to the client.

    What did you try to change in smb.conf?
  • Nickba
    Nickba Posts: 17  Freshman 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?






  • Mijzelf
    Mijzelf Posts: 2,600  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    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.

  • Nickba
    Nickba Posts: 17  Freshman 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. 


  • Nickba
    Nickba Posts: 17  Freshman Member
    edited February 2020
    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?


  • Mijzelf
    Mijzelf Posts: 2,600  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    OMV runs on top of Debian. So https://forum.doozan.com/read.php?2,88619

Consumer Product Help Center