From 844e3b41264ec8e0ab0feca0c4cf4f8f77a9df2a Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Fri, 23 Feb 2024 16:42:46 +0100 Subject: [PATCH] docs: btrbk --- modules/btrbk/README.md | 134 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 130 insertions(+), 4 deletions(-) diff --git a/modules/btrbk/README.md b/modules/btrbk/README.md index a27ab28..8122b2b 100644 --- a/modules/btrbk/README.md +++ b/modules/btrbk/README.md @@ -17,22 +17,148 @@ Further resources: subvolume: -snapshot: .[] +snapshot: .\[] timestamp: Can be configured using the `timestamp_format` option. N: If multiple snapshots are created at the same time, the increasing counter N differentiates them. -## Actions +## Actions and Informative Commands -`run [filter...]`: In multiple steps, perform snapshots and backups. +### run [filter...] + +In multiple steps, perform snapshots and backups. * Read Data: Perform sanity checks * Create Snapshots * Create Backups * Delete Backups * Delete Snapshots -`clean [filter...]`: Delete incomplete backups (network error, kill signal while send/receive was ongoing). +### clean [filter...] + +Delete incomplete backups (network error, kill signal while send/receive was ongoing). + +### stats [filter...] + +Print statistics of snapshot and backup subvolumes. + +```shell +sudo btrbk -c /etc/btrbk/local-backup-hdd.conf stats +``` +```console +SOURCE_SUBVOLUME SNAPSHOT_SUBVOLUME TARGET_SUBVOLUME SNAPSHOTS BACKUPS +/mnt/data/jc-data/cloud.fykml.de /mnt/data/snap2/cloud.fykml.de.* /mnt/backup/snap2/cloud.fykml.de.* 77 17 +/mnt/data/jc-data/cloud.privacy1st.de /mnt/data/snap2/cloud.privacy1st.de.* /mnt/backup/snap2/cloud.privacy1st.de.* 77 17 + +Total: +154 snapshots + 34 backups (34 correlated) +``` + +### diff + +List the modified files since generation (transid) of subvolume in subvolume . + +Columns: + +``` +SIZE file was modified for a total of SIZE bytes +COUNT file was modified in COUNT generations +FLAGS "+" file accessed at offset 0 (at least once) +"c" COMPRESS flag is set (at least once) +"i" INLINE flag is set (at least once) +``` + +```shell +sudo btrbk -c /etc/btrbk/local-backup-hdd.conf diff cloud.privacy1st.de.20240222T2300 cloud.privacy1st.de.20240223T1400 +``` +```console +FLAGS COUNT SIZE FILE ++c. 1 2.36 MiB data/appdata_oc2uzw0ocw65/appstore/apps.json ++.. 1 12.00 KiB data/appdata_oc2uzw0ocw65/preview/a/3/f/c/b/b/7/5105712/256-256-crop.jpg ++.. 1 24.00 KiB data/appdata_oc2uzw0ocw65/preview/a/3/f/c/b/b/7/5105712/384-512-max.jpg ++.. 1 8.00 KiB data/appdata_oc2uzw0ocw65/preview/d/8/4/f/d/0/7/5105717/256-256-crop.jpg ++.. 1 20.00 KiB data/appdata_oc2uzw0ocw65/preview/d/8/4/f/d/0/7/5105717/384-512-max.jpg ++c. 1 208.00 KiB data/appdata_oc2uzw0ocw65/suspicious_login/models/527 +... 18 324.00 KiB data/nextcloud.log +... 257 40.21 MiB db/binlog.000119 +... 290 48.11 MiB db/ib_logfile0 ++c. 5 5.59 MiB db/ibdata1 +.c. 4 112.00 KiB db/mysql/innodb_index_stats.ibd +.c. 1 32.00 KiB db/mysql/innodb_table_stats.ibd ++.. 3 264.00 KiB db/nextcloud/oc_activity.ibd +.c. 1 32.00 KiB db/nextcloud/oc_activity_mq.ibd +... 2 16.00 KiB db/nextcloud/oc_appconfig.ibd ++.. 3 88.00 KiB db/nextcloud/oc_authtoken.ibd +... 4 40.00 KiB db/nextcloud/oc_calendar_reminders.ibd +... 3 40.00 KiB db/nextcloud/oc_calendarchanges.ibd ++.. 6 184.00 KiB db/nextcloud/oc_calendarobjects.ibd ++.. 4 232.00 KiB db/nextcloud/oc_calendarobjects_props.ibd +.c. 1 8.00 KiB db/nextcloud/oc_calendarsubscriptions.ibd +... 8 1.18 MiB db/nextcloud/oc_filecache.ibd +... 2 48.00 KiB db/nextcloud/oc_filecache_extended.ibd +... 1 32.00 KiB db/nextcloud/oc_gpodder_episode_action.ibd +... 2 48.00 KiB db/nextcloud/oc_jobs.ibd ++c. 1 48.00 KiB db/nextcloud/oc_login_address.ibd +... 3 64.00 KiB db/nextcloud/oc_login_ips_aggregated.ibd +... 1 40.00 KiB db/nextcloud/oc_maps_photos.ibd +... 1 24.00 KiB db/nextcloud/oc_news_feeds.ibd ++.. 9 4.98 MiB db/nextcloud/oc_news_items.ibd +... 4 64.00 KiB db/nextcloud/oc_notifications.ibd +.c. 2 24.00 KiB db/nextcloud/oc_notifications_settings.ibd +... 1 16.00 KiB db/nextcloud/oc_preferences.ibd +... 1 16.00 KiB db/nextcloud/oc_preview_generation.ibd +... 1 16.00 KiB db/nextcloud/oc_suspicious_login_model.ibd + +Total size: 104.47 MiB +``` + +## Cleanup + +First, perform a dryrun. Double-check the output. Then, replace `dryrun` with `run`. + +```shell +sudo btrbk -c /etc/btrbk/local-backup-ssd.conf \ + --override=snapshot_preserve=2d \ + --override=snapshot_preserve_min=latest \ + --override=snapshot_create=no \ + --override=target_preserve=2d \ + --override=target_preserve_min=latest \ + --print-schedule \ + dryrun +``` +```console +SNAPSHOT SCHEDULE +----------------- +ACTION SUBVOLUME SCHEME REASON +delete /mnt/data/snap2/cloud.privacy1st.de.20230927T1827 2d (sunday, 00:00) - +... +delete /mnt/data/snap2/cloud.privacy1st.de.20240220T0000 2d (sunday, 00:00) - +- /mnt/data/snap2/cloud.privacy1st.de.20240221T0000 2d (sunday, 00:00) preserve daily: first of day, 2 days ago, at 00:00 +delete /mnt/data/snap2/cloud.privacy1st.de.20240221T0100 2d (sunday, 00:00) - +... +delete /mnt/data/snap2/cloud.privacy1st.de.20240221T2300 2d (sunday, 00:00) - +- /mnt/data/snap2/cloud.privacy1st.de.20240222T0000 2d (sunday, 00:00) preserve daily: first of day, 1 days ago, at 00:00 +delete /mnt/data/snap2/cloud.privacy1st.de.20240222T0100 2d (sunday, 00:00) - +... +delete /mnt/data/snap2/cloud.privacy1st.de.20240222T2300 2d (sunday, 00:00) - +- /mnt/data/snap2/cloud.privacy1st.de.20240223T0000 2d (sunday, 00:00) preserve daily: first of day, 0 days ago, at 00:00 +delete /mnt/data/snap2/cloud.privacy1st.de.20240223T0100 2d (sunday, 00:00) - +... +delete /mnt/data/snap2/cloud.privacy1st.de.20240223T1500 2d (sunday, 00:00) - +- /mnt/data/snap2/cloud.privacy1st.de.20240223T1600 2d (sunday, 00:00) preserve min: latest + +BACKUP SCHEDULE +--------------- +ACTION SUBVOLUME SCHEME REASON +delete /mnt/backup/snap2/cloud.privacy1st.de.20230927T1827 2d (sunday, 00:00) - +... +delete /mnt/backup/snap2/cloud.privacy1st.de.20240220T0000 2d (sunday, 00:00) - +- /mnt/backup/snap2/cloud.privacy1st.de.20240221T0000 2d (sunday, 00:00) preserve daily: first of day, 2 days ago, at 00:00 +- /mnt/backup/snap2/cloud.privacy1st.de.20240222T0000 2d (sunday, 00:00) preserve daily: first of day, 1 days ago, at 00:00 +- /mnt/backup/snap2/cloud.privacy1st.de.20240223T0000 2d (sunday, 00:00) preserve daily: first of day, 0 days ago, at 00:00 +- /mnt/backup/snap2/cloud.privacy1st.de.20240223T1600 2d (sunday, 00:00) preserve min: latest +``` ## Configuration