Setting up rclone bisync

234 Views Asked by At

I'm setting up rclone to bisync a local folder to GoogleDrive.

It's up and running and I can mount GoogleDrive in a folder.

I've already copied the contents of my GoogleDrive into the folder that I want to bisync and now I need to start bisync.

I tried

# rclone bisync GoogleDrive: /srv/GoogleDrive/ --dry-run --resync --verbose

but the logs make it looks like it's going to copy all the data -- which is unnecessary because I've already got all the files, and that it's going to delete folders that exist in both the local and remote copy.

For example:

NOTICE: My Drive/Papers/FSMs/mp/12.mps: Skipped delete as --dry-run is set (size 7.271Ki)

but this file exists both locally and in my GoogleDrive and should not need anything doing.

and

2024/01/05 21:00:57 INFO  : Bisync successful
2024/01/05 21:00:57 NOTICE:
Transferred:      129.888 GiB / 129.888 GiB, 100%, 1.386 GiB/s, ETA 0s
Checks:             25612 / 25612, 100%
Deleted:            25612 (files), 3307 (dirs)
Transferred:        51147 / 51147, 100%
Elapsed time:     58m27.3s

129BG is nonsense because nothing should need copying.

What is going on?

1

There are 1 best solutions below

0
Richard Barraclough On

I couldn't get rclone bisync to work.

This seems to be working OK.

daysAgo () {
        if [ -z "$1" ] || [ $1 -gt $( date -d "-1 day" +%s ) ]; then
                echo "1"
                return
        fi

        n=2
        while [ $1 -le $( date -d "-$n days" +%s ) ]; do
                n=$( echo "$n + 1" | bc )
        done
        echo $n
}

if [ -z "$1" ] ||[ "$1" = "down" ]; then
        echo "down"
        last=$( grep down /var/lib/rclone-log | head -1 )
        if [ ! -z "$last" ]; then
                d=$( echo "$last" | cut -d ' ' -f 2 )
                dn=$( daysAgo $d )
                last="--max-age ${dn}d"
                sed -i "s/down.*/down $(date -d '-1 hour' +%s) sed/g" /var/lib/rclone-log
        else
                last=""
                echo "down $(date -d '-1 hour' +%s) echo" >> /var/lib/rclone-log
        fi
        rclone sync GoogleDrive: /mnt/space/GoogleDrive/My\ Drive/ $last --verbose
fi

if [ -z "$1" ] || [ "$1" = "up" ]; then
        echo "up"
        last=$( grep up /var/lib/rclone-log | head -1 )
        if [ ! -z "$last" ]; then
                d=$( echo "$last" | cut -d ' ' -f 2 )
                dn=$( daysAgo $d )
                last="--max-age ${dn}d"
                sed -i "s/up.*/up $(date -d '-1 hour' +%s) sed/g" /var/lib/rclone-log
        else
                last=""
                echo "up $(date -d '-1 hour' +%s) sed" >> /var/lib/rclone-log
        fi
        rclone sync /mnt/space/GoogleDrive/My\ Drive/ GoogleDrive: $last --verbose

fi