All Products
Search
Document Center

Elastic Compute Service:Overview

Last Updated:Mar 28, 2024

Before you can store data on a new data disk that is attached to an Elastic Compute Service (ECS) instance, you must initialize the disk. The initialization operations include creating partitions for the disk and mounting file systems on the disk. This topic describes the scenarios in which disks need to be initialized and how to initialize a disk. This topic also describes the partition formats and device names of disks.

Scenarios

Only new data disks (empty data disks) can be initialized.

  • System disks

    System disks do not need to be initialized. The system disk of an instance is created together with the instance. The system disk is automatically partitioned, and file systems are automatically mounted to the system disk. You do not need to initialize the disk.

    Note

    If you use a third-party tool to forcefully initialize a system disk, unexpected risks such as system failures and data loss may occur. You can extend or create partitions after you resize the system disk by extending the disk capacity. For more information, see Step 1: Resize a disk to extend its capacity and Extend the partitions and file systems of disks on a Linux instance.

  • Empty data disks

    • If an empty data disk is created together with a Windows instance, you do not need to initialize the disk.

    • If an empty data disk is created together with a Linux instance, follow the instructions that are described in this topic to initialize the disk.

    • If an empty data disk is separately created, attach the disk to a Linux or Windows instance and then follow the instructions that are described in this topic to initialize the disk.

  • Non-empty data disk, such as a data disk created from a snapshot

    • Linux instance:

      1. If the disk is attached to a Linux instance, log on to the instance and run the following command to perform the mount operation:

        mount <Disk partition name> <Mount point>
        • <Disk partition name>: You can log on to the instance to which the source disk of the snapshot is attached and run the df -h command to query the disk partition name.

        • <Partition mount point>: You can specify an existing directory as the mount point or run the mkdir -p <Mount point of the partition> command to create a directory as the mount point. The mount point must start with a forward slash (/) and contain letters or digits. Example: /mnt.

      2. Writes the new partition information to the /etc/fstab file. This way, the partition is automatically mounted on system startup.

        For more information, see Step 4: Configure the disk partition to automatically mount on instance startup.

    • If the disk is attached to a Windows instance, log on to the instance and connect the disk online in the Disk Management window. For more information, see Step 1 to Step 4 in Initialize a data disk up to 2 TiB in size on a Windows instance.

Instructions

Initialize a data disk whose size does not exceed 2 TiB

Operating system

Initialization tool

Partition format

Common file system

References

Windows

Disk Management

  • GUID Partition Table (GPT) (recommended)

  • MBR

NTFS

Initialize a data disk whose size does not exceed 2 TiB on a Windows instance

Linux

  • Partition: Parted

  • File system: e2fsprogs

  • GPT (recommended)

  • MBR

  • ext4

  • xfs

Initialize a data disk whose size does not exceed 2 TiB on a Linux instance

Initialize a data disk whose size exceeds 2 TiB

Operating system

Initialization tool

Partition format

Common file system

References

Windows

Disk Management

GPT

NTFS

Initialize a data disk that is larger than 2 TiB in size on a Windows instance

Linux

  • Partition: Parted

  • File system: e2fsprogs

GPT

  • ext4

  • xfs

Initialize a data disk that is larger than 2 TiB in size on a Linux instance

Initialize a raw data disk

A raw disk is a disk that has not been partitioned or formatted with file systems.

If a disk is presented as an independent partition such as /dev/vdb, you do not need to divide the disk into logical partitions such as /dev/vdb1 and /dev/vdb2. You can create a file system on the disk when you initialize the disk. For more information, see Create a file system on a raw disk. The scenario is suitable for only Linux instances.

Partition formats

Data disks support the MBR and GPT partition formats. The following table describes the differences between the two partition formats.

Partition format

Maximum partition size

Number of partitions

Description

MBR

2 TiB

An MBR disk can have one of the following groups of partitions:

  • Four primary partitions

  • Three primary partitions and one extended partition

    You can create an unlimited number of logical partitions in an extended partition.

MBR partitions are classified into primary partitions, extended partitions, and logical partitions.

GPT

18 EiB (1 EiB = 1,048,576 TiB)

Note

An Alibaba Cloud GPT disk can be up to 32 TiB in size.

  • Linux: unlimited number

  • Windows: 128

All partitions are primary partitions. No extended partitions or logical partitions exist.

Important

An MBR partition can be up to 2 TiB in size. A GPT partition can be up to 18 EiB in size. If the size of your data disk exceeds 2 TiB or if you may need to resize your data disk to a size that exceeds 2 TiB, you must use the GPT partition format.

Device names of data disks on Linux instances

By default, the data disks that are attached to Linux instances are automatically assigned device names based on the following naming conventions:

  • I/O optimized instance:

    • The device names of data disks that are attached by using the Non-Volatile Memory Express (NVMe) protocol are in the /dev/nvmeXn1 format. Examples: /dev/nvme1n1, /dev/nvme2n1, and /dev/nvme3n1. For information about disks that support the NVMe protocol, see NVMe disks.

    • The device names of data disks that are attached not by using protocols other than the NVMe protocol are in the /dev/vd[b-z] format. Examples: /dev/vdb, /dev/vdc, and /dev/vdd.

  • Non-I/O optimized instances: The device names of data disks that are attached to non-I/O optimized Linux instances are in the /dev/xvd[b-z] format. Examples: /dev/xvdb, /dev/xvdc, and /dev/xvdd.