This document takes initializing a cloud disk newly mounted to a CVM, creating a file system, and writing a file named
qcloud.txt as an example to help you understand how to use CBS. For more information on initializing cloud disks, see Initialization Scenarios.
You have mounted the cloud disk, and the cloud disk status is Mounted.
The following Windows and Linux CVM OS systems are used:
- Windows Server 2008
- CentOS 7.5
To protect important data, please see Usage FAQs before performing any operation on your CBS cloud disks.
Formatting, creating a file system, and writing a file (Windows)
- Log in to the Windows instance as an admin.
- Enter the disk management interface by selecting CVM Management>Storage>Disk Management.
- (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 pop-up Initialize Disk window, and click OK.
MBR (Main Boot Record) partition format supports a maximum disk capacity of 2 TB, and GPT (GUID Partition Table) 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, and select New Simple Volume.
- Enter the simple volume size, and click Next.
- Select a drive letter or drive path, and click Next.
- Select the file system, perform a quick format, and then click Next.
- Click Finish.
The disk you have selected is formatting. Wait for the system to complete the initialization operation. 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.
Formatting, creating a file system, and writing a file (Linux)
- This document takes EXT4 file system as an example.
- When Linux CVM restarts or starts up, data disks will not be automatically mounted. For more information, see Format and Mount Data Disks.
- Log in to a Linux instance as the root user.
- Run the following command to view the names of data disks attached to the instance.
If the returned result is similar to what is shown below, 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
- Execute the following command to format the disk.
- Execute 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
- Press i to enter the edit mode and enter "This is my first test." Press ESC to exit the edit mode, and enter :wq to save and exit the file.
- Execute the
ls command to view that the
qcloud.txt file has been written to the disk.