0

I have all my data stored on an ext4 filesystem. I want to make regular backups to a btrfs drive and use its snapshot capabilities.

In the btrfs drive I will make two directories: \backup and \snapshots.

On a weekly basis I will copy/rsync all my data from the ext4 system to \backup, and on a monthly basis I will do a read-only snapshot of \backup to a directory under \snapshots.

Is this a good strategy? What will happen when I start to delete old snapshots?

Thanks

6
  • 1
    Rather than monthly data snapshots, I'd make a complete drive image. Too often, a needed file is on a directory I'd not included. Commented Nov 16, 2023 at 16:38
  • I do a complete backup on a weekly basis (to \backup). Also, all monthly snapshots will be followed immediately with a full rsync from my data to \backup.
    – eli
    Commented Nov 16, 2023 at 16:48
  • Do you mean a file backup or a drive image? They're different. Commented Nov 16, 2023 at 16:55
  • file backup, not drive imaging
    – eli
    Commented Nov 16, 2023 at 17:00
  • 1
    Btw, you probably make a subvolume called backup instead of just a directory. snapshot can be a regular directory just fine though.
    – Tom Yan
    Commented Nov 16, 2023 at 18:15

2 Answers 2

1

BTRFS handles creating and deleting snapshots very efficiently. You can create regular read-only snapshots of the \backup subvolume and delete older ones without issues.

Just leave the latest 1-2 snapshots before running the delete to avoid any edge cases. Additionally, consider setting up snapshot rotation - for example, always keeping the last 12 monthly and 4 weekly snapshots. Automatically delete older ones.

This ensures you maintain backup history without filling up disk. Moreover, when deleting old snapshots, use btrfs subvolume delete rather than a regular rm -rf. This is safer and handles metadata cleanup better. Furthermore, make \backup a BTRFS subvolume rather than just a directory, as suggested in another answer.

This allows easier snapshotting and management. \snapshots can remain a regular directory. Also, validate backups by actually restoring sample files periodically. Ensure the backup process is capturing data correctly. Additionally, look into BTRFS RAID capabilities if you want redundancy against disk failures. In particular, RAID-1 with two disks protects against single disk failure. In summary, it's a good strategy. Just be mindful of snapshot rotation, use btrfs aware commands, validate integrity, and consider redundancy.

0

I'd set up some cool automation, maybe using rsync or throwing in a cron job, to smoothly back up all your data every week. That way, you're always rolling with the latest. Also incorporate monthly read-only snapshots from the \backup directory to \snapshots. This facilitates the creation of restore points, capturing incremental changes systematically.

Regularly review and prune older snapshots for storage efficiency. Leverage Btrfs capabilities to intelligently manage snapshots, preserving the most recent while discarding outdated ones. Implement an automated scheduling mechanism, such as cron jobs, to streamline the execution of backups and snapshots. This minimizes the need for manual intervention, ensuring reliability.

Consider segregating the \backup and \snapshots directories onto distinct physical drives or partitions. This mitigates the risk of data loss in the event of hardware failures.

Employ clear and discernible labels for the \backup and \snapshots directories. This practice simplifies identification and enhances organizational clarity. Regularly validate the integrity of backups and snapshots to guarantee their reliability in critical recovery scenarios. As an additional layer of protection use nakivo or altaro or what you like more.

1
  • That is exactly what I do. My only concern is how btrfs will behave once I start to delete old snapshots. Can it handle multiple continuous snapshots creation and deletion of old ones?
    – eli
    Commented Dec 12, 2023 at 8:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .