All Products
Search
Document Center

Apsara File Storage NAS:Create a file system

Last Updated:Mar 29, 2024

To implement file sharing by using file systems, you can create a General-purpose NAS file system or an Extreme NAS file system. Then, you can mount the file system on one or more compute nodes. NAS file systems can be mounted on the compute nodes of the following services: Elastic Compute Service (ECS), Container Service for Kubernetes (ACK), Function Compute, and Platform for AI (PAI). You can also access NAS file systems in on-premises data centers.

Background information

A General-purpose NAS file system and an Extreme NAS file system have different features and are suitable for different scenarios. For more information, see General-purpose NAS file systems and Extreme NAS file systems.

Prerequisites

Apsara File Storage NAS (NAS) is activated. The first time you visit the product page of NAS, follow the instructions to activate the service.

Important

On the product page, you can click Resource Plan to purchase NAS resource plans rather than NAS file systems. NAS resource plans are used only to offset the storage usage fees of NAS file systems. For more information, see Resource plan overview.

Create a General-purpose NAS file system in the NAS console

  1. Log on to the NAS console.

  2. In the lower part of the Overview page, click Create General-purpose NAS File System.

  3. On the General-purpose NAS (Pay-as-you-go) page, configure the parameters. The following table describes the parameters.

    Parameter

    Description

    Region

    Select the region in which you want to create the file system.

    Note
    • We recommend that you select the region where the ECS instance on which you want to mount the file system resides. Otherwise, the ECS instance cannot access the file system. You can use Cloud Enterprise Network (CEN) to mount a file system across regions. However, a cross-region mount degrades the data transfer performance of the file system. For more information, see Use CEN to mount a file system across VPCs in the same region.

    • You can use an Alibaba Cloud account to create up to 20 General-purpose NAS file systems in each region.

    Zone

    Select the zone in which you want to create the file system. Each region has multiple isolated locations known as zones. Each zone has its own independent power supply and networks. If an ECS instance and a file system reside in different zones of the same region, the ECS instance can access the file system.

    We recommend that you select the zone where the ECS instance resides. This reduces the latency that is caused by cross-zone communication between the file system and the ECS instance.

    Storage Class

    Select a storage class for the file system. Valid values:

    • Performance: suitable for latency-sensitive file sharing workloads that require low latency, such as Linux or Windows applications for enterprises, container persistent volumes (PVs), web content management, and genetic computing.

    • Capacity: suitable for cost-sensitive file sharing workloads that require moderate latency, such as database backup, log storage, Windows user directory, and Linux home directory.

    • Premium: suitable for latency-sensitive file sharing workloads that require low latency, such as container data persistence, AI training data storage, manufacturing simulation, and genetic computing.

    For more information about the performance comparison of the Capacity, Performance, and Premium storage classes, see General-purpose NAS file systems.

    Protocol Type

    Select a protocol type for the file system. Valid values: NFS and SMB.

    The Network File System (NFS) protocol is suitable for file sharing among Linux ECS instances. The Server Message Block (SMB) protocol is suitable for file sharing among Windows ECS instances.

    Recycle Bin

    Specify whether to enable the recycle bin feature. Valid values:

    • Enable: enables the recycle bin feature. By default, this feature is enabled after a file system is created.

      After you enable the recycle bin feature, deleted files or directories are temporarily stored in the recycle bin. If you accidentally delete files from a General-purpose NAS file system, you can restore the files and the metadata of the files from the recycle bin. The metadata includes the UID, GID, and ACL. For more information, see Recycle bin.

    • Disable: disables the recycle bin feature.

    Retention Period

    If you set the Recycle Bin parameter to Enable, select the retention period of files or directories from the drop-down list.

    Encryption Type

    Select the type of server-side encryption. Valid values:

    • Not Encrypted: disables server-side encryption.

    • NAS-managed Key: encrypts the data in the file system by using a NAS-managed key.

    • KMS-managed Key: encrypts and decrypts the data in the file system by using a custom key that is managed by Key Management Service (KMS).

    If you set the Encryption Type parameter to NAS-managed Key or KMS-managed Key, the key that is used to encrypt the data in the file system is managed by KMS. When you access the encrypted data, the data is automatically decrypted. For more information, see Server-side encryption.

    Note

    You can use KMS-managed keys only in the following regions:

    • US (Silicon Valley)

    • US (Virginia)

    • UK (London)

    • Australia (Sydney)

    • Germany (Frankfurt)

    • India (Mumbai)

    • Singapore

    Key ID

    If you set the Encryption Type parameter to KMS-managed Key, you must select a customer master key (CMK) ID from the drop-down list.

    Key Alias

    If you set the Encryption Type parameter to KMS-managed Key, you must make sure that the key alias is valid.

    Assign SLR

    If you set the Encryption Type parameter to KMS-managed Key, you must assign the AliyunServiceRoleForNasEncryption service-linked role to NAS. For more information, see Service-linked roles of NAS.

    Data Backup

    Specify whether to enable the data backup feature. Valid values:

    • Disable: disables the data backup feature.

    • Enable: enables the data backup feature. If you enable the data backup feature, you can restore data to any backup point.

    For more information, see Back up an Apsara File Storage NAS file system.

    Service-linked Role

    If you enable the data backup feature, you must assign the AliyunServiceRoleForNasBackup service-linked role to NAS. NAS can assume the service-linked role to access the resources of Cloud Backup. For more information, see Service-linked roles of NAS.

    (Optional) Resource Group

    Select a resource group for the file system. You can use resource groups to manage NAS resources within your Alibaba Cloud account by category and group. You can manage permissions, deploy resources, and monitor resources based on groups without the need to separately process each resource. For more information, see Best practices for designing resource groups.

    • If you do not select a resource group, the file system is automatically classified into the default resource group after the file system is created.

    • To create a resource group, click Create Resource Group. In the Create Resource Group dialog box, configure Resource Group Identifier and Resource Group Name, and then click OK.

    Network Type

    Select the network type of the mount target. In this example, select VPC.

    VPC

    Select the virtual private cloud (VPC) where the ECS instance on which you want to mount the file system resides. If no VPC is available, create a VPC in the VPC console.

    Note

    You must select the VPC where the ECS instance on which you want to mount the file system resides. If you select a VPC that is different from the VPC where the ECS instance resides, you must use CEN to establish a connection between the VPCs. Then, you can mount the file system across the VPCs. For more information, see Use CEN to mount a file system across VPCs in the same region.

    vSwitch

    Select a vSwitch that resides in the VPC.

    Terms of Service

    Select I have read and agree to NAS Limits and I have read and agree to General-purpose NAS (Pay-as-you-go) Agreement of Service.

  4. Click Buy Now to create a file system.

    After a General-purpose NAS file system is created, you are charged for the file system based on the maximum storage usage on an hourly basis. For more information about the pricing of General-purpose NAS file systems, see Apsara File Storage NAS Pricing. You can purchase General-purpose NAS resource plans to offset the storage usage fees. Compared with the pay-as-you-go billing method, a resource plan offers higher discounts. A resource plan does not need to be bound to a file system and can offset the storage usage fees of multiple file systems. For more information, see Purchase resource plans.

    Note

    After a file system is created, the default permission group is attached to the file system. For information about how to modify a permission group, see Manage permission groups.

Create an Extreme NAS file system in the NAS console

  1. Log on to the NAS console.

  2. In the lower part of the Overview page, click Create Extreme NAS File System.

  3. On the Extreme NAS on International Site (Pay-as-you-go) page, configure the parameters. The following table describes the parameters.

    Parameter

    Description

    Region

    Select the region in which you want to create the file system.

    Note
    • We recommend that you select the region where the ECS instance on which you want to mount the file system resides. Otherwise, the ECS instance cannot access the file system. You can use Cloud Enterprise Network (CEN) to mount a file system across regions. However, a cross-region mount degrades the data transfer performance of the file system. For more information, see Use CEN to mount a file system across VPCs in the same region.

    • You can use an Alibaba Cloud account to create up to 200 Extreme NAS file systems in each region.

    • Only Extreme NAS file systems that reside in the Chinese mainland support IPv6. To enable IPv6 in other regions, contact NAS technical support.

    Zone

    Select the zone in which you want to create the file system. Each region has multiple isolated locations known as zones. Each zone has its own independent power supply and networks. If an ECS instance and a file system reside in different zones of the same region, the ECS instance can access the file system.

    We recommend that you select the zone where the ECS instance resides. This reduces the latency that is caused by cross-zone communication between the file system and the ECS instance.

    Storage Class

    Select a storage class for the Extreme NAS file system. Valid values:

    • Standard: suitable for scenarios that require high input/output operations per second (IOPS), intensive metadata operations, low latency, and moderate throughput to process a large number of small files.

    • Advanced: suitable for scenarios that require high IOPS, low latency, and moderate throughput to process a large number of small files. Advanced Extreme NAS file systems implement remote direct memory access (RDMA) networks. Compared with standard Extreme file systems, advanced Extreme NAS file systems provide lower I/O latency and higher write performance.

    Note

    Each zone supports only one storage class of Extreme NAS file systems. We recommend that you deploy your business in a zone that supports advanced Extreme NAS file systems.

    Protocol Type

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

    Purchased Capacity of Extreme NAS File System

    Adjust the slider to specify a capacity for the file system. Valid values: 100 GiB to 256 TiB.

    Encryption Type

    Select the type of server-side encryption. Valid values:

    • Not Encrypted: disables server-side encryption.

    • NAS-managed Key: encrypts the data in the file system by using a NAS-managed key.

    • KMS-managed Key: encrypts and decrypts the data in the file system by using a custom key that is managed by KMS.

    If you select NAS-managed Key or KMS-managed Key, the key that is used to encrypt the data in the file system is managed by KMS. When you access the encrypted data, the data is automatically decrypted. For more information, see Server-side encryption.

    Key ID

    If you set the Encryption Type parameter to KMS-managed Key, you must select a CMK ID from the drop-down list.

    (Optional) Resource Group

    Select a resource group for the file system. You can use resource groups to manage NAS resources within your Alibaba Cloud account by category and group. You can manage permissions, deploy resources, and monitor resources based on groups without the need to separately process each resource. For more information, see Best practices for designing resource groups.

    • If you do not select a resource group, the file system is automatically classified into the default resource group after the file system is created.

    • To create a resource group, click Create Resource Group. In the Create Resource Group dialog box, configure Resource Group Identifier and Resource Group Name, and then click OK.

    Terms of Service

    Select I have read and agree to Extreme NAS (Pay-as-you-go) Agreement of Service.

  4. Click Buy Now to create a file system.

    After an Extreme NAS file system is created, you are charged based on the maximum capacity purchased for the file system on an hourly basis. For more information about the pricing of Extreme NAS file systems, see Apsara File Storage NAS Pricing. You can purchase Extreme NAS resource plans to offset the capacity fees. Compared with the pay-as-you-go billing method, a resource plan offers higher discounts. A resource plan does not need to be bound to a file system and can offset the storage usage fees of multiple file systems. For more information, see Purchase resource plans.

    Note

    The unit price displayed on the buy page of an Extreme NAS file system is the hourly fee of the file system. If you have purchased an Extreme NAS resource plan, the fee of the file system is automatically offset by using the resource plan.

Create an advanced Extreme NAS file system based on a snapshot

Note

Only advanced Extreme NAS file systems support the snapshot feature.

You can call a NAS API operation to create an advanced Extreme NAS file system based on a snapshot.

  1. Install NAS SDK for Python.

    pip install aliyun-python-sdk-core
    pip install aliyun-python-sdk-nas
    pip install alibabacloud_credentials
  2. Create a file system.

    Note

    Before you call an 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 (an AccessKey ID and an AccessKey secret) of an Alibaba Cloud account has permissions on all API operations. Using these credentials to perform operations can cause security risks. 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 in 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.

What to do next

After the file system is created, you must mount the file system on compute nodes to enable shared access. Before you mount a file system, read the usage notes. You must mount the file system based on your business scenario. For more information, see Usage notes.