Child pages
  • Using Google Drive under Linux
Skip to end of metadata
Go to start of metadata

This page is geared toward access of the Google @ IU  offering but should work with the commercial Google Drive as well

Through Google @ IU, you have access to unlimited storage.  This page describes some options for accessing this storage from a Linux system.

HTTPS Access

You can access your IU Google Drive account using the link for the IU Google Service and then clicking on Google at IU Apps > Log in to Google at IU.  Once logged in, click on the Drive icon and then Go to Drive.  This provides a web interface for viewing, uploading, and downloading files.

If you have a google.com account in addition to your Google at IU login, you have to take care which account you are viewing.  Use the icon in the upper right to select/view/change the google account you are using.  It is only your Google at IU account that has unlimited storage.


Gdrive

Gdrive is now listed as no longer being actively maintained so details are not included here.  See https://github.com/gdrive-org/gdrive for information about this option.

Rclone

Rclone is a command line program used to sync files and directories to and from a variety of service providers, including Google Drive.  See the Rclone Google Drive page for more information about setting up and using Rclone with Google Drive.  The basic steps to get started are:

  1. Run "rclone config".  Note that rclone is already installed on all of our unified Linux systems but it may need to be installed on other systems.
  2. Select the option for n) New remote and give the remote a descriptive name like "iudrive".  You should avoid using a remote name with spaces.  The remainder of this section uses iudrive as the name in the examples so if you select something different you will need to use whatever you chose.
  3. Enter drive as the storage type
  4. Just hit enter (twice) to leave the Client Id and Secret blank
  5. If you are running this on a local linux workstation or laptop, answer yes to use auto config and this should open a window in a web browser where you an pick the google account to use (eg. username@iu.edu for your IU account) and then click Allow.  If required, log into your Google at IU account.
    If you are running this on a remote server or other environment where a web browser can't be opened by rclone, say no to use auto config.  rclone will display a url that you can then copy/paste into a browser, select the proper google account, and then copy/paste the displayed verification code at the rclone config prompt
  6. If this all works as expected, a token= will be displayed and you can answer yes that this is OK
  7. You should see that it was set up properly and you can then hit q to quit

Once you have things set up, you can use rclone to do various file operations like listing files and uploading/downloading files.  As a first test you can run "rclone ls iudrive:" to verify that things are working properly (replace iudrive: in this command with whatever name you used for the remote config).  If this is all working properly, then you should get a listing of everything you have in your IU Google Drive account.

Here are a few helpful rclone command examples but see the rclone documentation (including the complete list of commands) for more information.

List Drive Contents
===================
rclone ls iudrive:

Upload a File
=============
rclone copy somefile iudrive:             # Upload to the top level directory
rclone copy somefile iudrive:/some/path   # Upload to the specified directory

Download a File
===============
rclone copy iudrive:somefile .            # note the dot at the end of the command which copies somefile to the current directory (.)
rclone copy iudrive:somefile /some/path   # Upload to the specified local directory


rclone sync

One useful feature of rclone is the sync functionality which is similar to rsync.  This allows you to keep local copies of files from a Drive folder on your local system and keep them in sync with the copies on Drive.  See the documentation for rclone sync for more details.  If you want to use this feature on the Luddy Unified Linux systems, please submit a service request and we can create a local directory on your workstation for this purpose.  In some cases, your home directory is mounted from the central file server and we do not recommend using a directory within your home directory as the destination of the rclone sync.  You have limited disk quota in your home directory and it is slower than a local filesystem so we can help you with access to the local disk space on your workstation for this purpose.

rclone mount

One of the more interesting features of rclone is the ability to mount your Drive space so it is accessible via the filesystem which is similar to Google Drive File Stream (which is not supported on Linux).  See the documentation in the rclone mount page for more information about this option.  If you want to use this feature on the Luddy Unified Linux systems, please submit a service request and we can create a local mount point on your workstation for this purpose.  In some cases, your home directory is mounted from the central file server and we do not recommend using a directory within your home directory as the rclone mount point.  So, for example, if we create a directory on your local system named /home/janedoe/drive then you can use rclone to mount and unmount your Drive SomeProject directory as follows:

Mount:   rclone mount iudrive:SomeProject /home/janedoe/drive
Umount:  fusermount -u /home/janedoe/drive

Please note that this is not 100% seamless so see the Limitations section of the rclone mount page for come caveats and tips.  If you run into problem you may have better luck using the “--vfs-cache-mode writes” or “--vfs-cache-mode full” options as noted in that page.  You can use the rclone sync feature instead to give yourself local copies of a directory that you can work on.