Compiling and Running gDrive?

gDrive is an open-source utility that allows you to mount your Google Drive as a virtual file system on Linux. It can be a convenient way to access files stored in your Google Drive without having to go through the web interface.

Compiling and Running gDrive?

Downloading and Installing gDrive

To install gDrive, you will first need to download the latest release from the gDrive GitHub repository. They provide precompiled binaries for some Linux distributions that you can download.

If there is no precompiled binary for your distribution, you will need to compile it from source. To do this, you will need:

  • Git
  • Go

Follow these steps:

  1. Clone the gDrive repository: git clone https://github.com/prasmussen/gdrive.git
  2. Navigate to the cloned directory: cd gdrive
  3. Compile the binary: go build .
  4. The compiled gdrive binary will now be in the current directory.

Authentication

Before you can start using gDrive, you need to authenticate it with your Google account. gDrive uses OAuth, so you will be prompted to visit a URL and enter a code.

To start the OAuth flow, run:

./gdrive about

This will print a URL and code. Visit the URL, log in with your Google account, enter the code, and click “Allow” to grant gDrive access to your Google Drive.

Mounting Your Drive

Once authenticated, you can mount your Google Drive by running:

./gdrive mount [mount_point]

Replace [mount_point] with the directory where you want your Drive to be mounted locally.

For example, to mount it at /mnt/gdrive, you would run:

./gdrive mount /mnt/gdrive

You can now access all files and folders in your Google Drive at /mnt/gdrive as if they were local files.

Unmounting and Other Commands

To unmount your Drive when done, run:

./gdrive unmount

Some other useful gdrive commands:

  • list – List files stored on Drive
  • download – Download file from Drive
  • upload – Upload file to Drive
  • delete – Delete file from Drive
  • update – Update to the latest gDrive version

Refer to ./gdrive -h for more details on all available options.

Optimizing Performance

Here are some tips for getting the best performance out of gDrive:

Caching:

Enable caching by using the –syslog flag. This will significantly improve read speeds after the initial load.

Selective Sync:

Only sync the folders you need instead of your entire Drive. Use gdrive selective-sync to choose which folders to sync.

Streaming Uploads/Downloads:

Use the –streaming flags for upload and download if working with large files to avoid high memory usage.

Benchmarking:

Use ./gdrive benchmark to test read/write speeds and experiment with different settings.

Conclusion

gDrive provides a convenient approach to integrate Google Drive storage into your local file system. With the ability to selectively sync folders, streaming transfers, and syslog caching, it can deliver good performance. As an open-source project under active development, gDrive is likely to continue improving over time.

Key Takeaways

  • gDrive allows mounting Google Drive on Linux via FUSE
  • Install from precompiled binaries or compile from source
  • Use OAuth to authenticate gDrive with your Google account
  • Mount Drive using ./gdrive mount, access files at mount point
  • Enable syslog caching for better read performance
  • Selectively sync folders instead of entire Drive
  • Use streaming for large uploads/downloads
  • Benchmark to test speeds of different configurations

Frequently Asked Questions

  1. What Linux distributions are supported?
    gDrive is compiled for Linux on x86_64 architecture. It may work with other architectures if compiling from source. Popular distributions like Ubuntu, Debian, Arch, and CentOS are supported.
  2. Does gDrive work on Windows/MacOS?
    No, gDrive only works on Linux currently. There are plans to eventually support MacOS and Windows Subsystem for Linux.
  3. Do I need to keep gDrive running to access my Drive?
    Yes, the gDrive process needs to stay running in order to keep your Drive mounted.
  4. Is my Google Drive data encrypted?
    No, gDrive does not encrypt your Drive data. It interacts with standard Google Drive APIs.
  5. Can I access Team/Shared Drives?
    Yes, gDrive supports mounting both My Drive as well as Team and Shared Drives.
  6. How do I fix mount errors?
    Ensure gDrive is updated, check network connectivity, and inspect any reported errors. Reauthenticating gDrive can also help resolve persistent issues.
  7. Why are my file transfers slow?
    Try enabling syslog caching and streaming options. Also benchmark performance with different gDrive settings.
  8. Can I edit files directly in the mounted Drive?
    Yes, gDrive allows full read/write access when your Drive is mounted. Any changes will sync to the Google Drive cloud storage.
  9. Does gDrive support revision history?
    No, gDrive exposes your Drive as a standard file system without any revision tracking.
  10. Can I mount multiple Drives at once?
    Unfortunately, no. You can only have one Drive mount active at a time with gDrive.
  11. How do I uninstall gDrive?
    Simply delete the gDrive binary. Any cached data is stored in your OS temporary files and will be cleared on reboot.
  12. Can I access trashed files?
    No, gDrive only allows accessing non-trashed files in your Drive. You need to use the Google Drive interface to restore trashed files.
  13. Does gDrive work with Google Workspace/Enterprise accounts?
    Yes, gDrive works with both personal Google accounts as well as Workspace/Enterprise accounts.
  14. What Google Drive storage plans are supported?
    gDrive works with the personal Drive plans as well as all G Suite Enterprise/Workspace editions.
  15. Can I stream media files stored in Drive?
    Yes, video and audio files should stream fine when playing them directly via the mounted Drive.
  16. Is there an iOS/Android app for gDrive?
    No mobile app currently. The Drive has to be mounted on a Linux desktop or server OS running gDrive.
  17. How can I autostart gDrive on reboot?
    You can create a systemd service file or cron job to automatically run gDrive mount on boot.
  18. Is my mounted Drive data safe if system crashes?
    Yes, gDrive interacts purely with cloud data. Any local system crashes will not cause data loss.
  19. How can I increase the file size limit when uploading files to my mounted Drive?
    You can pass the –buffer-size=N option to gdrive upload to set a larger buffer size. For example, –buffer-size=100mb will set 100mb as the upload buffer size.
  20. Is there a way for gDrive to automatically sync when there is a change in the Drive?
    Unfortunately, currently gDrive only syncs immediately upon changes made by the mounted gDrive itself. Changes made to the Drive from other applications or interfaces do not automatically sync. You would have to manually run ./gdrive sync to force a sync. There’s an open feature request (Issue #372) to implement inotify based realtime monitoring and automatic syncing.

Leave a Comment