Skip to content

Deal with flushing the vfs cache on exit #1909

Open

Description

@ncw

Currently users don't know whether there is stuff in the VFS cache or not when quitting rclone.

Using --stats helps, but isn't a perfect solution.

From #1853

Although ideally a parameter that outputs if there's any transfer going on/files queued in cache that could be parsed in a script to check before unmounting or rebooting the server would be ideal!

Activity

  1. added this to the v1.40 milestone on Dec 12, 2017
  2. self-assigned this
    on Dec 12, 2017
  3. modified the milestones: v1.40, v1.41 on Mar 19, 2018
  4. mstgrv commented on Apr 5, 2018

    @mstgrv

    Stuff still being left in the cache on quitting Rclone is just a matter of reclaiming disc space, the bigger issue IMO is making sure that changes are committed to the remote, so that Rclone isn't terminated before changes have had a chance to be written.

  5. danielloader commented on Apr 5, 2018

    @danielloader
    Contributor

    In addition to that it'd be nice if vfs and cache rc commands had a vfs/queue and cache/queue option to spit out what's left to upload and when.

  6. Nodens- commented on Apr 6, 2018

    @Nodens-

    @mstgrv It's not about read cache. It's about what's in the write cache (VFS queue). Not sure how gracefully the interruption and resuming of the upload from the queue (restarting the rclone process with data still in queue) is currently handled (which is of course important) but it's also important to be able to see if the queue has been successfully transferred to the remote for use cases where the delivery of files is time critical (eg I need to know if the queue has finished before I go into downtime for upgrading the server/upgrade linux version/even just a reboot to a new kernel that may cause additional downtime when the files need to be there now and not in possibly two hours).
    Currently --stats is all you can use for this purpose. An rclone parameter that would output the status of the queue in a clear way on stdout, so it could also be scripted, would be ideal.

  7. modified the milestones: v1.41, v1.42 on Apr 28, 2018
  8. modified the milestones: v1.42, v1.43 on Jun 17, 2018
  9. modified the milestones: v1.43, v1.44 on Sep 2, 2018
  10. removed this from the v1.44 milestone on Oct 19, 2018
  11. 7 remaining items

  12. modified the milestones: v1.48, v1.49 on Jun 19, 2019
  13. modified the milestones: v1.49, v1.50 on Aug 27, 2019
  14. modified the milestones: v1.50, Soon on Oct 26, 2019
  15. Max-Sum commented on Sep 26, 2022

    @Max-Sum
    Contributor

    Any update on this?

  16. baurmatt commented on Apr 13, 2023

    @baurmatt
    Contributor

    I'm using the following code as workaround:

    rclone mount s3:my-bucket /mnt --rc --vfs-cache-mode minimal &
    
    ...
    
    while rclone rc core/stats | jq -e '.transferring'; do
      sleep 1
    done
    
    wget -q -O- --method POST http://localhost:5572/core/quit
    
  17. Max-Sum commented on May 16, 2023

    @Max-Sum
    Contributor

    I'm using the following code as workaround:

    rclone mount s3:my-bucket /mnt --rc --vfs-cache-mode minimal &
    
    ...
    
    while rclone rc core/stats | jq -e '.transferring'; do
      sleep 1
    done
    
    wget -q -O- --method POST http://localhost:5572/core/quit
    

    Thank you. I will use this workaround until flushing implemented.

  18. Max-Sum commented on May 17, 2023

    @Max-Sum
    Contributor

    I'm using the following code as workaround:

    rclone mount s3:my-bucket /mnt --rc --vfs-cache-mode minimal &
    
    ...
    
    while rclone rc core/stats | jq -e '.transferring'; do
      sleep 1
    done
    
    wget -q -O- --method POST http://localhost:5572/core/quit
    

    This workaround fails when:

    1. VFS write back is delayed
    2. Error occurred in the process of write back, retries are queued

    I made a similar workaround using vfs/stats.

    while [ $( rclone rc vfs/stats | tr -d '\n' | sed -E 's/^\{(.*,)?\s*"diskCache"\s*:\s*\{(.*,)?\s*"(uploadsQueued|uploadsInProgress)"\s*:\s*([0-9]+)\s*(,.*)?,\s*"(uploadsQueued|uploadsInProgress)"\s*:\s*([0-9]+)\s*(,.*)?\}.*\}/\4 + \7/' | bc ) -gt 0 ] ; do
      sleep 1
    done 
    

    Sorry for the messy regex. The environment of rclone docker image doesn't have jq. This is the only way I found.

  19. baurmatt commented on May 22, 2023

    @baurmatt
    Contributor

    Thanks for sharing! :) I think the jq equivalent would be:

    while [[ $(rclone rc vfs/stats | jq '.diskCache | [.uploadsInProgress, .uploadsQueued] | add') -gt 0 ]]; do
      sleep 1
    done
  20. ykuyo commented on Nov 23, 2024

    @ykuyo

    What about using rclone sync?

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions