Renaming not working properly in google drive mount

What is the problem you are having with rclone?

I am simply trying to rename files in my google drive mount using mv command . The issue is that as soon as i run that command , mount updates the filename for 1,2 seconds and then immediately reverts it back to the older name . It then takes a good 2,3 minutes for the filename to update . Google Drive app properly shows the updated filename immediately after the mv command without any issues .i have been facing this issue for quite some time now . Here's a small 90 sec screen recording of this issue - drive_mount_issue.mp4 - Google Drive . I have also attached the log at bottom . In this case , i simply rename a file named 9GB.bin to 1 GB.bin , mount shows the updated file ( 1GB.bin ) for 1,2 seconds and then reverts back to the older name and then filename doesn't update to 1GB.bin for good 2,3 minutes

What is your rclone version (output from rclone version)

-->

rclone v1.55.1
- os/type: linux
- os/arch: amd64
- go/version: go1.16.3
- go/linking: static
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Google drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone mount fbmount: /GD \
--log-level DEBUG \
--umask 002 \
--poll-interval 15s \
--vfs-cache-mode writes \
--allow-other

The rclone config contents with secrets removed.

[fbmount]
type = drive
client_id = XXXX..
client_secret = XXXX..
scope = drive
token = XXXX..
team_drive = XXXX..
root_folder_id = 

A log from the command with the -vv flag

https://raw.githubusercontent.com/xd003/log/main/fbmount.log

Can you update to the latest release and retest as you have an old version.

I am sorry for the mistake , i mistakenly entered the rclone version from my android device while this issue was reproduced on my vps with drive mount using the latest rclone version , updated in post too

Can you post the full log file please.

Actually before reproducing this issue , i had to clear the log file since it had become like 1gb+ in size as its continuously mounted . So i cleared log file totally . Ran mv command, reproduced and i grabbed the log

If the log prior to the reproduction of issue is also important , should i rather do this ? - clear log , restart mount systemd service , run mv command and reproduce issue and then send that log. Will this do the job ?

Really need a full log to validate everything is running as described. Run debug, recreate the issue and share the full log.

Added another log without clearing it before

When you update previous posts, folks have no idea what changed in the post so it's almost impossible to follow :frowning:

In updated log , i reproduced the issue by renaming the files in exact same scenario as already mentioned in post .

Hmm, not sure what is going on there yet!

Can you rclone lsf the directory on drive, so rclone lsf fbmount:path/to/dir both before and after the mv and hopefully that will tell us whether this is a file system caching problem or not.

I think judging from the log that the rename is failing on google drive somehow, so can you do a rename on the command line like this

rclone move -vv --dump bodies fbmount:path/to/file fbmount:path/to/newFile

And post that output.

Here is a output of the rclone --config=$HOME/.filebot/rc.conf move -vv --dump bodies fbmount:Test/1GB.bin fbmount:Test/9GB.bin

https://del.dog/ickuxubexo.txt

Instead of simply renaming 1GB.bin to 9GB.bin , rclone created a directory named 9GB.bin and moved 1GB.bin inside that , pretty weird , any clue ?

Sorry, my mistake.... The destination of rclone move is always a directory! I always forget this.

If you want to rename a file you want rclone moveto

So

rclone --config=$HOME/.filebot/rc.conf moveto -vv --dump bodies fbmount:Test/1GB.bin fbmount:Test/9GB.bin

That move appeared to work according to the log.

Can you do the move above, then immediately after do

rclone --config=$HOME/.filebot/rc.conf lsf fbmount:Test

I suspect this might be caused by team drive directory caching. Repeat the lsf command if it showed the wrong thing at intervals until it shows the right thing.

rclone --config=$HOME/.filebot/rc.conf moveto -vv --dump bodies fbmount:Test/1GB.bin fbmount:Test/9GB.bin seems to have worked well

Log - dogbin - efingogroc

As of now , I couldn't reproduce this issue using this moveto command . So now i am curious whether rclone moveto command used above is any different than doing cd to the directory where file is present and then doing mv oldname newname because this issue i reported seems to be occurring with mv command only .

PS \ Even tho this moveto command becomes bit long , i am fine by using it in case simply using mv is not recommended or something , atleast i won't have that weird renaming issue

OK.

They both call the same bit of code eventually so should work the same :man_shrugging:

Have you run rclone dedupe on your drive BTW? If you had a duplicate Test directory that might explain things.

Can you do the same test but with the mv now

So something like

rclone --config=$HOME/.filebot/rc.conf lsf fbmount:Test
mv /mnt/Test/1GB.bin /mnt/Test/9GB.bin
rclone --config=$HOME/.filebot/rc.conf lsf fbmount:Test
ls /mnt/Test

Wait a bit for the bad thing to happen and then do

rclone --config=$HOME/.filebot/rc.conf lsf fbmount:Test
ls /mnt/Test

Its helpful if you can paste the commands and results you get from them so I can see exactly what is happening - thanks!

This issue seems to be quite random . It takes some attempts to reproduce it . I tried to rename multiple directories Test and Test2 to 'Test MID' & 'Test2 MID' respectively . The issue occured with renaming the first directory Test , Test2 got renamed properly while Test got reverted to its oldname and it got updated almost 2,3 mins later

Here's the debug log

Have a look at around Line 99 , it logged renaming the Test directory . Secondly check Line 282 , you see see that logging is displaying the old directory name . In mount it got updated checking with ls quite later ..

I hope this helps

I think this is probably team drive listing caching which is a known problems.

Rclone does stuff to the team drive, it accepts it, but the listing doesn't update.

The sequences of events seems to be

  • rename
  • dir looks OK
  • change notify notification comes in
  • rclone re-reads directory and reads old directory

So I suspect if the directory is reading the wrong item, if you clear the VFS cache (you can wait 5 minutes which is the default or send rclone a SIGHUP or use the rc then read it again, sooner or later it will read the correct directory.

Do you mean Test got updated to what it should be after 3 minutes?

If you make this bigger --poll-interval 15s it will make it much less likely according to the theory above... If you make it smaller it should happen more often.

Yes that's correct .. it took approx 2-3 mins
I continued the above process and waited for ls to list it correctly then grabbed the log file again , do you need that log file if it helps by any means ? ( Can say its a 2 minute extended log of the one i just sent here )

I don't need the log of that.

I think if you tried enough times you could replicate this with rclone moveto followed swiftly by an rclone lsf also.

Try changing the --poll-interval as above.

Yes I feel I have tested it enough with mv . i will proceed testing with moveto and let you know if i can replicate it , will send the log as well when i do. Might take a bit of time as its random

1 Like

@ncw

Sorry got bit delayed to report this
So now after testing extensively i can confirm that this issue occurs with rclone moveto/move command as well

Also unlike last time where i was guessing the time it takes to update file/folder name in mount , this time i have actually calculated the very exact time using timer and you would be surprised to know that in each of the tests it took exactly 5 minutes to update the name in mount

Now talking about the logs . I have reproduced it many times but sending you logs from 2 instances with explanation

Example 1
Here i have renamed 2 folders using rclone move and 1 file using moveto command .. 2 of them got updated in mount instantly but 1 didn't . You can check in line 75 , there's a change notify . Now keep scrolling you will notice that rclone always read this folder from line 75 by its old name only . Only at around line 2753 ( exactly 5 mins later ) rclone finally read the folder with its updated name
Log - Untitled - Pastebin.com

================================================================

Example 2
Here too i have renamed the same 2 folders & 1 file as above . In this case , literally none of the them got updated in mount immediately. Each of them got updated exactly after 5 mins

Change notify around lines - 166,172
Only after around line 2395 ( exact 5 mins later ) , rclone eventually started reading them with the new names
Log - Untitled - Pastebin.com