Skip to content

Allow skipping Full Rescan on startup if Interval has not yet been exceeded. #5353

Description

@SkyLined

I've setup a very long Full Rescan Interval for my folders but when I restart Syncthing, all folders are scanned even when they have already been scanned within this interval. If this is intentional, please add a setting to disable this.

Background: I am running Syncthing on a slow Raspberry Pi. Full Rescans consume 100% CPU, RAM and I/O, which makes the WebUI (and SSH) almost impossible to use. I am trying to avoid them by setting a very large interval but when I restart Syncthing, I basically cannot use the WebUI for a few hours because of all the unwanted rescans taking place.

Version Information

Syncthing Version: v0.14.54, Linux (ARM)
OS Version: Linux 4.14.69+ on Raspberry Pi
Browser Version: n/a

Activity

  1. desbma commented on Dec 7, 2018

    @desbma
    Contributor

    Full Rescans consume 100% CPU, RAM and I/O

    Maybe you can improve that by lowering the CPU and IO priority, or even better use a different scheduler.

    For example if you use the syncthing@ service, with a syncthing user:

    sudo mkdir -p /etc/systemd/system/[email protected]
    echo '[Service]
    CPUSchedulingPolicy=idle
    IOSchedulingClass=idle' | sudo tee /etc/systemd/system/[email protected]/low-priority.conf
    systemctl daemon-reload
    systemctl restart [email protected]
    

    For the other part of your issue, I am not familiar with that part of the code, but I suspect the initial scan can not be avoided, because Syncthing does not know if your files have been modified when it was not running.

  2. SkyLined commented on Dec 7, 2018

    @SkyLined
    Author

    Thanks, that suggestion sounds like it should solve some of my problems but might make the WebUI sluggish as it will also be throttled down... so, I'll give it a try to see how well it works.

    Wrt. not knowning if a rescan is needed: in that case this bug would be a feature request for Syncthing to store a timestamp for the last scan on disk and read that at startup to avoid a rescan when none is needed.

  3. calmh commented on Dec 7, 2018

    @calmh
    Member

    Doing a scan at startup to kick off the schedule is intentional. With the default setting the difference isn't relevant. However in cases like yours where rescans should happen about once a day, I can see how rescanning everything on startup might be annoying. We could fix that, probably.

  4. added
    enhancement
    on Dec 7, 2018
  5. changed the title [-]Full Rescan Interval not applied on startup[/-] [+]Allow skipping Full Rescan on startup if Interval has not yet been exceeded.[/+] on Dec 7, 2018
  6. SkyLined commented on Dec 7, 2018

    @SkyLined
    Author

    Fair enough, make this a feature request then :)

  7. desbma commented on Dec 7, 2018

    @desbma
    Contributor

    Wrt. not knowning if a rescan is needed: in that case this bug would be a feature request for Syncthing to store a timestamp for the last scan on disk and read that at startup to avoid a rescan when none is needed.

    How would you handle the case where the local files have been modified when the service (and the inotify watch) is not running?

  8. desbma commented on Dec 7, 2018

    @desbma
    Contributor

    Thanks, that suggestion sounds like it should solve some of my problems but might make the WebUI sluggish as it will also be throttled down...

    If the scan is currently CPU bound, yes it is likely to slow down the web UI too. However if it is IO bound, it should remain reactive, only the background scan may take longer to run.

  9. calmh commented on Dec 7, 2018

    @calmh
    Member

    I think this could only apply in the case where filesystem notifications are disabled. If we are running with notifications we need the initial scan to have a baseline for notifications.

    If we are running without notifications and have a rescan interval of an hour, it doesn't hurt to wait half an hour or whatever remains of the rescan interval on restart.

  10. SkyLined commented on Dec 7, 2018

    @SkyLined
    Author

    How would you handle the case where the local files have been modified when the service (and the inotify watch) is not running?

    Syncthing would now know about it until it did a full re-scan less than a day later. But this is not different from running Syncthing with "Watch for changes" disabled, so I do not see a problem with that (unless I am missing something).

  11. SkyLined commented on Dec 7, 2018

    @SkyLined
    Author

    If we are running without notifications and have a rescan interval of an hour, it doesn't hurt to wait half an hour or whatever remains of the rescan interval on restart.

    Indeed; in my case it is a day but I do not care if my backup is out of sync for a day.

  12. AudriusButkevicius commented on Dec 7, 2018

    @AudriusButkevicius
    Member

    I recall there were other reasons to run a scan. Mostly to prime caches todo with completion, but perhaps these days this is not important anymore.

  13. desbma commented on Dec 7, 2018

    @desbma
    Contributor

    Sorry if this has already been answered elsewhere, but on Linux when inotify is used (the default), why is a periodic rescan even needed?
    If Syncthing first setups the inotify watches, and then does the initial scan (in that order to avoid races), why isn't that sufficient to be immediately notified of all futures filesystem changes?

    EDIT: The doc says :

    Even with watcher enabled it is advised to keep regular full scans enabled, as it is possible that some changes aren’t picked up by it.

    But does not explain how changes can be missed.

  14. calmh commented on Dec 8, 2018

    @calmh
    Member

    Not all types of changes generate events, and events may be dropped due to overflow.

  15. desbma commented on Dec 8, 2018

    @desbma
    Contributor

    Care to elaborate?

    I use inotify on another projet an I am interested in its limitations. I have only found some on FUSE filesystems.

    If you are refering th the /proc/sys/fs/inotify/max_* overflow, then syncthing knows when it hits that limit, and could then fallback to heavyweight "full rescan to poll changes" approach (with a big fat warning to inform users that bumping the limit will improve performance).

  16. 21 remaining items

  17. Hoeze commented on Feb 18, 2025

    @Hoeze

    Is there a way to keep syncthing running and listen for file system changes but only distribute them once I am back on WiFi?

  18. added theissue type on May 30, 2025
  19. isoos commented on Nov 17, 2025

    @isoos

    Question to syncthing developers: would you merge this feature if somebody implemented it / e.g. looking for contributors who implement it? Or is this something you wouldn't merge anyway?

  20. nvsystems commented on Dec 19, 2025

    @nvsystems

    Please allow this feature. The rescan on startup for large folders is incredible draining on the battery of laptops. And it's not useful: on a non-multi-boot system the files will not have changed between shutdown and the next boot. A periodic rescan occasionally is more than enough. Suggestion: something like "rescan after X days have elapsed (configurable) along with a checkbox [X] only when on mains power".

  21. Martchus commented on Dec 19, 2025

    @Martchus
    Contributor

    Question to syncthing developers: would you merge this feature if somebody implemented it / e.g. looking for contributors who implement it? Or is this something you wouldn't merge anyway?

    I guess this comment from @calmh can be interpreted so that the answer to your last question is "yes":

    The latest news, as of 12 seconds ago, is that we're not aware of anyone working on this. That could change at any time!

    And after briefly scrolling though the comments I also haven't read a clear "no" from the Syncthing devs who participated in the conversation.


    And it's not useful: on a non-multi-boot system the files will not have changed between shutdown and the next boot.

    Files might have changed in the time window when Syncthing was not running. However, I agree that when keeping this time window low and when doing periodic rescans anyway than most people can probably live without a rescan on startup so it at least shouldn't be forced.


    By the way, the usefulness of this feature came also up in Martchus/syncthingtray#392 which is about dealing with metered network connections. One reason that speaks against completely stopping Syncthing when the network connection is metered are these forced rescans on startup. For many folders on my phone even manual rescans are good enough as they are mostly used as receive-only folders.

  22. rcarmo commented on Jan 6, 2026

    @rcarmo

    This (and being able to schedule syncs for specific times, not just intervals) would be amazing. I have a NAS where I can't set CPU or container priorities and where Syncthing completely swamps my CPU at random, and restarting it only makes the problem worse because it then goes and rescans everything...

  23. falcon4fun commented on Apr 21, 2026

    @falcon4fun

    Similar problem here. Would ask to allow "Rescan on logon (once per XX hours at maximum)" like for example ESET Task Scheduler has "Run the task only once within the specified interval"

  24. milroneth commented on Aug 4, 2026

    @milroneth

    If this hopefully gets implemented, I'd like to add that it would make a lot of sense to be a per-folder setting and not a global one. Small folders that see constant changes would better be re-scanned on startup, while larger less-active ones wouldn't.

  25. altring commented on Oct 6, 2026

    @altring

    I've successfully implemented this feature and currently testing it on Windows 11 x64:

    Image Image
  26. altring commented on Oct 6, 2026

    @altring

    Also on my Asus router on armv7sf
    It starts with DB migration first of all as the latest available Entware version is 2.0.15

    Image The feature looks good and works as expected on the first glance on my Asus AX3000_v2 router as well: Image
  27. altring commented on Oct 6, 2026

    @altring

    I want to test it for a few days and I'll be ready to submit a PR for that.
    I'm wondering what is the correct procedure to be able to submit a PR.
    First of all I should be assigned with this issue I believe?

  28. jms19 commented on Oct 13, 2026

    @jms19

    I've successfully implemented this feature

    Thank you so much @altring ! The only other way I can think of without changing the code myself is to run syncthing in a virtual machine so it can be suspended and resumed.

  29. Martchus commented on Oct 13, 2026

    @Martchus
    Contributor

    29. I want to test it for a few days and I'll be ready to submit a PR for that.

    Sounds great, so thanks for looking into this. Have you made any progress?


    31. The only other way I can think of without changing the code myself is to run syncthing in a virtual machine so it can be suspended and resumed.

    If you're on Linux you, can send SIGSTOP/SIGCONT. This probably works for Syncthing, although you probably want to use a process group to ensure both, the main and monitoring process are covered.

  30. altring commented on Oct 21, 2026

    @altring
     Sounds great, so thanks for looking into this. Have you made any progress?
    

    Yes, I tested it very good both on ASUS AX3000V2 router and on Windows 11 and the functionality itself works perfectly as expected.
    The only important thing for folks who want to run syncthing on a router with SSD attached: you will need to have swap file deployed and swapiness configured in your router.
    Without this syncthing will consume all remaining memory even with GOMEMLIMIT set. On large chunks of data indexing will choke the router.
    Here is the settings in my post-mount file that make syncthing and router run pretty smothly and stable:

    swapon /tmp/mnt/Main/myswap.swp # Added by amtm
    
    echo 80 > /proc/sys/vm/swappiness
    echo 32768 > /proc/sys/vm/min_free_kbytes
    
    export GOMAXPROCS=2
    export GOMEMLIMIT=256MiB
    

    With swap you can set the latter to even high value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions