8

I finished uploading my files to Google Drive using File Stream and don't have anything marked to be kept local. Still, GDFS keeps around 40GB of cache files.

Here are the things I tried to make it clean it up:

  • Ejected the drive, logged out, closed the app, opened the app, logged in;
  • Restarted the computer;
  • Added/deleted more files to see if it would "refresh";
  • Changed the cache folder location in preferences. It transferred all files and still left 1GB in the older folder [facepalm];
  • A combination of the things above in different order.

I think I can just delete the cache folder but it's something I don't want to do. How can I force it to delete? More importantly, is this the expected behaviour?

I'm using macOS 10.12.6

Roberto
  • 283
  • 1
  • 5
  • 21

1 Answers1

11

On macOS, execute the following command: sudo defaults write /Library/Preferences/com.google.drivefs.settings ContentCacheMaxKbytes -int 100000

On Windows, save the following content to a file called google.reg and execute it, or alternatively, add the registry key yourself (QWORD, decimal value 100000).

Windows Registry Editor Version 5.00    
[HKEY_LOCAL_MACHINE\SOFTWARE\Google\DriveFS]
"ContentCacheMaxKbytes"=hex(b):a0,86,01,00,00,00,00,00

This will cause Drive File Stream to delete the cache once it hits 100mb. By default, Google selects a high value to decrease access to its cloud.

Reference: https://support.google.com/a/answer/7644837?hl=en

Heinzelmann
  • 126
  • 1
  • 5
  • 3
    Thank you, @Heinzelmann! I had a number of computers with this issue and found that in order for the registry patch to work, Drive File Stream had to be uninstalled and the cache directory emptied before updating the registry and then reinstalling FS. – Miles Wolbe Sep 29 '19 at 19:11
  • I ran this defaults commands on Mac OS X and then restarted Drive File Stream, but the cache is already up to 20GB... is there something else I need to do to get this to work? – Michael May 16 '20 at 01:14
  • @Michael I've tested it on Windows only. But yes, looking at Google's reference I think you might need to use a host-wide setting. Try `sudo defaults write /Library/Preferences/com.google.drivefs.settings ContentCacheMaxKbytes -int 100000` – Heinzelmann May 16 '20 at 14:56
  • According to https://support.google.com/a/answer/7644837?hl=en they might have updated some registry keys and there is a specific Override location now. The original should probably still work, but if it doesn't, try creating the registry key in `HKEY_LOCAL_MACHINE\Software\Policies\Google\DriveFS` (Mac: `/Library/Managed Preferences/com.google.drivefs.settings.plist`) – Heinzelmann Sep 18 '21 at 11:33
  • One effective method to clear Google Drive's local cache seems to have improved since this question was asked. It now clears upon the associated account being disconnected from the local app. To do so in Windows, open the app from the system tray by clicking on its icon; select "Preferences" by clicking on the upper-right gear icon. By clicking on the pop-up Preferences page's gear icon, all the local device's mounted Google Drives will appear and on the top-right of each account is a link to "Disconnect account". Clicking that presents a warning. If okay, disconnect and the cache clears. – Catalyx Mar 26 '23 at 00:02