You can separately create a pay-as-you-go disk and attach the disk to an Elastic Compute Service (ECS) instance as a data disk.

Prerequisites

  • The disk resides within the same zone as the instance to which you want to attach the disk.
  • The instance is in the Running (Running) or Stopped (Stopped) state, instead of the Locked (Locked) state.
  • The disk is in the Unattached (Available) state.
  • You have no overdue payments within your Alibaba Cloud account.
  • The Cloud Assistant client is installed on the instance, so that you can partition the disk in the ECS console after the disk is attached. For more information, see Install the Cloud Assistant client.

Precautions

Before you attach a disk, take note of the following items:
  • Disks that are created along with instances and subscription data disks that are created for subscription instances are automatically attached to the corresponding instances.
  • A maximum of 64 data disks can be attached to an ECS instance. The maximum number of disks that can be attached to an instance varies with instance types. For more information, see Instance family.
    Note You can attach one system disk and a maximum of 16 data disks to an instance when you create the instance. If the instance requires more data disks, attach more data disks after the instance is created.
  • Disks that do not support the multi-attach feature or disks for which the multi-attach feature is disabled can be attached only to a single instance at the same time. Disks that support the multi-attach feature can be attached to multiple instances at the same time. For more information, see NVMe disks.
Note The attach operation refers to the process of attaching disks to ECS instances in the ECS console, instead of mounting file systems in the operating systems of ECS instances by running the mount command. For information about how to format data disks and mount file systems, see Partition and format a data disk on a Linux instance and Partition and format a data disk on a Windows instance.

Attach a data disk

This section describes how to attach a data disk on the Instances page. Alternatively, you can choose Storage & Snapshots > Disks in left-side navigation pane of the ECS console. Find the disk that you want to attach. In the Actions column, choose More > Attach to attach the disk to an ECS instance.

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Instances.
  3. In the top navigation bar, select a region.
  4. Find the instance to which you want to attach the disk and click the ID of the instance.
  5. Click the Cloud Disk tab. In the upper-left corner of the Cloud Disk tab, click Attach Disk.
  6. In the Attach Disk dialog box, configure parameters to attach a disk.
    Attach
    1. Select the disk that you want to attach and configure the release settings for the disk.
      Parameter Description
      Disk Select the disk that you want to attach.
      Release Disk with Instance If you select this option, the disk is automatically released when its associated instance is released. If you do not select this option, the disk is retained when its associated instance is released.
      Note If the disk that you want to attach is a system disk that was detached from another instance, the instance specified by Release Disk with Instance refers to the instance from which the disk was detached, not the current instance.
      Delete Automatic Snapshots While Releasing Disk If you select this option, automatic snapshots of the disk are released when the disk is released. We recommend that you do not select this option and instead retain the automatic snapshots of the disk.
    2. Click Next.
    • If the disk cannot be partitioned in the ECS console, a message indicating that the disk is attached appears, and the disk enters the In Use state.
    • If the disk can be partitioned in the ECS console, proceed to create partitions and file systems on the disk.
      The following limits apply to disks that can be partitioned in the ECS console:
      • The disks must be new empty disks that were not attached to ECS instances when the disks were created. Disks that are created from snapshots or that support the multi-attach feature cannot be partitioned in the ECS console.
      • Instances to which the disks are attached must be Linux instances. Disks attached to Windows instances cannot be partitioned in the ECS console.
      • Only GUID Partition Table (GPT) partitions can be created and only ext4 file systems can be mounted on the disks.
  7. Create partitions and file systems before you can use the disk.
    Note A disk that is attached to an instance is unusable if the disk has no partition or file system. For example, you cannot view the mount information of the disk attached to a Linux instance by running the df -h command. Perform the following operations based on the operating system type of the instance to make the disk usable on the instance.
    You can use one of the following methods to create partitions and file systems on a disk:
    • Partition the disk in the ECS consolePartition the disk in the ECS console
      1. In the Attach Disk dialog box, specify the partition size and set the type and mount point of the file system. Only ext4 file systems are supported.
        • The size of a single partition and the total size of partitions cannot exceed the disk size.
          Note 1 or 2 MB of storage space must be reserved for the partition table and sector alignment for partitions. The partitioning feature reduces the size of the last partition to reserve the required space. The actual partitioned size may be slightly smaller than the specified partition size. The total size of partitions may also be smaller than the disk size.
        • The mount point must start with a forward slash (/) and contain letters or digits. Example: /mnt. Mount points must be unique.

        You can click Create Partition to create multiple partitions on the disk as needed. Up to five partitions can be created on a single disk.

      2. Select This feature is implemented by Cloud Assistant. To use this feature to partition the disk and mount file systems, select this checkbox..
      3. Click OK.
        Note If you click Cancel, you can only use other methods to partition the disk.

        If the partitions are created and file systems are mounted on the disk, the disk enters the File System Mounted state.

    • Use other methods to partition the disk. The following table describes the methods.
      Disk status Operating system of the instance Subsequent operations
      New empty disk Linux
      Windows Server
      Disk created from a snapshot Linux Log on to the instance and run the following command to mount the disk partitions that have file systems available:
      mount <Data disk partition> <Mount point>
      Notice If you want to attach a new disk to the ECS instance to which the disk from which the snapshot was created was attached, you must change the UUID of the new disk before you can attach it to the ECS instance. For more information, see Modify the UUID of a disk.
      Windows Server N/A