Distinguish devices on Linux

Get help for specific problems
Posts: 6
Joined: 14 Sep 2017

syncer

Is it somehow possible to help FreeFileSync distinguish different devices on Linux, so that it could automatically scan them in 2 parallel threads?
I mean, FreeFileSync does already know how to distinguish drives on Windows (by drive letter) and (S)FTP servers (by their addresses). But in Ubuntu, FFS interprets all local paths as the same device, right? (as all devices are mounted to a unified tree with a single root / ).
In my specific case, I'm syncing a local folder with a remote Windows share SMB folder. As FFS itself doesn't support SMB, I'm using the feature that Ubuntu provides by default -- it automatically mounts SMB shares to local filesystem tree via GVfs, e. g. to
/run/user/1000/gvfs/smb-share:server=<srv>,share=<shr>,user=<usr>/<remote-path>
But generally speaking, all local devices are also mounted to the same unified tree, therefore FFS treats all that paths as stored at same device "/" and doesn't scan them in parallel.
Is it possible somehow for me to make FFS distinguish them and scan them in 2 parallel threads? (one thread for local folder and the other one for SMB share)
Posts: 6
Joined: 14 Sep 2017

syncer

Or maybe it'd be better if FFS on Linux would automatically detect that a path starts with
/run/user/\d+/gvfs/
and treat every path matching the pattern
/run/user/(?<UID>\d+)/gvfs/(?<share>.*?)/.*
as a separate device? IMO, it'd be really cool!
Of course, this won't solve the problem that local devices are mounted to the same filesystem root, but would fix the problem with remote SMBs and others mounted via GVfs...
Though, GVfs only belongs to GNOME, therefore doesn't fit other desktop environments...

P. S. I've just noticed that FFS does distinguish at least removable media as separate devices, e. g.
/media/<user-name>/<usb-stick-name>
therefore it already has some similar functionality, but unfortunately cannot do this with SMB shares.
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

Indeed FreeFileSync currently tries to detect device names using a heuristic like:
/media/<username>/<device name>
/run/media/<username>/<device name>
I've added:
/run/user/<userid>/gvfs/<device name>
This should cover the most common device mounts that occur on various Linux distributions.
https://www.mediafire.com/file/57ddlskgzf581rs/FreeFileSync_10.6_beta_Linux.tar.gz
Posts: 6
Joined: 14 Sep 2017

syncer

That's awesome! Works like a charm, thank you!
BTW, I'd suggest you to add another pattern --
/mnt/<mount-name>/
-- because the /mnt folder in Linux is explicitly meant for this purpose -- to mount there devices and filesystems -- the only difference between /mnt and /media is that to the /media folder devices are mounted automatically by the OS when it detects them, and to /mnt -- only by an explicit configuration by the user. I'm not sure about this, but this is what I've read about them, e. g.: https://askubuntu.com/questions/22215/why-have-both-mnt-and-media

P. S. I've just now googled it and found that like media has two variants (/media and /run/media), same mnt does: /mnt and /run/mount. But I personally have never seen /run/mount in use. I'm not an Ubuntu expert though :) Just a user.
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

Good idea, I've added "/mnt/<device name>". Now automatic and manual device mounts are nicely handled.