Transferring files over samba on exFat formatted drive (intentional or oversight)

Hi all,

I’m hoping someone can clarify whether this is expected behaviour or whether I’ve misunderstood something.

I’m running Volumio 4 on a Raspberry Pi, with my music library on an external USB SSD formatted as exFAT. Playback works perfectly, but the drive is read-only when I access it over SMB from my Mac, so I can’t copy new music onto it over the network.

I thought I’d have a bit of a dig around over SSH to see if I could understand what was happening.

From what I can see, Volumio mounts my drive with
mount /dev/sdb2 /mnt/USB/MUSIIIICK -o noatime

The resulting mount options are
rw,noatime,fmask=0022,dmask=0022

and the mount is owned by root:root.

I then traced the mount process to
/volumio/app/plugins/system_controller/networkfs/index.js

where vfat and ntfs receive
noatime,dmask=0000,fmask=0000,iocharset=utf8

whereas exfat appears to fall through to simply: noatime

From my (very limited) understanding, that seems to result in the default exFAT permissions being applied, which then prevents write access over SMB.

Have I understood that correctly, or is there another reason exFAT is handled differently? Is this intentional, or could exFAT simply be missing from that special-case logic?

I’d really appreciate any clarification. I’m trying to understand how Volumio is intended to behave rather than just patching files if there’s already a supported approach.

Thanks very much.

Is reported as bug, so far zero response.

But you narrowed down where the issue is :=)

Hi Wheaten,

We tracked the issue down.

The exFAT filesystem falls through to the default mount options in networkfs/index.js, so it is mounted with only noatime.

As a result, the filesystem isn’t owned by the volumio user and Samba clients (Finder in my case) have read access but can’t write.

I modified ControllerNetworkfs.prototype.mountPartition() to add an exfat case:

} else if (partitionData.fsType === ‘exfat’) {
var options = ‘noatime,uid=1000,gid=1000,dmask=0000,fmask=0000,iocharset=utf8’;
}

After restarting the Volumio service (sudo systemctl restart volumio), the drive mounted with:

uid=1000,gid=1000,fmask=0000,dmask=0000

Finder can now write to the Samba share correctly.

The service restart is important because Node keeps the original JavaScript in memory until it’s restarted.

It looks like exFAT simply needs to be handled in the same way as VFAT/NTFS when building the mount options.

Thanks again for pointing me in the right direction. I learnt a lot while tracking this down!

ControllerNetworkfs.prototype.mountPartition = function (partitionData) {
  var self = this;

  if (partitionData.fsType === 'vfat' || partitionData.fsType === 'ntfs' || partitionData.fsType === 'exfat') {
    var options = 'uid=1000,gid=1000,noatime,dmask=0000,fmask=0000,iocharset=utf8';
  } else {
    var options = 'noatime';
  }
1 Like

Excellent, thanks Wheaten.

I changed it slightly differently during testing (using a separate else if for exFAT), but the result was the same. Your approach of simply including exfat alongside vfat and ntfs is definitely the cleaner solution.

For completeness, here’s the version I tested successfully:

if (partitionData.fsType === ‘vfat’ || partitionData.fsType === ‘ntfs’) {
var options = ‘noatime,dmask=0000,fmask=0000,iocharset=utf8’;
} else if (partitionData.fsType === ‘exfat’) {
var options = ‘noatime,uid=1000,gid=1000,dmask=0000,fmask=0000,iocharset=utf8’;
} else {
var options = ‘noatime’;
}

After restarting the Volumio service (sudo systemctl restart volumio), the drive mounted with:

uid=1000,gid=1000,fmask=0000,dmask=0000

Finder can now write to the Samba share without any issues.

Thanks again for pointing me towards the relevant code. It turned into quite an enjoyable investigation and I learnt a lot along the way!

1 Like

We won’t be providing guidance on this. If you have to ask how to do it, you probably shouldn’t be doing it.

It will break OTA updates.

I figured out which file to edit. I’ve been a Unix user since 1975 and a Linux user for a decade or so, and Volumio for a few years. I just never looked into Volumioi internals. Thanks for your comment.

I edited /volumio/app/plugins/system_controller/networkfs/index.js with this solution (adding exfat to the vfat and ntfs cases) and it’s now working like a champ. Thanks.