Overview
This document describes how to initialize a cloud disk newly attached to a CVM, create a file system, and write a file named qcloud.txt
.
Note:
For more information on initializing cloud disks, see Initialization Scenarios.
Notes
To prevent data loss, please see Usage FAQs before operating on your CBS cloud disks.
Prerequisites
Directions
This document uses a CVM with Windows Server 2012 R2 DataCenter 64-bit Chinese installed as an example. Note that the steps may vary according to the operating system version.
- Log in to the Windows CVM instance as the admin user. See Logging in to Windows Instance Using RDP (Recommended).
- On the desktop, right click
in the lower-left corner. - Select Disk Management in the pop-up menu to open the Disk Management window.
- (Optional) Right click the empty disk you need, and select Online.
When the disk status changes to Not Initialized, it has gone online. - (Optional) Right click the cloud disk that has just gone online. Select Initialize Disk and then Master Boot Record in the Initialize Disk pop-up window, and click OK.
- Master Boot Record (MBR) partition format supports a maximum disk capacity of 2 TB, and GUID Partition Table (GPT) supports a maximum disk capacity of 18 EB. If you need a disk capacity larger than 2 TB, please select the GPT partition format.
- 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 the partition format carefully when initializing the disk.
Right click the disk you need, select New Simple Volume, and click Next in the pop-up window.
Enter the simple volume size, and click Next.
Select a drive letter or drive path, and click Next. In this example, E is assigned as the driver letter.
Select the file system, perform a quick format, and then click Next.
Click Finish.
The disk status goes to Formatting. Wait for the completion of initialization. When the volume status becomes Healthy, the disk initialization is successful. You can then view the newly formatted data disk in the PC interface.
Enter the newly formatted data disk, create a file named qcloud.txt
, enter the content you need, and select File > Save.
- This document uses a CVM with CentOS 7.8 installed as an example. Note that the steps may vary according to the operating system version.
- EXT4 file system is used in this example.
- When Linux CVM restarts or starts up, data disks will not be automatically attached. You can refer to Step 9 - Step 14 to configure disk automount at startup.
- Log in to the Linux CVM instance as the root user. See Logging in to Linux Instance Using Standard Login Method.
- Run the following command to view the names of data disks attached to the instance.
fdisk -l
If the returned result is as shown in the following figure, the current CVM has two disks, where /dev/vda
is the system disk and /dev/vdb
is the newly added data disk.
In this example, the disk attached to the instance is named /dev/vdb
:

- Run the following command to format the disk.
mkfs.ext4 /dev/vdb
- Run the following command to mount this disk to the
/data
mount point.
mount /dev/vdb /data
- Run the following commands to enter the disk and create a new file
qcloud.txt
.
cd /data
vi qcloud.txt
- Press i to enter the edit mode and enter This is my first test.
- Press Esc to exit the edit mode, enter :wq, and press Enter to save and exit the file.
- Run the
ls
command, and you can see that the qcloud.txt
file has been written to the disk.
Refer to Step 9 - Step 14 to configure disk automount at startup. If you do not need disk automount at startup, skip the following steps. - Run the following command to back up the
/etc/fstab
file to the /home
directory, for example:
cp -r /etc/fstab /home
- Run the following command to use VI editor to open the
/etc/fstab
file.
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> <File system installation option> <File system dump frequency>
<File system check sequence at startup>
Take automatic mounting using the soft link of an elastic cloud disk as an example. Add the following content:
/dev/disk/by-id/virtio-disk-drkhklpe /data ext4 defaults 0 0
You can run the ls -l /dev/disk/by-id
command to obtain the soft link of the elastic cloud disk. - Press Esc, enter
:wq
, and press Enter.
Save the configuration and exit the editor. - Run the following command to check whether the
/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 be mounted automatically when the operating system starts up.
Subsequent Operations
A cloud disk is an expandable storage device on cloud. You can expand its capacity to fit your business at any time without losing any data in it. For detailed directions, see Step 4. Expanding Cloud Disk Capacity.
Was this page helpful?