proxmox-zfs-postinstall icon indicating copy to clipboard operation
proxmox-zfs-postinstall copied to clipboard

zfs-auto-snapshot rapidly fills my storage in a few days

Open jenswes opened this issue 2 years ago • 3 comments

Hi, thanks nice script :-) quite easy to use

In my case i just want the zfs-auto-snapshot for a few (ok one for now) dataset(s) as i use zfs on all VMs and containers.

from the man page: --default-exclude By default zfs-auto-snapshot will snapshot all datasets except for those in which the user-property com.sun:auto-snapshot is set to false. This option reverses the behavior and requires com.sun:auto-snapshot to be set to true.

i added --default-exclude to all cron jobs */15 * * * * root which zfs-auto-snapshot > /dev/null || exit 0 ; zfs-auto-snapshot --quiet --syslog --label=frequent --keep=8 --default-exclude //

and set the property com.sun:auto-snapshot=true to the wanted dataset

zfs set com.sun:auto-snapshot=true data1/subvol-103-disk-1
verify:
root@pve1:/etc# zfs get com.sun:auto-snapshot data1/subvol-103-disk-1
NAME                     PROPERTY               VALUE                  SOURCE
data1/subvol-103-disk-1  com.sun:auto-snapshot  true                   local

after this i delete all zfs-auto-snap snapshot exept the wanted (my samba share ith this case)

zfs list -H -o name -t snapshot | grep zfs-auto-snap | grep -v data1/subvol-103-disk-1 | xargs -n1 zfs destroy

i think it would be nice having this as an option in your script

jens

jenswes avatar Feb 04 '22 20:02 jenswes

Hi jenswes

it´s not an Option to set default to false and opt in because of the design. Using ZAS on both sides would cause the Replica to make Autosnapshots because of an receviced com.sun:auto-snapshot Value. So it´s best Practice to set com.sun:auto-snapshot=false on remote side and opt out at the Source. That´s my Experience after 9 Years ZAS!

You´ll find a Cleaning Script for comfortable Retention in our Bashclub!

Cheers Chriz

cpzengel avatar Feb 04 '22 20:02 cpzengel

Hello Chriz, thanks for the fast answer :-) i'm just playing for now an a single server and wanted to have the samba previous versions stuff for windows running. I didn't think about replication. these are my first steps with zfs on linux, but i'm using zfs since it got materialized in opensolaris :-) and i like zfs. A good question how zfs-auto-snaps in my case interfere with a proxmox replication (proxmox cluster) of the symba container and the share bind-mount? - my guess thats not a problem, but the proxmox replica need to run zfs-auto-snaps as well, or it has no snapshots (=previous versions in windows) i'm testing such an installation also. There i have 40+ filesystems, but only one with the need of zfs-auto-snapshot.... you wrote

Using ZAS on both sides would cause the Replica to make Autosnapshots because of an receviced com.sun:auto-snapshot Value.

so with zfs replication the user property get replicated too, but if you do it vice or versa (opt in or out) is just being lazy (opt in 1x or opt out 39x) or do i overlook any other penalty here? kind regards jens

jenswes avatar Feb 04 '22 22:02 jenswes

proxmox replication is the last choice. use our bashclub-zfs script and the 02pull control script. avoid auto-snapshot on replica systems, never set it on true! chriz from zfs.rocks and sysops.tv

cpzengel avatar Feb 04 '22 23:02 cpzengel