Extreme NAS file systems support the snapshot feature. You can use this feature to restore data across zones. Before you perform high-risk operations, you can create snapshots to back up data. If your data is lost, you can restore some or all of the data in a file system from a snapshot to a specified point in time. If a file system in a zone is unavailable, you can restore the data in the file system from a snapshot of the file system to another zone. This way, you can ensure service continuity. This topic describes how to manage snapshots for a file system in the Apsara File Storage NAS console. You can create snapshots, create snapshot policies, and apply snapshot policies.

Prerequisites

The file system is in the Running state. Otherwise, you cannot create snapshots for the file system.

Usage notes

  • You can manually create a maximum of 128 snapshots for each file system. A maximum of 128 snapshots can be automatically created for each file system.
  • If a snapshot is being created for a file system, you cannot create another snapshot for the file system.
  • If a file system expires when a snapshot is being created for the file system, the file system is released and the snapshot is deleted.
  • When a snapshot is being created for a file system, the performance of the file system may be slightly compromised and the IOPS may be temporarily degraded. We recommend that you do not create snapshots during peak hours.
  • A snapshot is a backup of a file system at a specific point in time. When you create a snapshot for a file system, incremental data of the file system is not synchronized to the snapshot.

Manually create a snapshot

Before you perform a high-risk operation, we recommend that you create a snapshot to ensure data security.
  • Manually created snapshots are permanently retained in a file system. We recommend that you delete the snapshots that you no longer need on a regular basis to reduce costs.
  • Manually created snapshots are permanently retained only if your account has sufficient balance. If you can no longer use NAS for 15 days due to overdue payments, the snapshots that you manually created are deleted.
  1. Log on to the NAS console.
  2. In the left-side navigation pane, choose Data Service > Snapshot.
  3. On the Snapshot page, click Manually Create a Snapshot.
  4. In the Manually Create Snapshot dialog box, set the parameters. The following table describes the parameters.
    Parameter Description
    File System Select the ID of the Extreme NAS file system for which you want to create a snapshot.
    Retention Period Select a retention period based on your business requirements.
    • Custom duration: Specify the period for which the snapshot is retained. Unit: days. Valid values: 1 to 65536.
    • It is permanently retained until the number of snapshots reaches the maximum limit and is automatically deleted.

      The snapshot that you create is permanently retained. If the number of manually created snapshots exceeds 128, the file system deletes the earliest snapshot.

  5. Click OK.

Create an automatic snapshot policy

You can apply an automatic snapshot policy to an Extreme NAS file system. Snapshots are then automatically created for the Extreme NAS file system at the specified points in time. This way, data is automatically backed up from the Extreme NAS file system and the security of your business data is improved.
  • You can apply an automatic snapshot policy to multiple file systems.
  • If the number of snapshots that are automatically created for a file system reaches 128, the file system deletes the earliest snapshot. Manually created snapshots are not affected.
  • If you modify the retention period in an automatic snapshot policy, the new retention period applies only to new snapshots. The original retention period still applies to the existing snapshots.
  • If a snapshot is being created when the scheduled time for a new snapshot arrives, the creation of the new snapshot is skipped. This occurs if the file system stores a large volume of data.

    For example, you have scheduled snapshots to be automatically created at 09:00:00, 10:00:00, 11:00:00, and 12:00:00. The system starts to create a snapshot at 09:00:00 and does not complete the process until 10:20:00. The process takes 80 minutes because the file system has a large volume of data. In this case, the system does not create a snapshot at 10:00:00, but creates a snapshot at 11:00:00.

  • Snapshots that are automatically created are named in the auto_yyyyMMdd_X format.

    For example, auto_20140418_1 indicates the name of the first snapshot that was automatically created on April 18, 2014. In the preceding format, auto indicates that the snapshot is automatically created rather than manually created. yyyyMMdd indicates the date when a snapshot is automatically created. yyyy stands for the year, MM the month, and dd the day of the month. X indicates the ordinal number of the snapshot.

  1. Log on to the NAS console.
  2. In the left-side navigation pane, choose Data Service > Snapshot.
  3. Create an automatic snapshot policy.
    1. On the Snapshot page, click the Automatic Snapshot Policy tab.
    2. On the Automatic Snapshot Policy tab, click Create an Automatic Snapshot Policy.
    3. In the Create Automatic Snapshot Policy dialog box, set the following parameters.
      Parameter Description
      Created At The hours of the day at which snapshots are automatically created. You can select one or more hours from 00:00 to 23:00.
      Note When snapshots are being created for a file system, the IOPS of the file system is temporarily degraded. We recommend that you set off-peak hours to create snapshots.
      Repeat Date The days of the week on which snapshots are automatically created. You can select one or more days from Monday to Sunday.
      Retention Period The retention period of automatically created snapshots. The default retention period is 30 days. The following options are available:
      • Custom duration: Specify the period for which the snapshots are retained. Unit: days. Valid values: 1 to 65536.
      • It is permanently retained until the number of snapshots reaches the maximum limit and is automatically deleted.

        Automatically created snapshots are permanently retained. If the number of automatically created snapshots reaches 128, the file system deletes the earliest snapshot.

    4. Click OK.
  4. Apply the automatic snapshot policy.
    1. Find the automatic snapshot policy that you want to apply and click Apply to The File System.
    2. In the File System ID section of the Apply to The File System dialog box, select the file system and click the > icon to add the file system to the Apply to The File System section.
    3. Click OK.
      After you apply an automatic snapshot policy to a file system, NAS automatically creates snapshots for the file system based on the policy.

Use a snapshot to create a file system

You can also use an SDK to create a file system from a snapshot of a specified point in time.
Notice If you want to restore data from a snapshot of a specified point in time to an existing file system, you can create a file system from the snapshot. Then, you can copy the data from the created file system to the existing file system.
  1. Install NAS SDK for Python.
    pip install aliyun-python-sdk-core
    pip install aliyun-python-sdk-bssopenapi
    pip install aliyun-python-sdk-nas
  2. Customize the code that is provided in NAS SDK for Python and run the code to create a file system.
    The following table describes the required parameters. For more information, see CreateFileSystem.
    Note The sample code creates a pay-as-you-go file system. If you want to create a subscription file system, you must customize the sample code.

    accessKeyId and accessSecret: Specify the AccessKey ID and AccessKey secret of your Alibaba Cloud account. For more information, see How can I obtain an AccessKey pair?.

    Parameter Description
    Region The region to which the snapshot belongs. For example, you can specify cn-hangzhou. You can call the DescribeRegions operation to query all available regions.
    Zone The zone in the region to which the snapshot belongs. For example, you can specify cn-hangzhou-g. You can call the DescribeZones operation to query all available zones.
    ProtocolType The protocols that the file system supports. Extreme NAS file systems support only NFS.
    StorageType The storage type of the file system. Valid values:
    • standard: standard
    • advance: advanced
    Capacity The Extreme NAS file system must have the same storage capacity as the file system for which snapshots are created.
    SnapshotId The ID of the snapshot.
    import json
    from aliyunsdkcore.client import AcsClient
    from aliyunsdknas.request.v20170626.CreateFileSystemRequest import CreateFileSystemRequest
    from aliyunsdknas.request.v20170626.ResetFileSystemRequest import ResetFileSystemRequest
    
    client = AcsClient('<accessKeyId>', '<accessSecret>', '<Region>')
    # Use a snapshot to create a file system.
    def create_file_system():
        request = CreateFileSystemRequest()
        request.set_StorageType("advance")
        request.set_ProtocolType("NFS")
        # Pay-as-you-go
        request.set_ChargeType("PayAsYouGo")
        # Subscription
        request.set_ChargeType("Subscription")
        # The subscription cycle. Unit: months.
        request.set_Duration(1)
        request.set_FileSystemType("extreme") 
        request.set_Capacity("100")
        request.set_SnapshotId("s-extreme-03260551blg9****")
        request.set_ZoneId("cn-shanghai-f")
        request.set_accept_format('json')
        try:
            response = client.do_action_with_exception(request)
            rsp = json.loads(response)
            print(rsp)
        except Exception as e:
            print(e)
    
    if __name__ == '__main__':
        create_file_system()

Related operations

Operation Description
Cancel an automatic snapshot policy To cancel an automatic snapshot policy, perform the following steps:
  1. On the File System List page, find the file system, and choose More > Snapshot > Set Snapshot Policy.
  2. In the Set Snapshot Policy dialog box, turn off Apply Policy and click Cancel to cancel the policy that is applied to the file system.
View a snapshot On the Snapshot tab, view the list of snapshots and the details of each snapshot.
Delete a snapshot On the Snapshot tab, find the snapshot and click Delete.
View automatic snapshot policies On the Automatic Snapshot Policy tab, view the list of automatic snapshot policies and the details of each policy.
View the file systems to which an automatic snapshot policy is applied On the Automatic Snapshot Policy tab, find the automatic snapshot policy and click Apply to The File System to view the file systems to which the policy is applied.
Modify an automatic snapshot policy On the Automatic Snapshot Policy tab, find the automatic snapshot policy and click Modify Policy.
Delete an automatic snapshot policy On the Automatic Snapshot Policy tab, find the automatic snapshot policy and click Delete.