

Once you are familiar with this backup process, you might want to automate it with crontab. , or if you used the split method you can just delete the /backup folder Step Five - Remove the local copy of the backup file. backup -printf "drive upload -f %p\n" | bash Mkdir /backup mv /backup cd /backup split -b 2000M "root_backup_" rm -f find. If the file is regularly failing to transfer in full, due to the size, then you should split it.otherwise transfer the file as a whole using. Files larger than 2GB have a higher likelihood of getting timed out when transferring to Google Drive, and you won't know it unless you are regularly creating and examining logs of each step using " > Logfile.txt", stdout after each command. Step Four - Send the backup file to Google Driveĭepending on the size of the backup file, it may be necessary to split it into smaller files (I recommend 2GB files). If your drive does not have at least 50% free space, you may have to choose an alternate location, include command switches to use higher compression (slower), or add exclusions for large files you don't necessarily need to backup.Ĭd / sudo tar -cvpzf -exclude=/ -one-file-system /
#BACKUP LINUX TO GOOGLE DRIVE CODE#
The below lines of code will backup your "/" root folder and place the backup file on the root of the drive. Step Three - Backup your Linux installation Or, you can split the image using the methods described in Step Four.
#BACKUP LINUX TO GOOGLE DRIVE FULL#
The "conv=sparse" option will zero empty space, making the resulting file much smaller compressed than the actual size of the partition however, in some cases it may be necessary to resize the partition, backup, then resize back to the full available space. Note: Large boot partitions, which is unusual but possible.can take considerable time depending on the speed of your internet connection. "dd" pipes the raw image data of your boot partition into "gzip", which compresses that data, then pipes "|" the compressed result into "drive upload". In just two lines of code, you can send the boot partition image directly to Google Drive, on-the-fly.īOOTDRIVE="$(fdisk -l | grep '^/dev/*' | awk '$2 = "*"' | cut -d ' ' -f 1)" sudo dd conv=sparse if=$ | gzip -c -fast | drive upload -stdin -title bootdrive.gz Step Two - Backup the boot partition directly to Google Drive Next give Gdrive allow permissions, then Copy/Paste the code from the page into the terminal. You will see a link in your terminal, which you can paste into your browser. Wget -O drive mv drive /usr/sbin/drive chmod 755 /usr/sbin/drive drive
