Google Drive is one of my favorite apps for storing and editing documents and spreadsheets. If don’t currently use Google Drive in place of Microsoft Office, I would recommend checking it out!
That said, while it’s a useful tool, your files are being stored on somebody else’s computer, which means that if your Google account should get hacked or suspended, you will lose access to your files. Not good.
In this post, I will show you how to back up the contents of your Google Drive onto your filesystem. You will need a medium level of knowledge and some experience with the command line for this.
Installing and Configuring Rclone
First, start by downloading Rclone. Rclone is a command line app for managing, copying, and syncing files across over 40 different cloud providers. In addition to Google Drive, it has support for Dropbox, AWS S3, Microsoft OneDrive, and a whole list of cloud providers that I’ve never even heard of!
Once you have Rclone downloaded, start up its configuration wizard by typing:
From there, do the following:
- n) New remote
- Type in “gdrive” as the name of the remote
- Type “drive” to select Google Drive
- For the rest of the questions, hit the enter key to choose the default
- Eventually a web browser window will open and you will have to authenticate with Google. Do so.
- When done, quit the configuration
Listing the Contents of Your Google Drive
To list the directories in your Google Drive, use the “rclone lsd” command as follows:
rclone lsd gdrive: -1 2021-06-16 18:34:42 -1 test123 -1 2020-11-08 20:39:12 -1 test124 -1 2021-12-07 14:50:16 -1 test125 -1 2021-02-21 15:27:12 -1 test126
Note that colon at the end of the remote, that’s important!
If you want to view individual files, use “rclone ls” instead but note that every file on the drive will be listed recursively. You can narrow down the list by appending a directory name like this:
rclone ls gdrive:/misc 44749 file.docx 388046 file2.pdf 275639 file3.xlsx [snip]
Finally, check the total size of your files on Google Drive with the “rclone size” command:
rclone size gdrive: Total objects: 1.236k (1236) Total size: 2.309 GiB (2479268463 Byte)
In my case, I have just over 2 Gigs of files in 1,200 files on my Google Drive
Syncing the Contents of Your Google Drive to Your Disk
Here comes the best part, syncing the contents of your Google Drive down to your disk! Start by changing to the directory that you want to back up and then using the “rclone sync” command as follows:
rclone sync -P --fast-list --transfers=32 gdrive:/ .
Here’s a breakdown of the options shown above:
- -P – Show a progress indictor
- –fast-list – Speeds up the sync by downloading a list of all files first and storing them in RAM. I recommend this option as the speedup is substantial in successive syncs.
- –transfers=32 – Transfer 32 files at once instead of the default of 8. You’ll get more value from 32 simultaneous transfers if you have a fast Internet connection.
A successful sync will look something like this:
rclone sync -P --fast-list --transfers=32 gdrive:/ . Transferred: 1019.980 KiB / 1019.980 KiB, 100%, 892.205 KiB/s, ETA 0s Checks: 1236 / 1236, 100% Deleted: 8 (files), 1 (dirs) Transferred: 7 / 7, 100% Elapsed time: 14.4s
I had previously synced down all my files, so this sync only grabbed the changes. Because I used –fast-list, it only took 14.4 seconds versus 19.8 seconds without. Larger filesystems will see increased gains.
And there you have it! Rclone can be used to download the contents of your entire Google Drive, which will then be saved to your disk and can be copied to a USB stick or elsewhere. If you want to know more about Rclone’s Google Drive integration, the Rclone documentation is an excellent starting point.
Happy backing up!