NetApp cDOT – How to create a snapshot schedule?

Clustered Data ONTAP in many ways is much different than the predecessor – ONTAP 7-mode. Even simple task, like create a snapshot schedule, might be confusing at the beginning for ex-7-mode Administrators. in Clustered ONTAP a lot ot things is now policy-based. One of those, are snapshot schedules. What does it mean? It means that if you want to check the  snapshot schedule, you first have to check which policy is assigned to a volume, for example:

cDOT01::> volume show -vserver svm1 -volume may -fields snapshot-policy
vserver volume snapshot-policy
------- ------ ---------------
svm1    may    40dayssnap

40dayssnap is a policy assigned to volume may, which is located on SVM (vserver) svm1. OK, let’s see what this policy holds:

cDOT01::> snapshot policy show -policy 40dayssnap
Vserver: cDOT01
                         Number of Is
Policy Name              Schedules Enabled Comment
------------------------ --------- ------- ----------------------------------
40dayssnap                       2 true    -
    Schedule               Count     Prefix                 SnapMirror Label
    ---------------------- -----     ---------------------- -------------------
    daily                     40     daily                  -
    hourly                     4     hourly                 -

You can notice few information in this output. First of all “Vserver: cDOT01” – this is my cluster SVM, which means that this policy can be used on all data SVMs within this cluster. Second: This policy has two schedules: it keeps latest 40 “daily” snapshots, and latest 4 “hourly” snapshots.

Note For  “NetApp 7-mode Administrators”

As you noticed within Clustered ONTAP the approach is different. Within 7-mode you had to set up a schedule on each volume defining 3 numbers (weekly, nightly, and hourly number of snapshots). In cDOT you can actually define you own policy and just assign it to number of volumes. If for example in the future you would like to modify single policy, you can do it within one command. Of course you can have a multiple policies, for example based on customers, or SLA agreements.

Create your own policy

Creating your own policy is easy, you can do it with snapshot policy create command. In my example I will show you how to create an local (available only on single SVM) snaphost policy with 1 weekly, 2 daily and 3 hourly snapshot schedule:

cDOT01::> snapshot policy create -vserver svm1 -policy svm1_local_policy -schedule1 weekly -count1 1 -schedule2 daily -count2 2 -schedule3 hourly -count3 3 -enabled true

cDOT01::> snapshot policy show -vserver svm1
Vserver: svm1
                         Number of Is
Policy Name              Schedules Enabled Comment
------------------------ --------- ------- ----------------------------------
svm1_local_policy                3 true    -
    Schedule               Count     Prefix                 SnapMirror Label
    ---------------------- -----     ---------------------- -------------------
    weekly                     1     weekly                 -
    daily                      2     daily                  -
    hourly                     3     hourly                 -

Policy is ready, now it’s time to assign it to our volumes! In my example I will update the policy on all volumes within my SVM svm1. To achieve that I will use * as a volume name, applying the change to all volumes

 

cDOT01::> volume modify -vserver svm1 -volume * -snapshot-policy svm1_local_policy

Warning: You are changing the Snapshot policy on volume april to svm1_local_policy.  Any Snapshot copies on this volume from the previous policy will not be deleted by
         this new Snapshot policy.
Do you want to continue? {y|n}: y

Volume modify successful on volume: april

Warning: You are changing the Snapshot policy on volume february to svm1_local_policy.  Any Snapshot copies on this volume from the previous policy will not be deleted
         by this new Snapshot policy.
Do you want to continue? {y|n}: y

Volume modify successful on volume: february
[...]

And so on on all volumes within my SVM. Now, this covers the basics. However, if you read carefully through those commands, you probably wonder how did I took those values weekly, daily, hourly. How NetApp knows what they mean and how to understand them? Those are already build-ins schedules. But it does not mean, you cannot create your own! 🙂

Create Your own Schedule

First let’s see what schedule are available for us and what are the definitions:

cDOT01::> job schedule cron show
Name                Description
----------------    -----------------------------------------------------
5min                @:00,:05,:10,:15,:20,:25,:30,:35,:40,:45,:50,:55
8hour               @2:15,10:15,18:15
daily               @0:10
hourly              @:05
weekly              Sun@0:15
5 entries were displayed.


Nice and clean, don’t you think? Let’s try to create own own schedule now. Let’s assume we want to create a schedule that will work every 6 months, creating a snapshot at 2:05 AM, at 10th day of the month

cDOT01::> job schedule cron create -name halfyearly -minute 5 -hour 2 -day 10 -month January,July

cDOT01::> job schedule cron show
Name                Description
----------------    -----------------------------------------------------
5min                @:00,:05,:10,:15,:20,:25,:30,:35,:40,:45,:50,:55
8hour               @2:15,10:15,18:15
daily               @0:10
halfyearly          Jan,Jul 10@2:05
hourly              @:05
weekly              Sun@0:15
6 entries were displayed.

Brilliant! Now, let’s utilize our new job schedule into Snapshot policy, assuming we want to keep 4 “halfyearly” snapshots

cDOT01::> snapshot policy add-schedule -vserver svm1 -policy svm1_local_policy -schedule halfyearly -count 4

cDOT01::> snapshot policy show -vserver svm1 -policy svm1_local_policy

                  Vserver: svm1
     Snapshot Policy Name: svm1_local_policy
  Snapshot Policy Enabled: true
             Policy Owner: vserver-admin
                  Comment: -
Total Number of Schedules: 4
    Schedule               Count     Prefix                 SnapMirror Label
    ---------------------- -----     ---------------------  -------------------
    weekly                     1     weekly                 -
    daily                      2     daily                  -
    hourly                     3     hourly                 -
    halfyearly                 4     halfyearly             -

Please note, since we were adding new schedule with snapshot policy add-schedule command, the syntax is slightly different comparing to snapshot policy create command.

Understanding the snapshot policy

As last paragraph of Today’s entry I would like to make sure you understand how to read such schedule. Let’s assume we have set this schedule on 01.01.2016. The schedule specifies:

  • 1 latest weekly snapshots, each snapshot is created, according to schedule (command job schedule cron show) Sunday at 00:15
  • 2 latest daily snapshots, each snapshot is created 10 minutes after midnight, each night
  • 3 latest hourly snapshots, each snapshot is created 5 minutes after full hour
  • 4 halfyearly snapshots, snapshots are created two times within a year: 10 Jan 02:10AM and 10 July 02:10AM

Assuming we have set this policy at 1st January 2016, and currently we have  3rd July 2017, our snapshot list for a volume (volume name: may) would contain

Vserver  Volume  Snapshot                        State        Size Total% Used%
-------- ------- ------------------------------- -------- -------- ------ -----
svm1     may
                 halfyearly.2016-01-10_0205      valid        50GB    60%   30%
                 halfyearly.2016-07-10_0205      valid        20GB    20%   30%
                 halfyearly.2017-01-10_0205      valid        10GB     5%   30%
                 weekly.2017-07-02_0015          valid        56KB     0%   30%
                 daily.2017-07-02_0010           valid        56KB     0%   30%
                 daily.2017-07-03_0010           valid        56KB     0%   30%
                 hourly.2017-07-03_1705          valid        56KB     0%   30%
                 hourly.2017-07-03_1805          valid        72KB     0%   36%
                 hourly.2017-07-03_1905          valid        64KB     0%   33%

I hope this output is not too long for you to have a quick study, make sure you understand why there are, for instance, only 3 halfyearly snapshots at this point.

Maximum number of snapshot copies per volume

I might have not mention that previously, snapshots copies are per volume. You cannot create a single snapshot for only a qtree. Also, single volume has a maximum number of snapshots which is 255. Please note this is the maximum number, which cannot be exceeded, therefore as a good practice I would encourage You to never exceed 250 snapshots while designing Your own policies. It’s good to have a “space” for couple of extra snapshots, you know – just in case.

If you have any questions regarding this topic please feel free to drop a question or Your remarks in “comment” section!

Leave a Reply

Your email address will not be published. Required fields are marked *