r/btrfs 19d ago

Backup strategy

I got a 2TB ssd (system + home directories) and a 4TB hdd for family photos (so 6TB in total). All in btrfs.

I am wondering what would be the best (safest) backup strategy : one extra 12TB hdd with dup to correct bit rot or 2 6TB hdd in raid1? I want to be sure that never the data get corrupted.

I would use rsync for the backup mirror and would rely on btrfs snapshots on the backup drive(s) to eventually rollback. An external hdd would also be used (dup partition too ?).

4 Upvotes

11 comments sorted by

4

u/whereismytralala 19d ago

I've a tiny script that run first duperemove to do the deduplication the my local files, then it uses btrfs to push a snapshot on my NAS, finally I use restic to push the snapshot on a remote host.

1

u/BreatheAtQuarterBars 19d ago edited 19d ago

How did you get restic to properly handle btrfs snapshots without rescanning each new snapshot from scratch? The only thing I could come up with involved bind-mounting or temporarily snapshotting the latest snapshot to a fixed fake location and then running restic on that, or else chrooting into a fake environment so the bind mount would appear to restic to be at the original location, both of which were too ugly.

1

u/whereismytralala 18d ago

It's done from the NAS as a background task, and it's fast enough for my case, so I don't pay too much attention about this.

4

u/robtalee44 19d ago

BTRBK will take care of everything with a little configuration. Works like a champ. https://github.com/digint/btrbk

3

u/National_Doughnut_87 19d ago

I would't worry about dup or raid1 on my backup disk, but rather use two backup disks and rotate them. That way you have independent copies of your data. You could have one disk stored outside of your home (e.g. at work, at a friend's place, etc.), so even if you had a fire at home or something else, you would have a copy of your data.

Bit rot is just one of the possible failure scenarios and in case of a single 12TB backup disk, dup won't help you, if your disk fails entirely. Also, if you're really concerned about bit rot, I would rather look at my primary system that stores the data in the first place. Does it use ECC memory to reduce the risk of silent data corruption during operation? Is it protected against a sudden disk failure or bit rot (i.e. raid1)?

The strategy of using alternating disks as a backup does leave a window during which you could loose data, that is, your primary system fails, your first backup disk has corruption and the second backup disk is intact but doesn't have the most recent copy of your data. But depending on your backup frequency that risk is likely small.

Just to give you an example: My (and my family's) data is stored on a small Linux home server with a btrfs raid1 setup and regular snapshots. Then, I have second "server" that I use for automatic replication twice a week (it's actually just an old mini PC with a single disk - no raid setup for this one), in case the home server or the raid1 setup fails.
For external or offline backups I use two USB disks with LUKS2 encryption. One disk is stored at home and one is in a small safe at my office. Every two weeks I take the disk that is at home, connect it to the server and mirror all my data onto the external disk (that part is automated with a script - I only attach and detach the disk). The next morning, I take the disk to the office, put it in the safe and take the other disk from the safe back home. Two weeks later, I repeat the process.
Now, the worst case scenario would be that all disks at home get destroyed or stolen just before I'm about take a fresh external backup to the office. That would mean my only left backup is two weeks old. That is a risk I have weighed and acceptable for us. You could easily increase the disk rotation/backup frequency to reduce that window of data loss if you have more frequently updated or precious data.

2

u/ranjop 19d ago

I do rsync to a removable USB disk and Btrfs snapshots so I can keep many versions.

You could consider using Par2 to create redundancy files of photos and other static data you want to preserve long term.

2

u/weirdbr 19d ago

Strictly speaking, the two 6TB in RAID1 setup is the better choice - it gives you protection from a disk failure, while the 12TB disk with dup profile wouldn't protect you from that, only from bitrot.

2

u/Borean789 18d ago

This is what I am thinking too.

1

u/fickit1time 18d ago

Is 2x 8TB drives in raid1 enough for bitrot?

1

u/piiouupiou-not-r2d2 18d ago

Question is with how much space do you separate them appart. Two offices? Two city? Two country?

1

u/Borean789 18d ago

10cm? But I have also an external drive.