ONTAP Discussions
ONTAP Discussions
I'm testing Snapshot locking/SnapLock and I'm seeing behavior that I didn't expect.
I have a Snapshot policy configured to take hourly Snapshots with Maximum Snapshot copies = 4 and SnapLock retention period = 4.
I always have 5 hourly Snapshot copies though instead of 4. This screen grab was taken at 2:25 PM. I don't expect the the Snapshot copy from 2:05 PM to still exist.
I'm pretty sure that this is because the SnapLock retention period doesn't expire in time for it to be deleted. It must be a matter of seconds.
On a volume with a large amount of data and/or changes between Snapshots, that extra one could end up taking lots of storage.
I just want to ask if others have experienced this and if it's expected, or if there's a workaround?
I have a support case for this and the TSE did not have an immediate answer but will look into it.
Solved! See The Solution
noone stops you from using seconds 😉
the duration for retention period must be in seconds (0 - 65535), minutes (0 - 60), hours (0 - 24), days (0 - 36500), months (0 - 1200), years (0 - 100).
So in your case 4 hours = 14400 seconds
You are free to use 14399 as an example
snapshot locking retention is by time not by amount of snapshots
Correct. The screen grab taken at 2:25 PM still shows a Snapshot that expired at 2:05 PM though.
Probably because the SnapLock retention period doesn't expire in time for it to be deleted so I'm asking if others have experienced this and it's expected, or if there's a workaround.
Apologies I missed your screenshot with expiry-time
I understand your point
and the same picture you are facing I was easily able to repro in a lab.
The thing here is a new 5th snapshot is created at the same time when the oldest snapshot is still locked so unable to be removed.
And snapshot locking trumps rotation.
It is an expected behavior from the system and if I change the retention period from 20 min to 1199sec they will be rotating just as expected
cluster1::*> snap list test_snaplock_volume -fields snaplock-expiry-time
vserver volume snapshot snaplock-expiry-time
------------- -------------------- ---------------------- --------------------
test_snaplock test_snaplock_volume 5min.2025-06-24_1310 6/24/2025 13:30:00 +00:00
test_snaplock test_snaplock_volume 5min.2025-06-24_1315 6/24/2025 13:35:00 +00:00
test_snaplock test_snaplock_volume 5min.2025-06-24_1320 6/24/2025 13:40:00 +00:00
test_snaplock test_snaplock_volume 5min.2025-06-24_1325 6/24/2025 13:45:00 +00:00
test_snaplock test_snaplock_volume 5min.2025-06-24_1330 6/24/2025 13:50:00 +00:00
7 entries were displayed.
cluster1::*> snapshot policy show test
Vserver: cluster1
Number of Is
Policy Name Schedules Enabled Comment
------------------------ --------- ------- ----------------------------------
test 1 true -
Schedule Count Prefix SnapMirror Label Retention Period
-------------- ----- ------------- ------------------ ------------------
5min 4 5min - 1200 seconds
cluster1::*> snapshot policy modify-schedule -policy test -schedule 5min -newretention-period 1199 seconds
after waiting for a while to let previous snaps with retention of 20min to rotate
cluster1::*> snap list test_snaplock_volume -fields snaplock-expiry-time
vserver volume snapshot snaplock-expiry-time
------------- -------------------- ---------------------- --------------------
test_snaplock test_snaplock_volume 5min.2025-06-24_1345 6/24/2025 14:04:59 +00:00
test_snaplock test_snaplock_volume 5min.2025-06-24_1350 6/24/2025 14:09:59 +00:00
test_snaplock test_snaplock_volume 5min.2025-06-24_1355 6/24/2025 14:14:59 +00:00
test_snaplock test_snaplock_volume 5min.2025-06-24_1400 6/24/2025 14:19:59 +00:00
Thank you for going through the process of recreating the issue.
I had the same idea to set expiration to 239 minutes instead of 4 hours (240 minutes) but you can only enter a number between from 1-60 minutes.
noone stops you from using seconds 😉
the duration for retention period must be in seconds (0 - 65535), minutes (0 - 60), hours (0 - 24), days (0 - 36500), months (0 - 1200), years (0 - 100).
So in your case 4 hours = 14400 seconds
You are free to use 14399 as an example
Interesting! In the GUI the smallest available increment is minutes.
But the CLI will allow me to use seconds?
for sure seconds can be used in CLI
command example is in my previous comment