mirror of
https://github.com/zfsonlinux/zfs-auto-snapshot.git
synced 2025-08-18 16:38:50 +02:00
6762213 We should not snapshot swap or dump devices by default
This commit is contained in:
@@ -882,12 +882,39 @@ function auto_include {
|
||||
*false | false*)
|
||||
;;
|
||||
*)
|
||||
$PFZFS set com.sun:auto-snapshot=true $pool
|
||||
FIRSTRUN_POOLS="$pool $FIRSTRUN_POOLS"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
for pool in ${FIRSTRUN_POOLS} ; do
|
||||
# This is the first time the service has run on this pool,
|
||||
# set appropriate zfs user properties on it
|
||||
$PFZFS set com.sun:auto-snapshot=true $pool
|
||||
|
||||
# check for swap and dump devices and disable snapshots there
|
||||
SWAP=$(swap -l | grep "/dev/zvol/dsk/$pool/" | awk '{print $1}')
|
||||
for swap in $SWAP ; do
|
||||
vol=$(echo $swap | sed -e 's#/dev/zvol/dsk/##')
|
||||
echo "Disabling snapshots for swap device $vol"
|
||||
$PFZFS set com.sun:auto-snapshot=false $vol
|
||||
done
|
||||
|
||||
# can't run dumpadm as a non-root user, so check for dumpadm.conf
|
||||
if [ -r /etc/dumpadm.conf ] ; then
|
||||
DUMP=$(grep "^DUMPADM_DEVICE=" /etc/dumpadm.conf |\
|
||||
grep "/dev/zvol/dsk/$pool/" |\
|
||||
awk -F= '{print $2}')
|
||||
if [ -n "$DUMP" ] ; then
|
||||
vol=$(echo $DUMP | sed -e 's#/dev/zvol/dsk/##')
|
||||
echo "Disabling snapshots for dump device $vol"
|
||||
$PFZFS set com.sun:auto-snapshot=false $vol
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user