All Products
Search
Document Center

Apsara File Storage NAS:Manage snapshots

Last Updated:Jun 15, 2023

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. Then, you can copy the data from the created file system to the existing file system. In addition, you can use snapshots to restore data across zones.

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 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 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 page, 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, the file system 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. Auto snapshots are then created for the advanced Extreme NAS file system at the specified points in time. This way, data is automatically backed up from the advanced 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 auto snapshots 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.

  • Auto snapshots are named in the auto_yyyyMMdd_X format.

    For example, auto_20140418_1 indicates the name of the first auto snapshot that was 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 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.

  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

You can also use an SDK to create an advanced Extreme NAS 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, 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-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 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 type of the file system. Valid value: advance, which indicates that the storage type 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 type 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 snapshot ID.

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 the list of 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 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 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.