Version History in google drive

I am mounting gdrive locally on my ubuntu machine. What I am seeing is that the versions maintained by google for any file in its drive is lost when I use the file on the remote mounted drive. Is there a way that gdrive maintains the versions when I change the file on mounted drive?

I am using rclone 1.56.2 on Ubuntu 18.04

Regards,
Seenu.

See:

That issue is about reading the old versions via rclone.

I think that @seenutn is concerned that new versions aren't being made - is that right?

New versions should be made if you are using rclone copy or sync.

I'm not sure about rclone mount though - what VFS cache mode are you using?

You are correct. Whenever a file on mounted drive is modified, I wan't it to be current version whereas the previous version is marked as "version 1,2,3..".

I am using "full" mode. (--vfs-cache-mode full) .

Regards,
Seenu.

I tried a simple test with --vfs-cache-mode full

I mounted my drive on /mnt/tmp

Then I ran

date -Is > /mnt/tmp/file.txt

And waited for it to be uploaded.

Every time I uploaded it I got a new version.

How are you uploading things?

It might be that the program you are using moves the old version out the way first - this will cause google to think that the file is a new file when it is uploaded.

I'm also getting the new version each time I modify, what I want is that whenever I modify a file, the existing file should be available as old version in gdrive and the newly modified file as new/current version.

Regards,
Seenu

That should be what is happening if you are getting a new version. You can download the old versions via the gdrive website, but not via rclone at the moment.

As you informed, this is happening for .txt or .ods files. But only the current version is present in case of .gnucash files. Any idea how to achieve versioning in case of .gnucash files also?

One more thing I observed: When I'm modifying the file using ">" operator, versions are available in gdrive whereas if I edit the file using editor like vi, only one version is available in gdrive.
1.mounted using rclone - cat "ver one" > version.txt
gdrive has one version of the file.
2.mounted using rclone - cat "ver two" > version.txt
gdrive has two versions of the file.
3. mounted using rclone - edit file with vi version.txt
gdrive has only the current version of the file.

Both of these things are due to the way vi/gnucash saves files.

Vi effectively does something like this when it saves files to be absolutely sure it doesn't remove your old file until your new one is saved properly

  • save file to file.new
  • move file.txt to file.old
  • move file.new to file.txt
  • remove file.old

This unfortunately breaks the history chain in google drive.

There is probably an option in vi to stop it doing this but I'm not a vi user.

It looks pretty easy to do in vim: editor - Disabling swap files creation in vim - Stack Overflow

To OP: This is very common (though usually without the moving the original file) as it is a way for a problem to save atomically. Imagine if you are writing a ton of data. You don't want to leave the file in a half-written state if something happens. So you write the data and then move it (where moves tend to be all-or-nothing). It does make it a bit harder on mounted rclone systems since cloud storage doesn't allow writing partial files. rclone does an amazing job hiding that from you most of the time but can have issues.

We might be able to put some more smoke and mirrors in if we find out exactly what vi is doing.

If it moves the new file on top of the old file which is a possibility, then it might be possible to create a version then.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.