![]() We can schedule this script on crontab for auto backup. Once the backup script is executed, you can see that the backup is correctly uploaded to Google Drive as follows: Set the correct permission to the script file. Here, “ 1XiaelkGjGkvC-FpM6HrKHFt7l7_zsADG” is the folder ID that we get from Google Drive URL.Ħ. This lets users on those platforms effortlessly store important photos, videos and documents in the cloud, safe from crashes, accidental edits, and unintended deletions. Munif Tanjim 5 min read Brief: While Google Drive is not officially available for Linux, here are tools to help you use Google Drive in Linux. ![]() The backup script is as follows: #!/bin/sh # To take backup as tar for a directory tar -zcf "dir-backup-$(date '+%Y-%m-%d-%H-%M-%S').tar.gz" /root/test # To encrypt the backup tar file (if needed) #openssl aes-256-cbc -a -salt -in "dir-backup-$(date '+%Y-%m-%d-%H-%M-%S').tar.gz" -out "dir-backup-$(date '+%Y-%m-%d-%H-%M-%S').tar.gz.enc" -pass 'pass:123456' # To remove the original tar file (if needed) #rm -rf "dir-backup-$(date '+%Y-%m-%d-%H-%M-%S').tar.gz" # To upload to Google Drive drive upload -file "dir-backup-$(date '+%Y-%m-%d-%H-%M-%S').tar.gz" -p 1XiaelkGjGkvC-FpM6HrKHFt7l7_zsADG There is no official Google Drive client for Linux, but there is an official API The official Google Drive app for Windows and macOS offers built-in backup & sync option. Create a backup script sbin]# vim bkupload.sh Sign in using a Google account and click on ‘Allow’, you will get the verification code as shown below.ĥ. In this example, an external USB hard drive called SILVERXHD (for 'Silver eXternal Hard Drive') is plugged into the Linux computer. If you can write to it, then so can rsync. Go to the above link on the browser (URL should vary while running the script each time). To make a backup copy of your data to an external hard drive, the hard drive must be mounted and accessible to you. Go to the following link in your browser: Enter verification code. You would be far better off by simply have more than one backup drive one you keep at home and a duplicate one you keep offsite somewhere. Any data you put on Google drive will be spied on by Google and will be used and/or sold by Google for advertising. You will get a link like this asking for a verification code. I trust anything Google about as far as I can spit upwind in a class 5 hurricane. Assign the correct permission to the file. ![]() Then move this file to “/usr/sbin/” folder. Safely store your files and access them from any device. Use the following link to download Google Drive:Ģ. Here in this article, it explains how to backup directories to Google Drive using bash script and API. Nowadays Google Drive is the most commonly used service to store our files as a cloud.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |