digint / btrbk

Tool for creating snapshots and remote backups of btrfs subvolumes
https://digint.ch/btrbk/
GNU General Public License v3.0
1.69k stars 122 forks source link

RFE: Set suffix (after date), label, or other metadata to identify snapshots and backups #191

Open xenithorb opened 7 years ago

xenithorb commented 7 years ago
Use case:

To be able to use something like sudo btrbk run -n pre_upgrade where "pre_upgrade" would be a a label or appended to to the directory name, or perhaps it can be done by saving metadata inside the snapshot directory, for the purpose of identifying snapshots and backups. Also wondering if btrfs's native btrfs fi label can be leveraged. This presented itself as something potentially useful when I wanted to test upgrading my system to a new version and had to make manual note of the known-good backup date/time.

btrbk list snapshots after such an enhancement may look like:

source_host  source_subvol         snapshot_subvol                                                  status  target_host  target_subvol                                                                                                                                                        
-----------  --------------------  ---------------------------------------------------              ------  -----------  ----------------------------------------------------                                                                                                                 
-            /mnt/btrfs_root/ROOT  /mnt/btrfs_root/snapshots/ROOT.20171001T000102-0400              -       -            /mnt/external1/icarus_main/ROOT.20171001T000102-0400                                                                                                                 
-            /mnt/btrfs_root/ROOT  /mnt/btrfs_root/snapshots/ROOT.20171002T000102-0400-pre_upgrade  -       -            /mnt/external1/icarus_main/ROOT.20171002T000102-0400-pre_upgrade                                                                                                                
-            /mnt/btrfs_root/ROOT  /mnt/btrfs_root/snapshots/ROOT.20171003T000101-0400              -       -            /mnt/external1/icarus_main/ROOT.20171003T000101-0400

or (preferred):

source_host  source_subvol         snapshot_subvol                                     label             status  target_host  target_subvol                                                                                                                                                        
-----------  --------------------  --------------------------------------------------- ----------------  ------  -----------  ----------------------------------------------------                                                                                                                 
-            /mnt/btrfs_root/ROOT  /mnt/btrfs_root/snapshots/ROOT.20171001T000102-0400                   -       -            /mnt/external1/icarus_main/ROOT.20171001T000102-0400                                                                                                                 
-            /mnt/btrfs_root/ROOT  /mnt/btrfs_root/snapshots/ROOT.20171002T000102-0400 pre_upgrade       -       -            /mnt/external1/icarus_main/ROOT.20171002T000102-0400                                                                                                                 
-            /mnt/btrfs_root/ROOT  /mnt/btrfs_root/snapshots/ROOT.20171003T000101-0400                   -       -            /mnt/external1/icarus_main/ROOT.20171003T000101-0400     
digint commented 7 years ago

Sounds like a useful thing to have!

The only way I see to put a label would be in the snapshot / backup name, as this should also work with raw targets. I'll have to check if this fits into the framework nicely though, but this should be no problem.

I'd hate to but metadata into the subvolume (e.g. some /BTRBK_METADATA file before snapshotting, and remove it afterwards), as I would have to touch the source subvolume, which btrbk does never do by design.

Also wondering if btrfs's native btrfs fi label can be leveraged.

This would not work, as it's a filesystem label and not per-subvolume.