Bug#876675: snapper: Avoid filling up btrfs, as it break the system?
On Wed, 22 Nov 2017 11:36:33 +0300 Andrey Skvortsov wrote: > I see in Debian wiki it's recommended not to have more than 12 > snapshots [1]. > > 1. https://wiki.debian.org/Btrfs Its number is decided by snapper upstream, so if you have a question about it, please ask them. And I doubt whether it's true as Nicholas noted "Need to find the source for this on linux-btrfs". -- Hideki Yamane
Bug#876675: snapper: Avoid filling up btrfs, as it break the system?
[Sunil Mohan Adapa] > The solution to this part is to trigger a number cleanup after every > snapshot. The fix is available as part of patch in > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=880144 . Hence, adding > patch tag. Please consider accepting the simple patch to fix both bugs. I suspect you talk about the second patch in bug #880144, ie this: diff --git a/debian/80snapper b/debian/80snapper index 0007402..ddf1f8b 100644 --- a/debian/80snapper +++ b/debian/80snapper @@ -1,3 +1,3 @@ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=770938 - DPkg::Pre-Invoke { "if [ -x /usr/bin/snapper -a -e /etc/snapper/configs/root ]; then rm /var/tmp/snapper-apt || true ; snapper create -d apt -c number -t pre -p > /var/tmp/snapper-apt || true ; fi"; }; - DPkg::Post-Invoke { "if [ -x /usr/bin/snapper -a -e /var/tmp/snapper-apt ]; then snapper create -d apt -c number -t post --pre-number=`cat /var/tmp/snapper-apt` || true ; fi"; }; + DPkg::Pre-Invoke { "if [ -e /etc/default/snapper ]; then . /etc/default/snapper; fi; if [ -x /usr/bin/snapper -a ! x$DISABLE_APT_SNAPSHOT = 'xyes' -a -e /etc/snapper/configs/root ]; then rm /var/tmp/snapper-apt || true ; snapper create -d apt -c number -t pre -p > /var/tmp/snapper-apt || true ; snapper cleanup number || true ; fi"; }; + DPkg::Post-Invoke { "if [ -e /etc/default/snapper ]; then . /etc/default/snapper; fi; if [ -x /usr/bin/snapper -a ! x$DISABLE_APT_SNAPSHOT = 'xyes' -a -e /var/tmp/snapper-apt ]; then snapper create -d apt -c number -t post --pre-number=`cat /var/tmp/snapper-apt` || true ; snapper cleanup number || true ; fi"; }; It has already been applied in the snapper git repository. Did it help with this issue too? -- Happy hacking Petter Reinholdtsen
Bug#876675: snapper: Avoid filling up btrfs, as it break the system?
severity 876675 important tags 876675 + patch thanks The biggest reason why snapper fills up disk with snapshots is because the number algorithm does not cleanup automatically. When apt snapshots are taken by this package's apt hooks, number algorithm is used. However, unlike timeline algorithms that are periodically cleaned up by snapperd, numeric snapshots are not (even after saying number cleanup to 'yes'). Even after configuring snapperd to keep very few apt snapshots, this still fills up the disk eventually. The solution to this part is to trigger a number cleanup after every snapshot. The fix is available as part of patch in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=880144 . Hence, adding patch tag. Please consider accepting the simple patch to fix both bugs. Bumping priority as this as it effects all FreedomBox machines that use snapper. Thanks, -- Sunil signature.asc Description: OpenPGP digital signature
Bug#876675: snapper: Avoid filling up btrfs, as it break the system?
Hi, I've run into the same problem. btrfs partition was full of snapper snapshots and has made the system unbootable. what about decrease default number of snapshots? I see in Debian wiki it's recommended not to have more than 12 snapshots [1]. 1. https://wiki.debian.org/Btrfs -- Best regards, Andrey Skvortsov signature.asc Description: PGP signature
Bug#876675: snapper: Avoid filling up btrfs, as it break the system?
[Hideki Yamane] >> Could snapper be changed to restrict the amount of snapshots kept in >> each category based on amount of free space on the file system, to avoid >> filling up the disk with snapshots? > > Unfortunately, no. However, you can limit snapshots by "numbers". Any hope to have such feature implemented, as snapper in its current form is dangerous as long as btrfs start blocking processes when the disk is full. :( > One btrfs guy says it's hard to do such behavior since btrfs snapshots > share same blocks as those snapshot data, so not sure how to keep > amount of disk by deleting old snapshots. One way would be to not take snapshots if df show less than X % free space. Another would be to start removing old snapshots until df show more than X % free space before doing any snapshots. The point is that for me it is better to not take snapshots than to bring down the entire service. :) >> It would be great if snapper also provided a way to easily figure out >> how much disk space a given snapshot uses. > > Said above, most of snapshots share same blocks, it's hard I guess. A way to do this is documented in https://raw.githubusercontent.com/agronick/btrfs-size/master/btrfs-size.sh >. > Could you give me some examples, please? Sure, check out https://github.com/zfsnap/zfsnap/wiki/zfSnap >. -- Happy hacking Petter Reinholdtsen
Bug#876675: snapper: Avoid filling up btrfs, as it break the system?
Hi, > Could snapper be changed to restrict the amount of snapshots kept in > each category based on amount of free space on the file system, to avoid > filling up the disk with snapshots? Unfortunately, no. However, you can limit snapshots by "numbers". One btrfs guy says it's hard to do such behavior since btrfs snapshots share same blocks as those snapshot data, so not sure how to keep amount of disk by deleting old snapshots. > It would be great if snapper also provided a way to easily figure out > how much disk space a given snapshot uses. Said above, most of snapshots share same blocks, it's hard I guess. > Btw, are you aware of https://tracker.debian.org/pkg/zfsnap >, > which uses an interesting way to name snapshots (with timestamp and > duration), which make it quite easy to administrate the snapshots from > the command line. Perhaps something similar could be done by snapper? Could you give me some examples, please? -- Hideki Yamane
Bug#876675: snapper: Avoid filling up btrfs, as it break the system?
Package: snapper Version: 0.5.0-2 Hi. I use the FreedomBox with btrfs, and it is configured to use snapper to take regular file system snapshots. But as you can see from https://bugs.debian.org/876514 >, this can bring down the system if the btrfs file system fill up. Could snapper be changed to restrict the amount of snapshots kept in each category based on amount of free space on the file system, to avoid filling up the disk with snapshots? It would be great if snapper also provided a way to easily figure out how much disk space a given snapshot uses. Btw, are you aware of https://tracker.debian.org/pkg/zfsnap >, which uses an interesting way to name snapshots (with timestamp and duration), which make it quite easy to administrate the snapshots from the command line. Perhaps something similar could be done by snapper? -- Happy hacking Petter Reinholdtsen