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?
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..".
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.
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.
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.