All Products
Search
Document Center

Apsara File Storage NAS:Manage snapshots

Last Updated:Apr 03, 2024

A snapshot is a backup file of an Extreme Apsara File Storage NAS (NAS) file system at a specific point in time. Snapshots are commonly used in scenarios such as daily data backup, data restoration, failover, and data analysis. If you want to restore data from a snapshot of a specified point in time to an existing file system in the same zone or in a different zone, we recommend that you create a file system from the snapshot. Then, you can copy data from the new file system to the existing file system.

Prerequisites

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

Note

Only advanced Extreme NAS file systems support the snapshot feature. The snapshot feature is in public preview and is provided free of charge. Network Attached Storage Service Level Agreement is not guaranteed in public preview.

Usage notes

  • You can manually create a maximum of 128 snapshots for each file system. A maximum of 128 auto snapshots can be 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 input/output operations per second (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

To improve fault tolerance, we recommend that you manually create snapshots.

  • 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. In the top navigation bar, select a region.

  4. On the Snapshot tab, click Manually Create Snapshot.

  5. In the Manually Create Snapshot dialog box, configure the parameters. The following table describes the parameters.

    Parameter

    Description

    File System

    Select the ID of the advanced 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.

    • Permanently retained until the number of snapshots reaches the upper limit: The snapshot that you create is permanently retained. If the number of manually created snapshots exceeds 128, NAS deletes the earliest snapshot.

  6. Click OK.

Create an automatic snapshot policy

You can apply an automatic snapshot policy to an advanced Extreme NAS file system. The system then creates auto snapshots for the advanced Extreme NAS file system at the points in time specified in the policy. This way, data is automatically backed up from the advanced Extreme NAS file system and the security and reliability of your business data is improved.

  • You can apply an automatic snapshot policy to multiple file systems.

  • If the number of auto snapshots created for a file system reaches 128, the file system deletes the earliest snapshot.

  • 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, 10:00, 11:00, and 12:00. The system starts to create a snapshot at 09:00 and does not complete the process until 10:20. 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, but creates a snapshot at 11:00.

  • Auto snapshots are named in the auto_yyyyMMdd_X format.

    • In the preceding format, auto indicates that the snapshot is automatically created.

    • yyyyMMdd indicates the date when the auto snapshot is created. yyyy stands for the year, MM the month, and dd the day of the month.

    • X indicates the ordinal number of the snapshot.

    For example, auto_20140418_1 indicates the first auto snapshot created on April 18, 2014.

  1. Log on to the NAS console.

  2. In the left-side navigation pane, choose Data Service > Snapshot.

  3. In the top navigation bar, select a region.

  4. 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 Automatic Snapshot Policy.

    3. In the Create Automatic Snapshot Policy dialog box, configure the parameters. The following table describes the parameters.

      Parameter

      Description

      Created At

      The hours of the day at which auto snapshots are 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.

      Recurring Date

      The days of the week on which auto snapshots are created. You can select one or more days from Monday to Sunday.

      Retention Period

      The retention period of auto snapshots. The default retention period is 30 days. The following options are available:

      • Custom Duration: Specify the period for which the snapshot is retained. Unit: days. Valid values: 1 to 65536.

      • Permanently retained until the number of snapshots reaches the upper limit: Auto snapshots are permanently retained. If the number of auto snapshots reaches 128, the file system deletes the earliest snapshot.

    4. Click OK.

  5. Apply the automatic snapshot policy.

    1. Find the automatic snapshot policy that you want to apply and click Apply to File Systems in the Actions column.

    2. In the File System ID section of the Apply to File Systems dialog box, select one or more file systems and click the > icon to move the file systems to the Apply to File Systems 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

If you use a snapshot of a specified point in time to create a file system, the data of the new file system is exactly the same as the data of the existing file system. This way, you can quickly replicate file systems and use the file systems in different scenarios. This topic describes how to use SDK for Python to create a file system from a snapshot of a specified point in time.

Important

If you want to restore data from a snapshot of a specified point in time to an existing file system, we recommend that you create a file system from the snapshot and use the new file system as an intermediate node for data transfer. Then, you can copy data from the new file system to the existing file system.

  1. Install NAS SDK for Python.

    pip install aliyun-python-sdk-core
    pip install aliyun-python-sdk-nas
    pip install alibabacloud_credentials 
  2. Customize the code that is provided in NAS SDK for Python and run the code to create a file system.

    Note

    Before you call the operation, you must configure environment variables and obtain access credentials from the environment variables. For more information about how to configure environment variables, see Configure credentials.

    #!/usr/bin/env python3
    import json
    
    from aliyunsdkcore.client import AcsClient
    from alibabacloud_credentials.client import Client
    from aliyunsdknas.request.v20170626.CreateFileSystemRequest import CreateFileSystemRequest
    
    cred = Client() # Use the default credentials to initialize the SDK Credentials client. 
    
    
    def create_file_system():
        # The AccessKey pair of an Alibaba Cloud account has permissions on all API operations. Using these credentials to perform operations is a high-risk operation. We recommend that you use a Resource Access Management (RAM) user to call API operations or perform routine O&M. To create a RAM user, log on to the RAM console.
        # In this example, the AccessKey ID and AccessKey secret are saved in the environment variables. You can also save the AccessKey pair in the configuration file based on your business requirements.
        # To prevent password leaks, we recommend that you do not save your AccessKey ID and AccessKey secret to your code file.
        client = AcsClient(cred.get_access_key_id(), cred.get_access_key_secret(), 'cn-hangzhou')
        request = CreateFileSystemRequest()
        request.set_accept_format('json')
        # Pay-as-you-go
        request.set_ChargeType("PayAsYouGo")
        request.set_StorageType("advance")
        request.set_ProtocolType("NFS")
        request.set_FileSystemType("extreme")
        request.set_Capacity("100")
        request.set_ZoneId("cn-hangzhou-g")
        request.set_SnapshotId("s-extreme-xxxxxxxxxx")
    
        response = client.do_action_with_exception(request)
        res = json.loads(response)
        print(res)
    
    
    if __name__ == "__main__":
        create_file_system()

    The following table describes the parameters. For more information, see CreateFileSystem.

    Parameter

    Description

    StorageType

    The storage class of the file system. Valid value: advance, which indicates that the storage class is advanced.

    For example, you have created a snapshot named B_Snapshot for an advanced Extreme NAS file system. When you create another file system based on B_Snapshot, you must set the StorageType parameter to advance.

    ProtocolType

    The protocol of the file system. Extreme NAS file systems support only NFSv3.

    Capacity

    The storage capacity of the Extreme NAS file system that you want to create. The value of this parameter must be the same as the storage capacity of the file system for which the snapshot is created.

    For example, you have created a snapshot named A_Snapshot for an advanced Extreme NAS file system whose storage capacity is 100 GiB. When you create another file system based on A_Snapshot, you must set the Capacity parameter to 100.

    ZoneId

    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.

    SnapshotId

    The ID of the snapshot.

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 in the Actions column.

  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 snapshots

On the Snapshot tab, view all the created snapshots and the details of each snapshot.

Delete a snapshot

On the Snapshot tab, find the snapshot and click Delete in the Actions column.

Warning

Data cannot be restored once a snapshot is deleted. If you use a deleted snapshot to create a file system, the file system fails to be created.

View automatic snapshot policies

On the Automatic Snapshot Policy tab, view all the created 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 File Systems in the Actions column 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 Edit Policy in the Actions column to modify the policy.

Delete an automatic snapshot policy

On the Automatic Snapshot Policy tab, find the automatic snapshot policy and click Delete in the Actions column to delete the policy.

References

For information about how to roll back a file system to the file system at a specific point in time, see ResetFileSystem.