Scenarios
This document describes how to initialize a cloud disk with a capacity greater than or equal to 2 TB.
For more cases, see Initialization Scenarios.
MBR supports a maximum disk capacity of 2 TB. Therefore, when partitioning a disk with a capacity greater than 2 TB, use GPT as the partition format. For the Linux operating system, when GPT is selected as the partition format, the fdisk partitioning tool cannot be used, and you need to use the parted tool.
Prerequisites
Note:
- Formatting a data disk will erase all data. Make sure that the disk does not contain data or that important data has been backed up.
- To prevent service exceptions, ensure that the Cloud Virtual Machine (CVM) has stopped providing external services before formatting.
The cloud disk has been attached to a CVM.
Operation Steps
Initializing Cloud Disks (Windows)
Note:
This document uses a CVM instance with Windows Server 2012 installed as an example. Note that the steps may vary by operating system version. This document is for reference only.
Log in to the Windows CVM instance.
Click
on the desktop. Go to the server manager page.In the left sidebar, click File and Storage Services.
In the left sidebar, select Volume > Disk.
Note:
If the newly added disk is offline (as shown in the above figure), perform Step 5 to connect it, and then perform Step 6 for initialization. Otherwise, directly perform Step 6 for initialization.
The disk list appears in the right pane. Right-click the line where 1 is located, and select Online in the menu list to connect. After online, 1 changes from Offline status to Online.
Right-click the line where 1 is located and select Initialize in the menu list.
Click Yes as prompted.
After initialization, 1 changes from Unknown partition to GPT. Right-click the line where 1 is located and select New Simple Volume in the menu list.
The New Volume Wizard dialog box pops up. Click Next as prompted on the page.
Select the server and disk, and click Next.
Specify the volume size as needed, which is the maximum value by default. Click Next.
Assign a drive letter and click Next.
Select Format this volume with the following settings, set parameters according to the actual situation, format the new partition, and click Next to complete the partition creation.
After the information is confirmed, click Create.
Wait for the completion of the volume creation and click Finish.
Upon successful initialization, you can enter the This PC interface to view the new disk.
Initializing Cloud Disks (Linux)
Select the initialization method according to your actual use cases:
- If the entire hard disk is presented as a single independent partition (that is, there are no multiple logical disks like vdb1 and vdb2), it is highly recommended that you do not partition it and directly build a file system on the raw device.
- If the entire hard disk needs to be presented as multiple logical partitions (that is, there are multiple logical disks), you need to partition it first, and then build a file system on the partitions.
Creating File Systems on Bare Devices
Log in to the Linux CVM.
Execute the following command as root user to check the disk name.
fdisk -lIf information similar to what is shown below is returned, the current CVM has two disks, in which /dev/vda is the system disk and /dev/vdb is the newly added data disk.

Execute the following command to create a file system on the /dev/vdb bare device.
mkfs -t <File system format> /dev/vdbThe partition size supported by different file systems varies. Select an appropriate file system as needed. Take setting the file system to
EXT4as an example:mkfs -t ext4 /dev/vdb
Note:
Formatting takes some time. Observe the system's running status and do not exit.
Execute the following command to create a new mount point.
mkdir <Mount point>Take creating a new mount point
/dataas an example:mkdir /dataExecute the following command to mount the new partition to the newly created mount point.
mount /dev/vdb <Mount point>Take creating a new mount point
/dataas an example:mount /dev/vdb /dataExecute the following command to check the mounting result.
df -TH
Note:
If there is no need to set automatic disk mounting at startup, you can skip the subsequent steps.
- Confirm the mounting mode and obtain corresponding information.
You can use the soft link of elastic cloud disks, the UUID (universally unique identifier) of the file system, or the device name to mount the disk automatically according to business requirements. The relevant instructions and ways of obtaining information are as follows:
| Mounting Mode | Advantages and Disadvantages | Ways to Obtain Information |
|---|---|---|
| Using a soft link from an elastic cloud disks (recommended) | Advantages: The soft link of each elastic cloud disk is fixed and unique, remaining unchanged even during operations such as unmounting and remounting, or formatting partitions. Disadvantages: Only elastic cloud disks has soft link. Elastic cloud disks do not recognize or detect partition formatting operations. |
Execute the following command to check the soft link of elastic cloud disks.ls -l /dev/disk/by-id |
| Using the UUID of the File System | Automatic mount settings may be invalidated due to file system UUID changes. For example, the UUID of a file system will change after it is reformatted. |
Execute the following command to check the UUID of the file system.blkid /dev/vdb |
| Using the Name of Devices | The automatic mount setting may be invalidated due to the change of device name. For example, when the elastic cloud disks on the CVM are unmounted and remounted during data migration, the name may change when the operating system recognizes the file system again. |
Execute the following command to check the device name.fdisk -l |
Execute the following command to back up the
/etc/fstabfile. Take backup to the /home directory as an example:cp -r /etc/fstab /homeExecute the following command to open the
/etc/fstabfile with the VI editor.vi /etc/fstabPress i to enter the edit mode.
Move the cursor to the end of the file, press Enter and add the following content.
<Device information> <Mount point> <File system format> <Installation options of file system> <File system dump frequency> <File system check sequence at startup>
- (Recommended) Take automatic mounting by the soft link from elastic cloud disks as an example. Based on the previous examples, the following is added:
/dev/disk/by-id/virtio-disk-drkhklpe /data ext4 defaults 0 0
- Take automatic mounting by the disk partition's UUID as an example. Based on the previous examples, the following is added:
UUID=d489ca1c-5057-4536-81cb-ceb2847f9954 /data ext4 defaults 0 0
- Take automatic mounting using the name of devices as an example. Based on the previous examples, the following is added:
/dev/vdb /data ext4 defaults 0 0
- Press Esc, enter :wq, and press Enter.
Save the settings and exit the editor. - Execute the following command to check whether the
/etc/fstabfile is written successfully.
mount -a
If the operation succeeds, it means that the file is written successfully, and the newly created file system will be automatically mounted when the operating system starts.
Creating a File System on the Partition
Note:
This document uses the parted partition tool in the CentOS 7.5 operating system to configure the
/dev/vdcdata disk as the primary partition. GPT is used as the default partition format, EXT4 format as the file system, and/data/newpart2as the mount point. Disk automount at startup is configured. Note that the formatting operation may vary according to the operating system.
Log in to the Linux CVM.
Execute the following command as root user to check the disk name.
lsblkThe output is similar to the following figure, indicating that the current CVM has two disks. /dev/vda is the system disk, and /dev/vdc is the newly added data disk.

Execute the following command to enter the parted tool and start partitioning the new data disk.
parted <Create data disk>Take the newly mounted data disk
/dev/vdcas an example:parted /dev/vdcThe output is similar to the following figure:

Enter
pand press Enter to check the current disk partition form.
The output is similar to the following figure:
Partition Table: unknown indicates that the disk partition form is unknown.Execute the following command to configure the disk partition form.
mklabel <Disk partitioning method>When the disk capacity is greater than or equal to 2 TB, only GPT partitioning can be used:
mklabel gptEnter
pand press Enter to check whether the disk partition is set successfully.
The output is similar to the following figure:
Partition Table: gpt indicates that the disk partition is GPT.Enter
unit sand press Enter to set the measurement unit of the disk as the cylinder.Taking the creation of a partition for an entire disk as an example, enter
mkpart opt 2048s 100%and press Enter.
2048s indicates the initial capacity of the disk, and 100% indicates the ending capacity of the disk. It is for reference only. You can plan the number and capacity of disk partitions according to business needs.Enter
pand press Enter to check the details of the new partition.
The output is similar to the following figure:
It indicates the details of the new partition/dev/vdc1.Enter
qand press Enter to exit the parted tool.Execute the following command to check the disk name.
lsblk
The output is similar to that shown in the following figure. At this time, you can see the new partition /dev/vdc1.

- Execute the following command to set the file system of the new partition in the format required by the system.
mkfs -t <File system format> /dev/vdc1
The partition size supported by different file systems varies. Select an appropriate file system as needed. Take setting the file system as EXT4 as an example:
mkfs -t ext4 /dev/vdc1
The output is similar to the following figure:

Formatting takes some time. Observe the system's running status and do not exit.
- Execute the following command to create a new mount point.
mkdir <Mount point>
Take the new mount point `/data/newpart2` as an example:
mkdir /data/newpart2
- Execute the following command to mount the new partition to the newly created mount point.
mount /dev/vdc1 <Mount point>
Take the new mount point `/data/newpart2` as an example:
mount /dev/vdc1 /data/newpart2
- Execute the following command to check the mounting result.
df -TH
The output is similar to the following figure:

It indicates that the new partition /dev/vdc1 has been mounted to /data/newpart2.
Note:
If there is no need to set automatic disk mounting at startup, you can skip the subsequent steps.
- Confirm the mounting mode and obtain corresponding information.
You can use the soft link of elastic cloud disks, the UUID (universally unique identifier) of the file system, or the device name to mount the disk automatically according to business requirements. The relevant instructions and ways of obtaining information are as follows:
| Mounting Mode | Advantages and Disadvantages | Ways to Obtain Information |
|---|---|---|
| Using a soft link from an elastic cloud disks (recommended) | Advantages: The soft link of each elastic cloud disk is fixed and unique, remaining unchanged even during operations such as unmounting and remounting, or formatting partitions. Disadvantages: Only elastic cloud disks has soft link. Elastic cloud disks do not recognize or detect partition formatting operations. |
Execute the following command to check the soft link of elastic cloud disks.ls -l /dev/disk/by-id |
| Using the UUID of the File System | Automatic mount settings may be invalidated due to file system UUID changes. For example, the UUID of a file system will change after it is reformatted. |
Execute the following command to check the UUID of the file system.blkid /dev/vdc1 |
| Using the Name of Devices | The automatic mount setting may be invalidated due to the change of device name. For example, when the elastic cloud disks on the CVM are unmounted and remounted during data migration, the name may change when the operating system recognizes the file system again. |
Execute the following command to check the device name.fdisk -l |
- Execute the following command to back up the
/etc/fstabfile. Take backup to the /home directory as an example:
cp -r /etc/fstab /home
- Execute the following command to open the
/etc/fstabfile with the VI editor.
vi /etc/fstab
- Press i to enter the edit mode.
- Move the cursor to the end of the file, press Enter and add the following content.
<Device information> <Mount point> <File system format> <Installation options of file system> <File system dump frequency> <File system check sequence at startup>
- (Recommended) Take automatic mounting by the soft link from elastic cloud disks as an example. Based on the previous examples, the following is added:
/dev/disk/by-id/virtio-disk-bm42ztpm-part1 /data/newpart2 ext4 defaults 0 2
- Take automatic mounting by the disk partition's UUID as an example. Based on the previous examples, the following is added:
UUID=fc3f42cc-2093-49c7-b4fd-c616ba6165f4 /data/newpart2 ext4 defaults 0 2
- Take automatic mounting using the name of devices as an example. Based on the previous examples, the following is added:
/dev/vdc1 /data/newpart2 ext4 defaults 0 2
Press Esc, enter :wq, and press Enter.
Save the settings and exit the editor.Execute the following command to check whether the
/etc/fstabfile is written successfully.
mount -a
If the operation succeeds, it means that the file is written successfully, and the newly created file system will be automatically mounted when the operating system starts.
on the desktop. Go to the server manager page.




