google-drive-ocamlfuse icon indicating copy to clipboard operation
google-drive-ocamlfuse copied to clipboard

Duration till which headless authorization remains valid

Open DhruvBhagadia opened this issue 4 years ago • 9 comments

I am trying to use google-drive-ocaml through a GCP VM instance. I completed the headless authorization once and was successful in mounting my drive. However, when I stop the VM instance and restart again the authorization doesn't seem to work and asks me to authorize again.

My questions

  1. How long does the authorization work?
  2. GCP charges based on the uptime of a machine hence I'm bound to stop the VM after each use to prevent unnecessary deductions. Is there a workaround to make the authorization permanent?

DhruvBhagadia avatar Aug 10 '20 07:08 DhruvBhagadia

The authorization is valid until you manually revoke it. The refresh token is saved in ~/.gdfuse/default/state. If you keep that file, it should not ask you for authorization again.

astrada avatar Aug 10 '20 19:08 astrada

@astrada, whenever I restart the VM the refresh token field in the file ~/.gdfuse/default/state vanishes. What possibly could the reason be?

DhruvBhagadia avatar Aug 11 '20 03:08 DhruvBhagadia

Also, @astrada I try to untar files which are around 4G in size using google-drive-ocamlfuse but the speed at which the untar happens is extremely slow (2.6kps). I saw the VM resources being used and it still has plenty of RAM and CPU left then too it is slow. Why could this be happening? Is it something to do with syncing and stuff that google-drive-ocamlfuse does in the background?

DhruvBhagadia avatar Aug 11 '20 05:08 DhruvBhagadia

What possibly could the reason be?

Are you sure that the files in your home are persisted between restarts?

Why could this be happening?

The tar file needs to be downloaded in cache before untarring. If you don't need to modify it, you can enable streaming to skip the cache reading large files.

astrada avatar Aug 11 '20 12:08 astrada

@astrada Nope, I don't want to modify the tar files just untar them on drive. In order to run the linux untar command on those tar files available on drive I first mount it onto a gcp VM instance and then run the tar -xvf on them (which I hope will be reflected on drive also). How can I use google-drive-ocaml to perform this task most effectively? I have 12 such tar files each of size around 4GB

DhruvBhagadia avatar Aug 11 '20 12:08 DhruvBhagadia

Set stream_large_files=true in the config file.

astrada avatar Aug 11 '20 15:08 astrada

@astrada, I tried headless authorization again today. I could mount and use ocamlfuse properly but when I tried to see the refresh_token, the field is empty. I feel my headless authorization is not saving refresh token into the file ~/.gdfuse/default/state

Inside my state file

last_access_token=
refresh_token=

How to resolve this?

DhruvBhagadia avatar Aug 12 '20 06:08 DhruvBhagadia

Solved the issue by manually copy pasting refresh_token, last_access_token in ~/.gdfuse/default/state and client_id, client_secret in ~/.gdfuse/default/config

DhruvBhagadia avatar Aug 12 '20 06:08 DhruvBhagadia

@astrada, after setting stream_large_files=true the extraction speed improved to 3.5kbps. Can I improve it further by any means?

DhruvBhagadia avatar Aug 12 '20 06:08 DhruvBhagadia