3rd-party ZFS auto-snapshot scripts - Am I doing something dangerous as far as PVE is concerned?

loneboat

Member
Jan 17, 2019
36
2
13
32
I use Proxmox to host a bunch of container and VMs, but I also have created some other (non-pve-related) ZFS pools/datasets on my PVE host. I was exploring 3rd-party scripts for automatically creating snapshots of these datasets (specifically this one: https://github.com/zfsonlinux/zfs-auto-snapshot , but my question is about PVE's ZFS snapshots in general). I installed this script on my node and ran it, and sure enough, I see some newly-created snapshots in my ZFS filesystems. Here is an example of the ZFS snapshots for one of my containers:

Code:
root@node-a:/# zfs list -t snapshot |grep 111
rpool/data/subvol-111-disk-0@__replicate_111-0_1605132601__                         9.34M      -      508M  -
rpool/data/subvol-111-disk-0@zfs-auto-snap_frequent-2021-11-29-1845                    0B      -      508M  -
rpool/data/subvol-111-disk-1@before_adding_data_folder                              1.21M      -     1.11G  -
rpool/data/subvol-111-disk-1@before_adding_data_folder_02                           1.20M      -     1.11G  -
rpool/data/subvol-111-disk-1@x_210113                                               26.3M      -     4.16G  -
rpool/data/subvol-111-disk-1@x_210114                                               51.6M      -     4.18G  -
rpool/data/subvol-111-disk-1@x_210615_Before_upgrade_to_0_8_7                        339M      -     3.45G  -
rpool/data/subvol-111-disk-1@x_210803                                                281M      -     4.41G  -
rpool/data/subvol-111-disk-1@x_211110_before_sharedcompendiums_upload               55.3M      -     5.08G  -
rpool/data/subvol-111-disk-1@zfs-auto-snap_frequent-2021-11-29-1845                   88K      -     6.09G  -
rpool/data/subvol-125-disk-0@__replicate_125-0_1638211140__                            0B      -     1.73G  -


Most of these ZFS snapshots are associated with container snapshots which I have taken manually via the PVE web GUI. But the "rpool/data/subvol-111-disk-1@zfs-auto-snap_frequent-2021-11-29-1845" one has been created by the script which I just ran. I looked in the web GUI and I do not see this as a "snapshot" of the container (which makes sense, because this is just a zfs snapshot of the container's volume).

I'm concerned that if I start snapshotting these volumes in ZFS, if I will somehow confuse PVE by having these extra snapshots around. My question is: Are these OK to have around? Will PVE essentially ignore these extra ZFS snapshots? Or is fiddling around with ZFS snapshots kind of a "no-no" on PVE? Should I find some other solution for managing snapshots of my ZFS systems?

Thank you
 

Dunuin

Famous Member
Jun 30, 2020
8,200
2,058
151
Germany
You shouldn't use ZFS snapshots but use the PVE snapshot function to create a zfs snapshot of guests. The point is that if you tell PVE to do a snapshot it will fsfreeze the guest OS and tell it to save the cache to disk before taking the snapshot so your snapshots will be more cosistent.
Just a simple ZFS snapshot won't do that.

You should take a look at this:
https://github.com/Corsinvest/cv4pve-autosnap

That script will create snapshots of guests using the PVE cli programs so you get ZFS snapshots but done right with fsfreeze, you see them in the GUI and so on just like you would manually create them using the GUI.
 
Last edited:

loneboat

Member
Jan 17, 2019
36
2
13
32
You shouldn't use ZFS snapshots but use the PVE snapshot function to create a zfs snapshot of guests. The point is that if you tell PVE to do a snapshot it will fsfreeze the guest OS and tell it to save the cache to disk before taking the snapshot so your snapshots ill be more cosistent.
Just a simple ZFS snapshot won't do that.

You should take a look at this:
https://github.com/Corsinvest/cv4pve-autosnap

That script will create snapshots of guests using the PVE cli programs so you get ZFS snapshots but done right with fsfreeze, you see them in the GUI and so on just like you would manually create them using the GUI.

Thanks for the advice. I will continue using proper PVE snapshots for my containers/VMs. This zfs-auto-snapshot was only intended to create snapshots for my non-PVE ZFS datasets - I just had not anticipated that it would ALSO snapshot my PVE ZFS datasets, and was worried it might mess up something on PVE's end if it suddenly started seeing extra ZFS snapshots it was not expecting.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!