How to unmount drive in Google Colab and remount to another drive?

Raymond Kwok picture Raymond Kwok · Feb 23, 2019 · Viewed 25.3k times · Source

[Update]

I closed the notebook and reopen it after 1.5h, now running drive.mount() will require a new key. Not sure the minimum amount of time needed to wait... not sure if that is normal to wait...

I mounted to Google drive account A. Now I want to switch to account B but I cannot do that, because there is no way for me to enter a new authentication key when executing drive.mount().

What I have tried and failed:

  1. restart browser, restart computer
  2. use force_remount=True in drive.mount(), it will only automatically remount account A. Not asking me for new mounting target.
  3. change account A password
  4. change run-time type from GPU to None and back to GPU
  5. open everything in incognito mode
  6. sign out all google accounts

Is there any API that can:

  • forget previous authentication key so it will ask me for a new one?
  • dismount drive and forget previous authentication key?

Answer

Bob Smith picture Bob Smith · Feb 23, 2019

You can reset your Colab backend by selecting the 'Reset all runtimes...' item from the Runtime menu.

Be aware, however, that this will discard your current backend.