Adding a snapshot schedule for CephFS subvolume

Create snapshot schedules and retention policies for directories in a subvolume, subvolume within a default group, and for subvolumes within a non-default group.

Before you begin

Before you begin, make sure that you have the following prerequisites in place:
  • A running and healthy IBM Storage Ceph cluster with Ceph File System (CephFS) deployed.
  • A minimum of read access on the Ceph Monitor.
  • Read and write capability on the Ceph Manager nodes.
  • A CephFS subvolume and subvolume group created.

About this task

Schedules are considered different, if their repeat interval and start times are different.

Add a snapshot schedule for a CephFS file path that does not exist yet. A CephFS path can have only one retention policy, but a retention policy can have multiple count-time period pairs.

Note:
  • After the scheduler module is enabled, running the ceph fs snap-schedule command displays the available subcommands and their usage format.
  • Subvolumes belonging to the default subvolume group and non-default subvolume group can be scheduled for creating snapshots. However, the commands are different.

Procedure

You can add snapshot schedules to the directories within a subvolume, subvolume in the default group and to the subvolume in a non-default group.
  • Add a snapshot schedule to a directory in a subvolume.
    1. Get the absolute path of the subvolume where directory exists:
      Syntax:
      ceph fs subvolume getpath VOLUME_NAME SUBVOLUME_NAME --group-name SUBVOLUME_GROUP_NAME
      Example:
      [ceph: root@host02 /]# ceph fs subvolume getpath cephfs01 sub0 --group_name subgroup0
      
      /volumes/subgroup0/sub0/db992be0-aacd-414e-8abd-e1bfeb37a4a2
    2. Add a snapshot schedule to a directory in the subvolume:
      Note: START_TIME is represented in ISO 8601 format.
      Note: Path in snap-schedule command is <absolute_path_of_ subvolume>/<relative_path_of_test_dir>. Get the absolute_path of the subvolume, from step 1.
      Syntax:
      ceph fs snap-schedule add SUBVOLUME_DIR_PATH SNAP_SCHEDULE [START_TIME] --fs CEPH_FILE_SYSTEM_NAME
      In this example, test_dir is the directory for which the schedule is added.
      [ceph: root@host02 /]# ceph fs snap-schedule add /volumes/subgroup0/sub0/4dee0788-32a0-47e6-ac4b-bd8568a6989b/test_dir 1h --fs cephfs01
      
      Schedule set for path /volumes/subgroup0/sub0/4dee0788-32a0-47e6-ac4b-bd8568a6989b/test_dir
  • Add a snapshot schedule for a CephFS subvolume in the default group:
    Syntax:
    ceph fs snap-schedule add /.. SNAP_SCHEDULE [START_TIME] --fs CEPH_FILE_SYSTEM_NAME --subvol SUBVOLUME_NAME
    Important: The path ( / ) must be defined and cannot be left empty. There is no dependency on path string value, you can define it with one of the following characters:

    / - /..

    In this example, a snapshot schedule for the CephFS subvolume sub0 volume is created, taking snapshots every hour, and starts on 27 June 2022 9:50 PM.
    [ceph: root@host02 /]# ceph fs snap-schedule add / 1h 2022-06-27T21:50:00 --fs cephfs01 --subvol sub0
  • Add a snapshot schedule for a CephFS subvolume in the non-default group:
    Syntax:
    ceph fs snap-schedule add /.. SNAP_SCHEDULE [START_TIME] --fs CEPH_FILE_SYSTEM_NAME  --subvol SUBVOLUME_NAME --group NON_DEFAULT_SUBVOLGROUP_NAME
    
    Important: The path ( / ) must be defined and cannot be left empty. There is no dependency on path string value, you can define it with one of the following characters:

    / - /..

    In this example, a snapshot schedule is added for the Ceph subvolume sv_non_def_1 belonging to the non default group subgroup0.
    [ceph: root@host02 /]# ceph fs snap-schedule add / 2M --subvol sub0 --group subgroup0

Adding retention policy for snapshot schedules of a CephFS volume path

Before you begin

Before adding a retention policy, you must have a snapshot schedule in place.

About this task

To define how many snapshots to retain in the volume path at any time, you must add a retention policy after you have created a snapshot schedule.

You can create retention policies for directories within a subvolume, subvolume in a default group and to the subvolume in a non-default group.

Procedure

  • Add a retention policy to a snapshot schedule created for a directory in a subvolume.
    ceph fs snap-schedule retention add SUBVOLUME_DIR_PATH [COUNT_TIME_PERIOD_PAIR] TIME_PERIOD COUNT
    For example,
    [ceph: root@host02 /]# ceph fs snap-schedule retention add /volumes/subvolgroup_1/subvol_1 h 14 (1)
    [ceph: root@host02 /]# ceph fs snap-schedule retention add /volumes/subvolgroup_1/subvol_1 d 4 (2)
    [ceph: root@host02 /]# ceph fs snap-schedule retention add /volumes/subvolgroup_1/subvol_1 14h4w (3)
    • (1) This example keeps 14 snapshots at least one hour apart.
    • (2) This example keeps 4 snapshots at least one day apart.
    • (3) This example keeps 14 hourly, and 4 weekly snapshots.
  • Add a retention policy to a snapshot schedule created for a subvolume in the default group.
    ceph fs snap-schedule retention add / [COUNT_TIME_PERIOD_PAIR] TIME_PERIOD COUNT --fs CEPH_FILE_SYSTEM_NAME --subvol SUBVOLUME_NAME
    Important: The path ( / ) must be defined and cannot be left empty. There is no dependency on path string value, you can define it with one of the following characters:

    / - /..

    For example,
    [ceph: root@host02 /]# ceph fs snap-schedule retention add / 5h --fs cephfs --subvol sv_sched 
    Retention added to path /volumes/sv_sched/e704342a-ff07-4763-bb0b-a46d9dda6f27/..
    
  • Add a retention policy to the snapshot schedule created for a subvolume group in the non-default group.
    ceph fs snap-schedule retention add / [COUNT_TIME_PERIOD_PAIR] TIME_PERIOD COUNT --fs CEPH_FILE_SYSTEM_NAME --subvol SUBVOLUME_NAME --group NON_DEFAULT_SUBVOLGROUP_NAME
    
    Important: The path ( / ) must be defined and cannot be left empty. There is no dependency on path string value, you can define it with one of the following characters:

    / - /..

    For example,
    [ceph: root@host02 /]# ceph fs snap-schedule retention add / 5h --fs cephfs --subvol sv_sched --group subvolgroup_cg
    Retention added to path /volumes/subvolgroup_cg/sv_sched/e704342a-ff07-4763-bb0b-a54j0dda7f16/..
    

Listing CephFS snapshot schedules

Before you begin

Before listing CephFS snapshots schedules, be sure that you have both read and write capability on the Ceph Manager nodes.

About this task

By listing and adhering to snapshot schedules, you can ensure robust data protection and efficient management.

Before you begin

Before listing CephFS snapshots schedules, be sure that you have both read and write capability on the Ceph Manager nodes.

Procedure

List the snapshot schedules.
ceph fs snap-schedule list SUBVOLUME_PATH [--format=plain|json] [--recursive=true]
The following example lists all schedules in the directory tree.
[ceph: root@host02 /]# ceph fs snap-schedule list /volumes/subgroup0/sub0/4dee0788-32a0-47e6-ac4b-bd8568a6989b/test_dir --recursive=true

/volumes/subgroup0/sub0/4dee0788-32a0-47e6-ac4b-bd8568a6989b/test_dir 1h

Checking status of CephFS snapshot schedules

Before you begin

Before you begin, make sure that you have the following prerequisites in place:
  • Read and write capability on the Ceph Manager nodes.
  • A snapshot schedule.

About this task

You can check the status of snapshot schedules using the command in the procedure for snapshots created in a directory of a subvolume, for a subvolume in the default subvolume group and for a subvolume created in a non-default group.

Before you begin

Before you begin, make sure that you have the following prerequisites in place:
  • Read and write capability on the Ceph Manager nodes.
  • A snapshot schedule.

Procedure

  • Check the status of a snapshot schedule created for a directory in a subvolume:
    ceph fs snap-schedule status SUBVOLUME_DIR_PATH [--format=plain|json]
    The following example displays the status of the snapshot schedule for the /volumes/subvolgroup_1/subvol_1 path in JSON format. If not specified, the default format is plain text.
    /volumes/subgroup0/sub0/4dee0788-32a0-47e6-ac4b-bd8568a6989b/test_dir
    
    {"fs": "cephfs01", "subvol": null, "group": null, "path": "/volumes/subgroup0/sub0/4dee0788-32a0-47e6-ac4b-bd8568a6989b/test_dir", "rel_path": "/volumes/subgroup0/sub0/4dee0788-32a0-47e6-ac4b-bd8568a6989b/test_dir", "schedule": "1h", "retention": {}, "start": "2025-01-09T00:00:00", "created": "2025-01-09T10:00:29", "first": null, "last": null, "last_pruned": null, "created_count": 0, "pruned_count": 0, "active": true}
  • Check the status of the snapshot schedule created for a subvolume in the default group:
    ceph fs snap-schedule status --fs CEPH_FILE_SYSTEM_NAME --subvol SUBVOLUME_NAME
    Important: The path ( / ) must be defined and cannot be left empty. There is no dependency on path string value, you can define it with one of the following characters:

    / - /..

    For example,
    [ceph: root@host02 /]# ceph fs snap-schedule status --fs cephfs --subvol sv_sched 
    {"fs": "cephfs", "subvol": "sv_sched", "group": "subvolgroup_cg", "path": "/volumes/subvolgroup_cg/sv_sched/e704342a-ff07-4763-bb0b-a46d9dda6f27/..", "rel_path": "/volumes/subvolgroup_cg/sv_sched/e704342a-ff07-4763-bb0b-a46d9dda6f27/..", "schedule": "1h", "retention": {"h": 5}, "start": "2024-05-21T00:00:00", "created": "2024-05-21T09:18:58", "first": null, "last": null, "last_pruned": null, "created_count": 0, "pruned_count": 0, "active": true}proc_cephfs_adding-snapshot-schedule-of-a-file-system-subvolumeproc_cephfs_adding-snapshot-schedule-of-a-file-system-subvolumeproc_cephfs_adding-snapshot-schedule-of-a-file-system-subvolume
  • Check the status of the snapshot schedule created for a subvolume in the non-default group:
    ceph fs snap-schedule status --fs CEPH_FILE_SYSTEM_NAME --subvol SUBVOLUME_NAME --group NON_DEFAULT_SUBVOLGROUP_NAME
    
    Important: The path ( / ) must be defined and cannot be left empty. There is no dependency on path string value, you can define it with one of the following characters:

    / - /..

    For example,
    [ceph: root@host02 /]# ceph fs snap-schedule status --fs cephfs --subvol sv_sched --group subvolgroup_cg
    {"fs": "cephfs", "subvol": "sv_sched", "group": "subvolgroup_cg", "path": "/volumes/subvolgroup_cg/sv_sched/e564329a-kj87-4763-gh0y-b56c8sev7t23/..", "rel_path": "/volumes/subvolgroup_cg/sv_sched/e704342a-ff07-4763-bb0b-a46d9dda6f27/..", "schedule": "1h", "retention": {"h": 5}, "start": "2024-05-21T00:00:00", "created": "2024-05-21T09:18:58", "first": null, "last": null, "last_pruned": null, "created_count": 0, "pruned_count": 0, "active": true}