summaryrefslogtreecommitdiff
path: root/scrub/e2scrub_all.in
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2019-03-20 11:58:58 -0400
committerTheodore Ts'o <tytso@mit.edu>2019-03-21 11:30:09 -0400
commitc120312253a4991078f8c0eb7fbde23851c4d258 (patch)
tree6b1e95ee0424107982eb692d0c31bc4d29f50cc1 /scrub/e2scrub_all.in
parentfbd0c83877acdfb255762abaebc0ffe757e989a9 (diff)
downloade2fsprogs-c120312253a4991078f8c0eb7fbde23851c4d258.tar.gz
e2scrub_all: make sure there's enough free space for a snapshot
If there isn't, skip the volume so we don't spam the system administrator with error messages. It's quite commkon that there is is zero free space in the volume group. Addresses-Debian-Bug: #924301 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'scrub/e2scrub_all.in')
-rw-r--r--scrub/e2scrub_all.in4
1 files changed, 4 insertions, 0 deletions
diff --git a/scrub/e2scrub_all.in b/scrub/e2scrub_all.in
index 8bc868aa..4cb90a0d 100644
--- a/scrub/e2scrub_all.in
+++ b/scrub/e2scrub_all.in
@@ -21,6 +21,7 @@
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
scrub_all=0
+snap_size_mb=256
conffile="@root_sysconfdir@/e2scrub.conf"
test -f "${conffile}" && . "${conffile}"
@@ -108,6 +109,9 @@ ls_scrub_targets() {
eval "${lvm_vars}"
echo "${LVM2_LV_ROLE}" | grep -q "snapshot" && continue
+ free_space="$(vgs -o vg_free --units m --noheadings --no-suffix "${LVM2_VG_NAME}" 2> /dev/null | sed -e 's/\..*//')"
+ test "${snap_size_mb}" -gt "${free_space}" && continue
+
if [ -n "${MOUNTPOINT}" ]; then
echo "${MOUNTPOINT}"
else