]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2scrub_all: make sure there's enough free space for a snapshot
authorTheodore Ts'o <tytso@mit.edu>
Wed, 20 Mar 2019 15:58:58 +0000 (11:58 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 21 Mar 2019 15:30:09 +0000 (11:30 -0400)
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>
scrub/e2scrub_all.in

index 8bc868aa0927d714b340b0fce09e8669587cf9b3..4cb90a0de4765f76821f0a89ac3ae00f85a021f8 100644 (file)
@@ -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