Skip to main content

Configure a FlexVol volume to automatically delete FlexClone files and FlexClone LUNs

Contributors netapp-aherbin netapp-dbagwell netapp-aaron-holt netapp-mwallis

You can configure a volume to automatically start deleting FlexClone files and FlexClone LUNs when the free space in the volume decreases below a particular threshold value, and automatically stop deleting clones when a target amount of free space in the volume is reclaimed. Although, you cannot specify the threshold value that starts the automatic deletion of clones, you can specify whether a clone is eligible for deletion, and you can specify the target amount of free space for a volume.

A volume automatically deletes FlexClone files and FlexClone LUNs when the free space in the volume decreases below a particular threshold and when both of the following requirements are met:

  • The autodelete capability is enabled for the volume that contains the FlexClone files and FlexClone LUNs.

    You can enable the autodelete capability for a FlexVol volume by using the volume snapshot autodelete modify command. You must set the -trigger parameter to volume or snap_reserve for a volume to automatically delete FlexClone files and FlexClone LUNs.

  • The autodelete capability is enabled for the FlexClone files and FlexClone LUNs.

    You can enable autodelete for a FlexClone file or FlexClone LUN by using the file clone create command with the -autodelete parameter. As a result, you can preserve certain FlexClone files and FlexClone LUNs by disabling autodelete for the clones and ensuring that other volume settings do not override the clone setting.

Before you begin
  • The FlexVol volume must contain FlexClone files and FlexClone LUNs, and be online.

  • The FlexVol volume must not be a read-only volume.

Steps
  1. Enable automatic deletion of FlexClone files and FlexClone LUNs in the FlexVol volume by using the volume snapshot autodelete modify command. Learn more about volume snapshot autodelete modify in the ONTAP command reference.

    • For the -trigger parameter, you can specify volume or snap_reserve.

    • For the -destroy-list parameter, you must always specify lun_clone,file_clone regardless of whether you want to delete only one type of clone. The following example shows how you can enable volume vol1 to trigger the automatic deletion of FlexClone files and FlexClone LUNs for space reclamation until 25% of the volume consists of free space:

      cluster1::> volume snapshot autodelete modify -vserver vs1 -volume vol1 -enabled true -commitment disrupt -trigger volume -target-free-space 25 -destroy-list lun_clone,file_clone
      
      Volume modify successful on volume:vol1
      Note

      While enabling FlexVol volumes for automatic deletion, if you set the value of the -commitment parameter to destroy, all the FlexClone files and FlexClone LUNs with the -autodelete parameter set to true might be deleted when the free space in the volume decreases below the specified threshold value. However, FlexClone files and FlexClone LUNs with the -autodelete parameter set to false will not be deleted.

  2. Verify that automatic deletion of FlexClone files and FlexClone LUNs is enabled in the FlexVol volume by using the volume snapshot autodelete show command. Learn more about volume snapshot autodelete show in the ONTAP command reference.

    The following example shows that volume vol1 is enabled for automatic deletion of FlexClone files and FlexClone LUNs:

    cluster1::> volume snapshot autodelete show -vserver vs1 -volume vol1
    
             Vserver Name: vs1
              Volume Name: vol1
              Enabled: true
               Commitment: disrupt
             Defer Delete: user_created
             Delete Order: oldest_first
      Defer Delete Prefix: (not specified)
        Target Free Space: 25%
                  Trigger: volume
         *Destroy List: lun_clone,file_clone*
    Is Constituent Volume: false
  3. Ensure that autodelete is enabled for the FlexClone files and FlexClone LUNs in the volume that you want to delete by performing the following steps:

    1. Enable automatic deletion of a particular FlexClone file or FlexClone LUN by using the volume file clone autodelete command. Learn more about volume file clone autodelete in the ONTAP command reference.

      You can force a specific FlexClone file or FlexClone LUN to be automatically deleted by using the volume file clone autodelete command with the -force parameter.

      The following example shows that automatic deletion of the FlexClone LUN lun1_clone contained in volume vol1 is enabled:

      cluster1::> volume file clone autodelete -vserver vs1 -clone-path /vol/vol1/lun1_clone -enabled true

      You can enable autodelete when you create FlexClone files and FlexClone LUNs.

    2. Verify that the FlexClone file or FlexClone LUN is enabled for automatic deletion by using the volume file clone show-autodelete command. Learn more about volume file clone show-autodelete in the ONTAP command reference.

      The following example shows that the FlexClone LUN lun1_clone is enabled for automatic deletion:

      cluster1::> volume file clone show-autodelete -vserver vs1 -clone-path vol/vol1/lun1_clone
      Vserver Name: vs1
      Clone Path: vol/vol1/lun1_clone
      **Autodelete Enabled: true**

    Learn more about the commands described in this procedure in the ONTAP command reference.