this post was submitted on 15 Oct 2024
179 points (100.0% liked)

Linux

48185 readers
1181 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Can you please share your backup strategies for linux? I'm curious to know what tools you use and why?How do you automate/schedule backups? Which files/folders you back up? What is your prefered hardware/cloud storage and how do you manage storage space?

(page 2) 50 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 1 month ago

Dotfiles are handled by GNU Stow and git. I have this on all my devices.

Projects like in git.

Media is periodically rsynced from my server to an external drive.

Been meaning to put all my docker-composes into git as well...

I don't back up too much else.

[–] [email protected] 15 points 1 month ago (2 children)

All my code and projects are on GitHub/codeberg.

All my personal info and photos are on proton drive.

If Linux shits itself (and it does often) who cares. I can have it up and running again in a fresh install in ten minutes.

load more comments (2 replies)
[–] [email protected] 5 points 1 month ago

Vorta (borg) with backups sent to rsync.net. They run daily on all my machines.

[–] [email protected] 0 points 1 month ago (1 children)

The glorious life of openSUSE, defaults to btrfs on install and everything is preconfigured with snapper out of the box. Easy life, nothing to worry about.

[–] [email protected] 3 points 1 month ago

Yea, that's snapshotting, what do you do about back ups?

[–] [email protected] 4 points 1 month ago

Daily rsync to a local nas and weekly backups to offsite with pika-backup.

[–] [email protected] 7 points 1 month ago

Scuse the cut and paste, but this is something I recently thought quite hard about and blogged, so stealing my own content:

What to back up? This is a core question to ask when you start planning. I think it’s quite simply answered by asking the secondary question: “Can I get the data again?” Don’t back up stuff you downloaded from the public internet unless it’s particularly rare. No TV, no Movies, no software installers. Don’t hoard data you can replace. Do back up stuff you’ve personally created and that doesn’t exist elsewhere, or stuff that would cause you a lot of effort or upset if it wasn’t available. Letters you’ve written, pictures you’ve taken, code you authored, configurations and systems that took you a lot of time to set up and fine tune.

If you want to be able to restore a full system, that’s something else and generally dealt best with imaging – I’m talking about individual file backups here!

Backup Scenario Multiple household computers. Home linux servers. Many services running natively and in docker. A couple of windows computers.

Daily backups Once a day, automate backups of your important files.

On my linux machines, that’s things like some directories like /etc, /root, /docker-data, some shared files.

On my windows machines, then that’s some mapping data, word documents, pictures, geocaching files, generated backups and so on.

You work out the files and get an idea of how much space you need to set aside.

Then, with automated methods, have these files copied or zipped up to a common directory on an always-available server. Let’s call that /backup.

These should be versioned, so that older ones get expired automatically. You can do that with bash scripts, or automated backup software (I use backup-manager for local machines, and backuppc or robocopy for windows ones)

How many copies you keep depends on your preferences – 3 is a sound number, but choose what you want and what disk space you have. More than 1 is a good idea since you may not notice the next day if something is missing or broken.

Monthly Backups – Make them Offline if possible

I puzzled a long time over the best way to do offline backups. For years I would manually copy the contents of /backup to large HDDs once a month. That took an hour or two for a few terabytes.

Now, I attach an external USB hard drive to my server, with a smart power socket controlled by Home Assistant.

This means it’s “cold storage”. The computer can’t access it unless the switch is turned on – something no ransomware knows about. But I can write a script that turns on the power, waits a minute for it to spin up, then mounts the drive and copies the data. When it’s finished, it’ll then unmount the drive and turn off the switch, and lastly, email me to say “Oi, change the drives, human”.

Once I get that email, I open my safe (fireproof and in a different physical building) and take out the oldest of three usb Caddies. Swap that with the one on the server and put that away. Classic Grandfather/Father/Son backups.

Once a year, I change the oldest of those caddies to “Annual backup, 2024” and buy a new one. That way no monthly drive will be older than three years, and I have a (probably still viable) backup by year.

BTW – I use USB3 HDD caddies (and do test for speed – they vary hugely) because I keep a fair bit of data. But you can also use one of the large capacity USB Thumbdrives or MicroSD cards for this. It doesn’t really matter how slowly it writes, since you’ll be asleep when it’s backing up. But you do really want it to be reasonably fast to read data from, and also large enough for your data – the above system gets considerably less simple if you need multiple disks.

Error Check: Of course with automated systems, you need additional automated systems to ensure they’re working! When you complete a backup, touch a file to give you a timestamp of when it was done – online and offline. I find using “tree” to catalogue the files is worthwhile too, so you know what’s on there.

Lastly – test your backups. Once or twice a year, pick a backup at random and ensure you can copy and unpack the files. Ensure they are what you expect and free from errors.

[–] [email protected] 4 points 1 month ago

My desktop, laptop and homelab all synd my important stuff over syncthing. They all do btrfs snapshots three months back in case an oopsie would propagate.

The homelab additionally fetches deduplicated snapshots of my VPS weekly, before syncing all of the above to an encrypted hetzner storage for those burning-down-the-house events.

[–] [email protected] 4 points 1 month ago* (last edited 1 month ago)

321

Kopia backup to secondary HDD

  • Pictures (phone photos backed up to my server via immich)
  • workspace (git repos, ECAD, MCAD, firmware, etc...)
  • qmk layout
  • Documents
  • vim folder with bundles
  • ebooks

KDE vaults stores on secondary HDD

Soon I will set up kopia to also back up every via SSH to my server and then small size essentials and important docs via google drive

I need to set server cloud backups too, but haven't had the time...

[–] [email protected] 1 points 1 month ago

Pendrive for the important stuff, paper for the really important stuff and brain for everything else.

[–] [email protected] 1 points 1 month ago

My backup is begging my computer to implode so I can experience the sweet relief of getting offline.

But also I use external discs and make copies of important files I can't recreate. Don't care too much about config as I am happy enough to distro hop and set things up anew.

[–] [email protected] 3 points 1 month ago* (last edited 1 month ago)

I use Bluebuild to create a reproducible system, plus a post-install script to handle other post-install tasks such as setting up initial preferences.

Also Vorta to backup files and settings to external HD, plus OneDrive Linux client to sync files and settings to cloud.

[–] [email protected] 2 points 1 month ago

For my home server, I use Restic and a cronjob to weekly take snapshots of all my services. It then gets synced to a Backblaze B2 bucket (at $6/TB/mo). It's pretty neat, only saving the difference between the previous and current snapshot, removes older snapshots, and encrypts everything.

[–] [email protected] 3 points 1 month ago* (last edited 1 month ago)

restic to a local server and to cloud storage. it varies by device, but usually just everything in /home/. The rest of the operating system should be reproducible, whether through images, ansible, nix, or guix, given the information in /home/.

scheduling is done through systemd, usually (or the non-systemd equivalent). I use BackBlaze now, but I switch around occasionally. restic has policy based snapshot removal, and a prune option.

[–] [email protected] 2 points 1 month ago

I have my important folders synced to my Nextcloud and create nightly snapshots of that to a different drive using borg.

One thing I still need to do, is offsite encrypted backups using rsync.

[–] [email protected] 2 points 1 month ago

All of my servers make local dumps of their databases and config files to directories owned by unprivileged users. This includes file paths, permissions, and ownerships (so I know how to put them back).

My primary research server at home uses rsync to pull copies of those local backups from my servers.

My primary research server uses Restic to make a daily incremental backup to Backblaze's B2 service.

[–] [email protected] 15 points 1 month ago (2 children)

I plug in an external drive every so often and drag and drop parts of my home dir into it like it's 1997. I'm not running a data center here. The boomer method is good enough and I don't do anything important enough to warrant going all out with professional snapshot based backup solutions and stuff. And I only save personal documents, media, and custom config files. Everything else is replaceable.

[–] [email protected] 4 points 1 month ago

yeah about the same, old coot here, I plug a USB3-SSD (encrypted with LUKS) and rsync from internal HD to this external HD. That's it.

load more comments (1 replies)
[–] [email protected] 3 points 1 month ago

Nightly rsync to two NAS boxes in the house (TrueNAS Scale and a Synology). Docs go in NextCloud, hosted on a VM in my basement, which is also backed up to the Synology by Proxmox. Also backing up my main machine (Pop!_OS) and my wife’s laptop (ThinkPad E595, also Pop!_OS) using Spideroak One.

[–] [email protected] 20 points 1 month ago (1 children)
load more comments (1 replies)
[–] [email protected] 28 points 1 month ago (3 children)

Borg backup is gold standard, with Vorta as a very nice GUI on machines that need it. Otherwise, all my other Linux machines are running in proxmox hypervisors and have container/snapshot/vm backups regularly through proxmox backup server to another machine. All the backup data is then replicated regularly, remotely via truenas scale replication tasks.

[–] [email protected] 1 points 1 month ago

Borg with Vorta’s my go to as well. Resistance is futile.

[–] [email protected] 6 points 1 month ago

Borg via Vorta handles the hard parts: encryption, compression, deduplication, and archiving. You can mount backup snapshots like drives, without needing to expand them. It splits archives into small chunks so you can easily upload them to your cloud service of choice.

load more comments (1 replies)
[–] [email protected] 69 points 1 month ago

What's a backup?

[–] [email protected] 4 points 1 month ago

I use Duplicity to backup my home directory, excluding Steam and Downloads folders. It is setup to backup weekly to my NAS mounted as NFS. The NAS has a weekly cron task to upload the backups to pCloud using rclone. I backup this way, several computers (2 desktop, 2 laptop, the NAS as well). The files included in this strategy are essentially my photos, documents and configs. My software installations, games, media library are not backed up.

[–] [email protected] 3 points 1 month ago* (last edited 1 month ago)

I leverage btrfs or ZFS snapshots. I take rolling system level snapshots on a schedule (daily, weekly, monthly and separately before any package upgrades or installs) and user data snapshots every couple of hours. Then I use btrbk to sync those snapshots to an external drive at least once a week. When I have all of my networking gear and home services setup I also sync all of this to storage on my NAS. Any hosts on the network keep rolling snapshots stored on the NAS as well.

Important data also gets shoveled into a B2 bucket and/or Google drive if I need to be able to access it from a phone.

I keep snapshots small by splitting data up into well defined subvolumes, anything that can be reacquired from the cloud (downloads, package caches, steam libraries, movies, music, etc) isn't included in the backup strategy. If I download something and it's hard to find or important I move it out of downloads and into a location that is covered by my backups.

[–] [email protected] 2 points 1 month ago

.dotfiles on github

Big/critical files on an external HD

simple as

[–] [email protected] 4 points 1 month ago

Currently I use Borg Backup with Vorta as a GUI. I don't really do anything automated/scheduled, I just back it up manually to an external SSD every few days or so. I pretty much do my whole /home folder, except for a couple of subfolders that aren't really necessary (and Videos, which I back up separately.)

I do eventually want to upgrade to a NAS, but I'm waiting until we move to start setting that up. Also I don't really have an off-site plan yet which I know is bad, but I need to figure that out.

[–] [email protected] 4 points 1 month ago (4 children)

The important stuff is in cloud storage using Cryptomator (I'm hoping that rclone should make sync simple), I should probably set up time shift in case things do go wrong

load more comments (4 replies)
[–] [email protected] 1 points 1 month ago

Timeshift for configs to a locally attached drive. Home partition to cloud with rsync

[–] [email protected] 3 points 1 month ago (1 children)

Not only because third world issues, but because I like adrenaline, I don't have any backup strategy but an old external HDD where I haven't copied stuff since 2018.

When I could afford a new PC and tried to rsync my data from my old crappy laptop, much of it was lost.

That being said, I had a backup strategy back in the day that was burning CDs. I used to have a second HDD (a IDE one) but they were so freaking bad all of them went bad after a year or so, so I have like 3 or 4 of them stored without any chance to recover their data.

[–] [email protected] 1 points 1 month ago

After having recently restored some stuff from an aging external hdd, i'm seriously considering getting a few dvdr discs and burning the important things every now and then.

I know they don't last forever either, but - just as a random example that has definitely never happened to me hahaha - you can drop them from a height of 3 feet and still get files off them!

[–] [email protected] 2 points 1 month ago

I use syncthing to sync almost everything across my computer, laptop (occasional usage), server (RAID1), old laptop (powered up once every month or so), and a few other devices (that only get a small subset of my data, though). On the computer, laptop, and server, I have btrfs snapshots (snapper). Overall, this works very well, I always have 4+ copies of my data in 2+ geographical locations.

[–] [email protected] 4 points 1 month ago
[–] [email protected] 3 points 1 month ago

Keep everything on Nextcloud and back that up via Proxmox Backup Server.

Nuke and pave takes me less time to reconfigure Plasma and install NC client than bothering to back anything up directly.

[–] [email protected] 3 points 1 month ago* (last edited 1 month ago)

Timeshift for the system, works perfectly, if you screw up the system, bad update for instance just start it, and you'll be back up running in less than ten minutes. Simple Cron backups for data, documents etc, just in case you delete a folder, document, image etc . Both of these options to a second internal HD

[–] [email protected] 2 points 1 month ago* (last edited 1 month ago)

Software & Services:

Destinations:

  • Local raspberry pi with external hdd, running restic REST server
  • RAID 1 NAS at parents' house, connected via tailscale, also running restic REST

I've been meaning to set up a drive rotation for the local backup so I always have one offline in case of ransomware, but I haven't gotten to it.

Edit: For the backup set I back up pretty much everything. I'm not paying per gig, though.

[–] [email protected] 6 points 1 month ago (2 children)

Synology NAS. I really love that thing. I use their synology drive software to backup the Linux home folder, as well as windows PCs, iPads, iPhones etc. I use their photos mobile software to automatically backup phone photos and videos. I also synchronize a few select folders between PCs so certain in-use files are always up to date. I set the NAS to keep 30 old versions of every file. This works great for my college kids - dad has a copy of everything in case they nuke a paper or something (which has happened).

I stopped cloning drives long ago. Now I just reinstall the os and packages. With Linux, this is honestly faster than deploying a backup - a single pacman command installs everything I want. Then I just log into things as I open them. Ya I might have to futz around with some settings or redownload some big games on steam - but the eye candy and games can wait - I can be productive pretty quickly after an install.

I DO use btrfs with automatic snapshots (snapper and btrfs assistant). This saves me from myself when I bork an update (which I’ve done more than once). If I make a mistake, I just rollback a snapshot, and try again without my stupid mistakes. This has saved my install 3 or 4 times now.

Lastly, I sneaker net an external hard drive to my office. On it is a manual backup of the NAS. I do this once per month. This protects from catastrophic failures like my house burning down. I might lose a month or so of pictures in the worst case scenario, but I still have my 25+ years of pictures of my kids, wedding videos, etc.

In the end, the only thing that really matters is not losing my lifetime of family pictures and the good memories they provoke.

load more comments (1 replies)
[–] [email protected] 3 points 1 month ago

Firstly, for my dotfiles, I use home-manager. I keep the config on my git server and in theory I can pull it down and set up a system the way I like it.

In terms of backups, I use Pika to backup my home directory to my hard disk every day, so I can, in theory, pull back files I delete.

I also push a core selection of my files to my server using Pika, just in case my house burns down. Likewise, I pull backups from my server to my desktop (again with Pika) in case Linode starts messing me about.

I also have a 2TiB ssd I keep in a strongbox and some cloud storage which I push bigger things to sporadically.

I also take occasional data exports from online services I use. Because hey, Google or Discord can ban you at any time for no reason. :P

[–] [email protected] 2 points 1 month ago

I really make backups only a few times. I have the configuration files of my systems on my GitHub and Codeberg. The rest, I don't need; the only things I keep are books and music that I download from the internet, which I have on a 1TB external hard drive.

When I have made a backup for a specific reason, I have done it with rsync. It's a tool that works quite well and is for the command line.

load more comments
view more: ‹ prev next ›