Hey there, folks! Currently playing around with a laptop that’s got three SSDs. Running Arch but that isn’t quite related. I have everything configured on one SSD, the other two are totally fresh. What do I need to do to setup one of those fresh SSDs for Timeshift backups? Please walk me through it from the very start- I think I understand some parts but I’m not too certain.

I can format the drives using mkfs.btrfs without any issues, but I’m confused about how I can add subvolumes and configure their root permissions properly to allow Timeshift snapshots.

EDIT: I see now that I misunderstood what Timeshift does. New question- which tool can I use to make a backup of my entire filesystem onto another drive such that it can be restored?

  • mutual_ayed@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    1 day ago

    Build the snapshot with the below file

    btrfs subvolume snapshot -r /path-to-sv/subvol /path-to-sv/subvol.ro
    
    # send the subvolume to file, compress with parallel ZSTD & monitor progress
    btrfs send /path-to-sv/subvol.snap.ro | \
        pv -c | pzstd -16 |  pv -c | \
        dd of=/path-to-external-backup/subvol.zstd.back
    
    # delete read-only snapshot
    btrfs subvolume delete /path-to-sv/subvol.ro
    

    To restore subvolume from backup we run the process in reverse:

    # read backup file and decompress the stream, redirect to temporary read-only snapshot
    dd if=/path-to-external-backup/subvol.zstd.back | \
        pv -c | pzstd -d | pv -c | \
        btrfs receive /path-to-sv/
    
    
    # make a RW subvolume 
    btrfs subvolume snapshot subvol.ro subvol
    
    # delete temporary snapshot
    btrfs subvolume delete /path-to-sv/subvol.ro    
    

    From here

    https://superuser.com/questions/1396241/btrfs-imaging-a-volume-to-an-external-file

    You might want to make this into a systemd timer to run at boot or before shutting down

    https://linuxconfig.org/how-to-schedule-tasks-with-systemd-timers-in-linux