Report free space on remote devices

Just realized it might be nice to be able to see how much free space is left on remote devices (in each folder separately). So i know how much data i can push there using syncthing before i run out of space.

3 Likes

Syncthing is not a machine monitoring solution, not even local one.

Setup proper monitoring software made for purpose, i.e prometheus/grafana with a host agent.

2 Likes

Basicaly i want to know how much audiobooks i can sync to my smartphone before going on a long trip. I don’t think prometheus/grafana would be reasonable solution.

Might be easy to check localy on the phone, but lets imagine that i’ve left my phone at home and i want to prepare the music for the journey from my PC while at the office or perhaps i want to sync the music to my wife’s phone, while she is shopping snacks for the trip.

1 Like

Syncthing is not a machine monitoring solution

yet it does show if remote machine is online or offline, just as monitoring solution would do. i would like to see really simple free space indicator just to know if i can sync more files to that machine or not.

1 Like

Sync as much as you can I guess, it should stop with an out of space warning before it fills up.

Not every syncthing setup is owned by the same person, so no reason to leak someone elses storage situation etc, for same reason things like sync errors etc are not available/visible on other devices.

3 Likes

Not every syncthing setup is owned by the same person, so no reason to leak someone elses storage situation etc

I get that point… Perhaps it can be opt-in (or even opt-out) feature?

Sync as much as you can I guess, it should stop with an out of space warning before it fills up.

That would mean to be constantly checking and waiting to see what happens. Then my device is full, but most important files were not synced, so i have to again delete some less important files (which i’ve just needlesly synced) just so the important files can fit and sync there.

If i can see that i have 2GB of free space, i just dump 1.5GB of music to the folder and forget about it.

2 Likes

We’ve gone against these sort of features before, even for locally checking cpu/ram usage etc, as that is not what the application is meant for. I don’t think our position changed on the matter.

2 Likes

We’ve gone against these sort of features before, even for locally checking cpu/ram usage etc, as that is not what the application is meant for.

True. Syncthing does not sync RAM contents, nor it does create CPU tasks remotely (as primary objective). So it would make little sense to monitor RAM or CPU.

Syncthing is used to sync data to storage devices, so when talking about simple indication of free space it is completely different story than CPU or RAM. I understand that you have to protect syncthing from scope creep, but this really feels well within the original scope.

At least as long as we consider that using syncthing on consumer devices at home is legitimate use case. If you say that syncthing is exclusively designed for big datacenters, then i would agree that you should go with separate industrial-grade monitoring system instead. But to be honest i think that syncthing has a lot to offer to everyday end users.

1 Like

Not actually related, see two posts below. This seems related to folder storage quotas. I don’t think that’s entirely out of scope, and I can see a good proposal/implementation be integrated. There’s an open enhancement request already: https://github.com/syncthing/syncthing/issues/4244

1 Like

Not sure I agree that “how much free space do I have on a remote device” is related to storage quotas.

1 Like

Actually, you are right. I was thinking about the underlying use-case and skipped on step in the thought process: Here the use-case managing media on a device (mobile) with limited storage. Now I thought you could just set the quota to that limit, then you see that on the remote too. That’s my mistake: If it were that easy, you could also just look at the directory size on the remote and add just the right amount of data. The quota would have to be relative to the mobile’s free space, so back to square one.

1 Like

I understood that syncthing uses some kind of filesystem abstraction layer. Is this layer already aware of the amount of available free space?

1 Like

I’m not sure what “aware” means specifically, but there is a way to check for free space. Syncthing does this when syncing files to try to make sure they fit instead of filling the disk.

1 Like

Displaying free space is also a bit more complex than it looks like at first glance. A single folder could contain multiple mountpoints.

2 Likes

That sounds promissing. I was afraid that one of the biggest challenges will be to implement free space checking in some platform-independent way. But now it seems the code is already in place and all we need to do is to send this information to other nodes.

Displaying free space is also a bit more complex than it looks like at first glance. A single folder could contain multiple mountpoints.

I don’t think we need to worry about this. This is unlikely on consumer devices which are target of this feature. if you need some more complex setup, you can deploy complex monitoring as well. i would just check space on root of shared folder. If you need to monitor complex mountpoint setup, but don’t wanna setup separate monitoring, you can always share each mount individualy.

1 Like

I would also support for this feature, although it is clearly not as simple as just showing the remaining space.

I am using Syncthing to sync multiple local folders to multiple remote devices, each of them syncthing on several of these folders, which means shared space for several synced folders on several devices. Here is an example: image

Assuming the space left is shared by the synced devices, each of them has its own. So it makes no sense to say that it remains xxx MB. Either we display the remaining space on each of them, or we assume there is a reduction logics to apply (take the min, max, avg, reference device, min over mobile devices, etc.). If we go the reduction route, one of them is to take the minimal space left. Only in this case, we can display something like “xxx MB remaining on yyy” with yyy being the synced device showing the least space left. Moreover, since it is a remote information, it is subject to obsolescence, which means that all we can do is showing the remaining space that was shared the last time we synced the device. In other words “xxx MB remaining on yyy on the last sync (zzz)” with zzz being the date of the update. Not only it makes the info heavy, but it can be fairly old if the device synces rarely (I have some devices like that, which sync manually, like every several months).

And that is just to display the minimal remaining space among your devices, assuming this is exactly what you want. But in fact, it can quickly come to needing a bit more here, then a bit more there, just to have something yet a bit more helpful.

Briefly, this kind of feature is a domain on its own. I would not expect Synthing to support that directly. Simple application of the single responsibility principle of SOLID softwares (yes you can apply them to a whole application too). But I agree this is useful and to be expected at some point, like many other things. Consequently, I would expect Syncthing to be extensible. Simple application of the Open-closed principle, a SOLID aspect too. Basically, other people should be able to produce plugins to cope with specific needs of specific contexts. Then the users can install the plugins they want for their own context.

A plugin support should allow several things, among which:

  • adapt the information sent to other devices, like the remaining space
  • know whether the plugin is effective on the remote device, to know whether such adaptation is applicable without disturbing the remote Syncthing (a bit like the Accept HTTP header)
  • adapt the processing of the receiving device to deal with this adapted information
  • adapt the interface to display the processed information correctly

Yet again, this is a domain on its own. However, the Syncthing team only needs to cope with the effort required by this one. Then any feature asked by the community to deal with specific needs can be answered with a genuine, positive answer: search for the plugin or create it.

I don’t know if there is such a (planned?) plugin support in Syncthing. But that would unlock a lot of things. And if there is current features that the team don’t want to support anymore, they can refactor them as plugins and provide them to the community as-is, before telling that they won’t maintain it anymore, so people actually needing it will have to take the lead. That would be a fair distribution of the work

1 Like

I have no idea how syncthing protocol looks like, but i can imagine that syncthing would send some kind of JSON formated string to its peers (on connection and later on each resync). That JSON might contain basic stuff like free storage space for each folder shared with given peer. Being JSON it would allow us to add few similar informations in future if needed without breaking compatibility, if that JSON variable is missing, it would simply mean that the peer does not support space reporting. On the flip side there would be no reason not to send free space to peers who do not know how to interpret that. They will simply ignore that JSON variable (simply by not parsing it which they don’t do anyway).

I agree this JSON should not be too big, just the most essential stuff like free space.

1 Like

In syncthing GUI when you click “edit” in the device list, you see all directories shared with that device. There can be free space reported for that individual device.

In list of folders i would the suggest to show minimal value from all devices. Also we can report that directory is 123% full, which would mean that at least one of the devices is not able to sync, because global state is 23% over its capacity.

1 Like

I would use this feature too (I sync stuff to my phone, which has more limited storage than my PC), so a +1 from me. But I can see that it’s more complex, and not what the application is really ‘for’ (whatever that means). A halfway house for me would be more obvious reporting when a remote device is out of space.

A halfway house for me would be more obvious reporting when a remote device is out of space.

Syncthing actualy already reports when sync fails for this reason.