Future Vipul’s data backup handbook & other jank strategies

This is to document some rsync commands, a bash script here and there, and explain to Future Vipul how the backup strategy works for Vipul’s system. Future Vipul is a series on Mixster that I work on to document guides that I need again and again as I work. I firmly believe if even one person gets the help from this guide apart from me in the future then it has served its purpose. I continuously update this guide with more information as my own learning grows and I hope to see you down in the comments if you would like to contribute as well. I wrote my previous Future Vipul guide last year about dual-booting.

Current setup

  • 2 offline hard drives of 2 TB (WD passport black as the Active backup) and 5 TB (Segate as the Passive backup)
  • No network attached storage configured, no cloud storage, no self-hosted cloud management
  • Phones and desktops are backed up to the active backup every 3 months or so manually
  • Linux settings are backed up as dotfiles over on a private GitHub repo.
  • Wallpapers are available on GitHub and Drive
  • Active backup is synced with the passive every 6 months or so manually.
  • Goal: Get backups automated, encrypted, and eventually get in line with 3-2-1 rule.

The 3-2-1 rule is: keep at least three (3) copies of your data and store two (2) backup copies on different storage media, with one (1) of them located offsite.

Note from present Vipul:

I am very much aware of hard drive’s flaws, their longevity, issues, and even repair. I feel as long as you take care of them and do not use them 23 hours a day. You are going to be fine with modern-day drives that guarantee more writes than you can possibly achieve with casually playing backup.


Rsyncing Hard-drives

Having an active and passive backup can be troublesome since there is a big issue of them falling out of sync. This isn’t an issue when you have the power of rsync available to you. Rsync makes syncing drives an absolute cakewalk.

To sync hard drives, connect both drives to high-speed ports directly to the primary machine and run the command for every matching directory in order to sync file contents. To save time, you would already have some context if these directories have been changed or modified. If not, then sync them anyway rsync will handle the heavy lifting.

rsync -htrvP --inplace /media/vipulgupta2048/active-backup/movies /media/vipulgupta2048/passive-backup/movies/

If you are wondering Future Vipul, what all these flags mean since you have forgotten again then check this out: https://explainshell.com/explain?cmd=rsync+-hPtrv+–inplace+–omit-dir-times+–no-perms++


Using Rsync with Android and taking backups

When your current Android phone is connected to the laptop then it’s connected using the MTP protocol and shown as a media device. Rsync can’t use this as a source-destination just yet.

Follow along with this nice Stackoverflow post to find the right mount point for your android device that will be under the GVFS if you are still using ubuntu based distros. Check out the following command to sync your Android device to your destination on the active-backup hard drive. This should do it for now.

rsync -hPtrv --inplace --omit-dir-times --no-perms  /run/user/1000/gvfs/mtp:host=OnePlus_KB5001/Internal\ shared\ storage/Pictures/ /media/vipulgupta2048/active-backup/pictures/

Ideas and Experiments

Poor man’s NAS: RaspberryPi 4 + Hard-drive

A Network-attached storage provides you access to your backed up data over the network with storage devices connected to the network. A NAS is quite a popular solution for data backup and is often recommended by enthusiasts. Here’s a good blog on building a NAS using OpenMediaVault on a Raspberry Pi device.

Going one step further: Using NextCloud on a Raspberry Pi

If you intend to get a whole suite of software tools that can interface with your data just Google Drive does then you can use the open-source alternative called NextCloud. Nextcloud is a suite of client-server software for creating and using file hosting services. It is enterprise-ready with comprehensive support options. Being free and open-source software, anyone is allowed to install and operate it on their own private server devices. And, you can do it easily one-click deploy NextCloud on a Raspberry Pi device using balenaHub.

Thanks Tom for suggesting Restic

After a discussion with my balena teammates, I will definitely be trying to sync drives using restic for the next time I am doing this. Restic already has a balena implementation with my colleague, Kyle creating balena-backup which can be used to backup data on balena devices in general.

That’s all for now, future Vipul. I will continue to update this documentation of commands in order to help myself but most importantly help folks get started with an easy-to-follow backup strategy that at least gets them closer to some form of data redundancy. Hope you are still living in the mix.

0 comments

Leave a Reply

Your email address will not be published. Required fields are marked *