From dfa015673662f03da518338ad25d924cbc6d1bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20Sch=C3=B6ning?= Date: Mon, 31 Oct 2022 11:43:59 +0100 Subject: [PATCH] https://github.com/hunleyd/btrfs-auto-snapshot/issues/10#issuecomment-1296906173 --- btrfs-auto-snapshot | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/btrfs-auto-snapshot b/btrfs-auto-snapshot index cfc18db..b5008cc 100755 --- a/btrfs-auto-snapshot +++ b/btrfs-auto-snapshot @@ -355,7 +355,7 @@ argsp_cmdline_exit_handler() # {@code /dev/sda2 /srv btrfs rw,relatime,space_cache,subvolid=261,subvol=/@/srv 0 0} # {@code /dev/sda2 /usr/local btrfs rw,relatime,space_cache,subvolid=259,subvol=/@/usr/local 0 0} # {@code /dev/sda2 /var btrfs rw,relatime,space_cache,subvolid=258,subvol=/@/var 0 0} -# +# # @return Associative array mapping mountpoints and their subvolumes. # btrfs_mounts_calc() @@ -529,13 +529,14 @@ btrfs_snaps_do() ${dry_run} mkdir "${snaps_dir}" fi - # TODO Creating snapshots too frequently might result in their directory names - # overlapping, which either results in error messages about read-only file systems - # or additional subdirs created in existing snapshot dirs. The latter is a problem - # as it prevents deletion of those snapshots because they contain non-snap data. - # The following is a workaround for those cases especially making tests easier. - # Some better fix might be to check for if the snapshot exists already and don't - # create it or use seconds in the names. Needs to be discussed further... + # Creating snapshots too frequently might result in overlapping directory names, + # which either results in error messages about read-only file systems or new + # subdirs created in existing snapshot dirs. The latter is a problem as those + # dirs prevent deletion of snapshots because they contain non-snap data. The + # following is a workaround for those cases especially making tests easier. + # Though, the same problem might occur because of changes to daylight saving + # time, which results in the same snap names getting calculated twice. Not even + # higher precision names containing seconds would change that. log notice "$( ${dry_run} btrfs subvolume delete -c "${snap_path}" 2> '/dev/null' )" log notice "$( ${dry_run} btrfs subvolume snapshot "${snap_opts[@]}" )" done