-- Leo's gemini proxy

-- Connecting to cadence.moe:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; encoding=utf-8; lang=en

↩ Home

⬆ Gemlog


How I do my backups


> 999 words, 22 paragraphs, about 3 minutes to read (300 wpm).

> First published on 2021-01-07.

> This article has been loaded 3317 times.


Having backups is pointless when you don't need them but vital when you do.


I back up not just my home directory but my entire system (save for a few directories) so that I don't have to figure out which programs to reinstall to get back up and running after a disaster.


I will admit that I have not fully tested my backups. I have confirmed that I am able to restore files onto another computer, but I do not know whether the files that are actually saved are enough to get the computer off the ground.


This is still better than nothing, and I know that my home directory and all its files are at the very least safe and sound.


Setup & reasons


My computer has an SSD mounted on / and an HDD mounted on /mnt/bulk. I then have various symlinks from my home folder to that drive, for example ~/Downloads is actually saved at /mnt/bulk/Downloads. I never empty that folder and it currently totals 97 GB.


The tools I use see the symlinks as symlinks, so I have to be sure to back up the actual location if I care about the files inside it.


I back up to a folder on my own computer and also to a cable-connected hard drive which I normally keep in another rooom. I then sync the folder on my computer with the cloud. The reasons for this are as follows:


If I delete files by mistake, or want to retrieve an older version of them, I can restore them in-place on my computer without needing to get out of my seat.

If I travel to another place, or if my disks die, I can restore from the cable-connected drive onto a different drive.

If there's a disaster affecting my house and I lose both my computer and the cable-connected drive, I can restore from the internet, though this will take longer and cost a few dollars to download from.


I try to run a backup at least every week, though I'm bad at doing it regularly. I have no excuse not to.


Specifics


I use BorgBackup to manage the repository of files. Borg does encryption, compression, and deduplication, and it does it surprisingly quickly.


I have Borg save into two separate repositories, one on my own computer, one on the cable-connected drive. I then synchronise my computer's copy with Backblaze B2 for cheap cloud storage. All of these use randomly generated passwords, which I have written down on paper, along with 2FA backup codes, so that I can hopefully still get in to my files if I don't have access to my 2FA app or my password manager.


Everything is managed by a custom script which handles mounting and unmounting the drives, running borg with the correct flags and excluded directories, and syncing with B2.


If you own your online data storage server you can install Borg on it and sync directly to a repository on it through SSH. I can't do this with B2, so I have to just copy the files there from the repo on my computer.


Excluded directories


As you remember, I'm syncing /, not just /home, so I have to be careful about which directories make it into the backup, especially given that "everything is a file". I excluded these general types of directories:


Files of system installed packages. I save the list of installed packages rather than the packages themselves, so I should be able to reinstall everything in one go without having to worry about breaking dependencies. (In theory. Haven't tested this.)

System files for processes or device management. /dev, /proc, /run, /tmp, and so many more.

Large files that are useless. I don't want to waste storage space on my cable-connected drive or on what I pay for in the cloud, so I want to exclude large files that are useless.


Subcategories of large files:


Actually useless files, like caches.

Files that I can get back another way, like legit steam game installations that I can reinstall from the client.

Files that I just don't care about, like my downloads folder, my linux ISO collection (yes really), mirrors of content like from youtube that I can redownload, and so on.

(And large files that I want to keep which I just include in the backup without doing anything.)


See the full list of excluded directories in the script. Some of them are specific to me, some of them you'll all want to use.


The script


The comments in this script are for my own sake and largely summarise information that you can get from the docs. Hopefully you find them helpful.


/documents/backup-future.fish


Other notes


https://borgbackup.readthedocs.io/en/stable/faq.html#can-i-copy-or-synchronize-my-repo-to-another-location


https://borgbackup.readthedocs.io/en/stable/faq.html#how-important-is-the-home-config-borg-directory


I chose lzma level 6 based on some casual benchmarks that I ran using real data on my own computer. I prioritise compression over time taken, but lzma does not take an excessive amount of time for me. You might want to briefly run your own tests, if you have different priorities, or just to see how zstd is coming along recently.


I close all applications before I start to try to minimise files that are being modified while borg is inspecting them. If I was more serious about this I'd use a live USB to ensure that my main system isn't being touched, but I prefer more convenient backups in this case, so that I actually _do them_ from time to time. Having to reboot to a live USB would be too much work for me to want to back up regularly.


Links


https://borgbackup.readthedocs.io/

https://backblaze.com/


Conclusion


Hopefully this document helped guide you along your backup journey. I hope that I've brought up some interesting things to watch out for in your own backup plan, or encouraged you to set up one for the first time.




---


> No replies yet.


Thoughts on this? I'd love to hear them! Write a reply.


---


Looking for more?


[NEWER →] 2021-03-17 - Thoughts on Portal

[OLDER ←] 2020-12-17 - Future of Bibliogram

[RANDOM ] 2022-01-28 - Command line computing part 1: Introduction


Or, back to the gemlog index.

-- Response ended

-- Page fetched on Mon Apr 22 07:33:35 2024