This document takes cloud disks with a capacity less than 2 TB as an example to provide guidance on disk initialization. For more information, see Initialization Scenarios.
You have mounted a cloud disk to your CVM.
This article uses the Windows Server 2012 R2 operating system as an example. The formatting operation varies by operating system. Below is for reference only.
On the CVM desktop, right click the lower-right icon .
Select Disk Management in the pop-up menu to open the Disk Management window.
If the newly added disk is in offline status (as shown in the figure above), execute Step 4 before Step 5 to perform initialization. Otherwise, you can directly execute Step 5](#initialize).
Disks are listed on the right-side pane. Right click disk 1 area, and select Online to bring it online. The status of disk 1 changes from Offline to Not Initialized.
Right click disk 1 area, and select Initialize Disk in the menu.
In the Initialize Disk dialog box, the disk you need to initialize is displayed. Select MBR or GPT and click OK.
If the disk partition format is changed after the disk is put into use, the original data on the disk will be erased. Please select an appropriate partition format based on actual needs.
Right click the unallocated space of the disk, and select New Simple Volume.
In the pop-up New Simple Volume Wizard dialog box, follow instructions on the interface 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, configure parameters as needed, format the partition, and click Next to complete the partition creation.
Click Complete to complete the wizard. Wait for the system to complete the initialization operation. When the volume status becomes Healthy, disk initialization is successful.
After successfully completing the initialization, enter the Computer interface to view the new disk.
Select the initialization method according to your actual use cases:
fdisk -l
If information similar to what is shown below is returned, the current CVM has two disks, where “/dev/vda” is the system disk and “/dev/vdb” is the newly added data disk.mkfs -t <File system format> /dev/vdb
The partition size supported by different file systems varies. Select an appropriate file system as needed. The following example takes EXT4
as the file system:mkfs -t ext4 /dev/vdb
The formatting takes a while. Please pay attention to the system’s running status and do not exit.
mkdir <mount point>
Take creating a new mount point /data
as an example:mkdir /data
mount /dev/vdb <mount point>
Take creating a new mount point /data
as an example:mount /dev/vdb /data
df -TH
If you do not need to configure automatic disk mounting at startup, skip the following steps.
Mount method | Pros and cons | Information acquisition method |
---|---|---|
Use the soft link of the elastic cloud disk(Recommended) | Pros:The soft link of an elastic cloud disk is fixed and unique. It does not change with operations such as mounting, unmounting, and formatting partitions.Cons:Only an elastic cloud disk can use the soft link, which operates imperceptibly for the partition formatting operation. | Execute the following command to view the soft link of the elastic cloud disk.ls -l /dev/disk/by-id |
Use the UUID of the file system | Automatic mounting configuration may fail due to changes in a file system’s UUID.For example, reformatting a file system will change its UUID. | Execute the following command to view the UUID of the file system.blkid /dev/vdb |
Use device name | Automatic mounting configuration may fail due to changes in device name.For example, if an elastic cloud disk on the CVM is unmounted and then remounted, the device name may change when the operating system recognizes the file system again. | Execute the following command to view the device name.fdisk -l |
/etc/fstab
file to the /home
directory, for example:cp -r /etc/fstab /home
/etc/fstab
file.vi /etc/fstab
<Device information> <Mount point> <File system format> <File system installation option> <File system dump frequency> <File system check sequence at launch>
/dev/disk/by-id/virtio-disk-drkhklpe /data ext4 defaults 0 0
UUID=d489ca1c-5057-4536-81cb-ceb2847f9954 /data ext4 defaults 0 0
/dev/vdb /data ext4 defaults 0 0
mount -a
If the command runs successfully, the file has been written. The newly created file system will automatically mount when the operating system is launched.
This example uses the fdisk partition tool in the CentOS 7.5 operating system to configure data disk
/dev/vdc
as the primary partition. MBR is used as the default partition format, EXT4 format as the file system,/data/newpart
as the mount point, and automatic mounting at startup is configured. The formatting operation varies by operating system. Below is for reference only.
fdisk -l
If information similar to what is shown below is returned, the current CVM has two disks, where /dev/vda
is the system disk and /dev/vdb
is the newly added data disk.fdisk <Newly added data disk>
Take the newly mounted data disk /dev/vdb
as an example:fdisk /dev/vdb
The returned information is similar to what is shown below:n
and press Enter to start creating the new partition.p
and press Enter to start creating a new primary partition.1
and press Enter.p
and press Enter to view information about the newly created partition./dev/vdb1
.If the partitioning operation above has an error, enter
q
to exit the fdisk partition tool, and the prior partition result will not be retained.
w
and press Enter to write the partition result into the partition table.partprobe
mkfs -t <File system format> /dev/vdb1
The partition size supported by different file systems varies. Select an appropriate file system as needed. The following example takes EXT4
as the file system:mkfs -t ext4 /dev/vdb1
The returned information is similar to what is shown below:mkdir <mount point>
Take creating a new mount point /data/newpart
as an example:mkdir /data/newpart
mount /dev/vdb1 <Mount point>
Take creating a new mount point /data/newpart
as an example:mount /dev/vdb1 /data/newpart
df -TH
The returned information is similar to what is shown below:/dev/vdb1
has been mounted to /data/newpart
.If you do not need to configure automatic disk mounting at startup, skip the following steps.
Mount method | Pros and cons | Information acquisition method |
---|---|---|
Use the soft link of the elastic cloud disk(Recommended) | Pros:The soft link of an elastic cloud disk is fixed and unique. It does not change with operations such as mounting, unmounting, and formatting partitions.Cons:Only an elastic cloud disk can use the soft link, which operates imperceptibly for the partition formatting operation. | Execute the following command to view the soft link of the elastic cloud disk.ls -l /dev/disk/by-id |
Use the UUID of the file system | Automatic mounting configuration may fail due to changes in a file system’s UUID.For example, reformatting a file system will change its UUID. | Execute the following command to view the UUID of the file system.blkid /dev/vdb1 |
Use device name | Automatic mounting configuration may fail due to changes in device name.For example, if an elastic cloud disk on the CVM is unmounted and then remounted, the device name may change when the operating system recognizes the file system again. | Execute the following command to view the device name.fdisk -l |
/etc/fstab
file to the /home
directory, for example:cp -r /etc/fstab /home
/etc/fstab
file.vi /etc/fstab
<Device information> <Mount point> <File system format> <File system installation option> <File system dump frequency> <File system check sequence at launch>
/dev/disk/by-id/virtio-disk-drkhklpe-part1 /data/newpart ext4 defaults 0 2
UUID=d489ca1c-5057-4536-81cb-ceb2847f9954 /data/newpart ext4 defaults 0 2
/dev/vdb1 /data/newpart ext4 defaults 0 2
/etc/fstab
file has been written successfully.mount -a
If the command runs successfully, the file has been written. The newly created file system will automatically mount when the operating system is launched.
Was this page helpful?