1

I have a btrfs root partition with an @ root subvolume and an @home subvolume and I do auto-snapshots during updates and timeshift scheduled snapshots, both of which are saved on the same drive. This is great but I want to have extra redundancy in case of a drive failure.

In my last setup on Debian, I used the ext4 filesystem and put my timeshift rsync backups on an external drive.

How can I do something similar, i.e. backup to an external drive, while still taking snapshots on the root device?

In addition to the system device, which is a 1TB SSD formated as btrfs, I have a 2 TB HDD currently formatted with two NTFS paritions since I dual boot windows as well. Now I would be willing to completely move to a linux filesystem on that drive but I don't know how I would handle backing up the root drive. I thought about doing a disk image onto the HDD with dd but if I do this, I would (a) loose an extra TB of storage if I understand correctly how dd works and (b) would not now how to restore from the image. Ideally, I would like to have a btrfs partition on the second drive for backups of the root device only and a second (e.g. ext4 or ntfs) partition just for overflow data storage.

Essentially my question is: How can I facilitate a backup of my already "snapshotting" root partition (and also know how to restore from it)?

EDIT: My solution

The solution I came up with uses btrbk, which is a single perl script that manages snapshots and automatically sends them to another drive. I documented the setup on my github account here.

btrbk runs using a single config file to specify snapshot and backup locations as well as retention policies. I schedule the backup process using crontab. It is a little work to set it up for beginners but much more rewarding in the learning process than simply using snapper or timeshift.

2

1 Answer 1

0

This is the solution I come up with for this kind of requirement: https://github.com/ceremcem/smith-sync

I prepared my own scripts to backup to a target: https://github.com/ceremcem/smith-sync-new-target

Here is the overall backup system I'm using: https://github.com/ceremcem/erik-sync

This process is quite a bit complex and requires a deep knowledge. In short, this script does the followings:

  • Defer any automatic suspend actions in order not to interrupt the backup process.
  • Send all snapshots to the target.
  • Create a new rootfs within the target by using the latest snapshots.
  • Modify necessary files such as $target/rootfs/etc/fstab, .../etc/crypttab, etc. accordingly.
  • Mount the boot partition, copy the most recent boot files into it.
  • Update GRUB bootloader in a chroot environment.

Now our target disk (backup disk) is the exact copy of our current system, without using dd command. You can create any additional partitions in the target disk according to your needs, this will not break this backup process.

1
  • Thank you for your explanation! This setup is probably overkill for my needs so I used btrbk, which just sends the snapshots to a second drive. As far as I understand, this is only useful in cases of software errors, right? In case of a hardware error, could I install the snapshots on a new drive?
    – weygoldt
    Mar 7 at 15:47

You must log in to answer this question.

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