[Advice needed] How to back up data across two SAMBA shares - rsync and crontab?

I’d like to periodically copy files from one Samba share (on USB disc 1) to another share (on USB disc 2). I’m not sure about the best way of setting this up, and whether installing additional software on the FreedomBox might interfere with its internal processes. I need some advice, please.

Can I just install rsync and set up a crontab job to do what I want? The usecase is copying media files weekly from one share to another (disc 1 to disc 2) to protect against hardware failure on disc 1. These are just plain portable USB drives, not RAID or anything fancy.

I’m running FreedomBox 20.12.1 on a Raspberry Pi 3 Model B, running Debian Buster.

rsync + crontab? Will this work or is there a better way?

Thanks!

You could give syncthing a try. (After attaching your backup disc 2 to another device.)

I wondered about Syncthing too, but it assumes a second device. In my case, there’s only one device (the FreedomBox) but with two storage drives. I searched the Syncthing forums for “local sync” and it only appears as a feature request in 2018. A local sync option would be an ideal solution for me though.

Thanks for your suggestion.

If it’s just to protect against a failing drive, an option may be to add your disc 2 as a second drive for the BTRFS filesystem of disc 1, and “balance” it as raid1 for data and metadata. https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices#Conversion

I will investigate that as a possibility. Thanks, @NickA . I have no experience with btrfs but it’s a good opportunity to learn. I’d hoped to only copy a subset of files to disc 2 (suits my needs better than full disc mirroring) but in the absence of a workable alternative, I may have to embrace RAID with more enthusiasm than I have to date.

BTRFS filesystems work per partitions, so you could mount a separate new filesystem that only spans across two smaller partitions (residing on external or internal discs) to hold just the subdirectory with the subset of files that you want to reside on two discs.

After configuring btrfs once, I guess this kernel based solution could well be easier to use and be more reliable, day to day, than running and waiting for a separate application to watch and sync the files.

Wow. That’s blown my mind a bit as a creative possibility. Agree that a kernel-based solution will likely be more reliable and easier to use than a separate application. I’ll do some more research and maybe dive in! :slight_smile:

Just keep in mind that a raid provides instant replication, but not a backup.

Maybe the freedombox backup app will be able to keep backup versions of the files in your samba share (from the btrfs raid filesystem) somewhere else.