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.
2. On the desktop, click . 3. Go to the Server Manager page and click File and Storage Services on the left sidebar.
4. On the left sidebar, select Volume > Disk.
Note:
If the newly added disk is in offline status, execute Step 5 before Step 6 to perform initialization. Otherwise, you can directly execute Step 6. 5. Disks are listed on the right pane. Right-click the row where 1 is located, and select Online to bring it online. Then its status becomes Online.
6. Right-click the row where 1 is located, and select Initialize in the menu.
7. Click Yes as prompted.
8. After the initialization, 1 changes from the Unknown to GPT partition. Click the row where 1 is located and select New Simple volume in the menu.
9. In the welcome page of New Volume Wizard pop-up window, click Next.
10. Select the server and disk and click Next.
11. Specify the volume size as needed, which is the maximum value by default. Click Next.
12. Assign a drive letter and click Next.
13. Configure parameters as needed, format the partition, and click Next to complete the partition creation.
14. After confirming that everything is correct, click Create.
15. Wait for the completion of the volume creation and click Close.
After the initialization is completed, go to My Computer to view the new disk.
Select the initialization method according to your actual use cases:
If the entire disk is presented as one independent partition (there is no logical disks such as vdb1 and vdb2), we strongly recommend that you not use partition, and directly create the file system on bare devices. If the entire disk needs to be presented as multiple logical partitions (there are multiple logical disks), you need to first partition the disk, and then create the file system on a partition. Creating file systems on bare devices
2. Run the following command as the root user to view the disk name.
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.
3. Run the following command to create a file system on the /dev/vdb
bare device.
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:
Note:
The formatting takes a while. Pay attention to the system's running status and do not exit.
4. Run the following command to create a new mount point.
Take creating a new mount point /data
as an example:
5. Run 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 /data
as an example:
6. Run the following command to view the mount result.
Note:
If you don't need to configure disk automount at startup, skip the following steps.
7. Confirm the mount method and obtain the corresponding information.
Based on business needs, you can use an elastic cloud disk's soft link, file system's UUID (universally unique identifier), or device name to automatically mount a disk. The descriptions and information acquisition methods are as follows:
|
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. | Run the following command to obtain the soft link of the elastic cloud disk. |
Use the UUID of the file system | Auto-mounting configuration may fail due to changes in a file system's UUID.For example, reformatting a file system will change its UUID. | Run the following command to obtain the UUID of the file system. |
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. | Run the following command to obtain the device name. |
8. Run the following command to back up the /etc/fstab
file to the /home
directory, for example:
9. Execute the following command to use VI editor to open the /etc/fstab
file.
10. Press i to enter edit mode.
11. 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 launch>
(Recommended) 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
Take automatic mounting using the UUID of the disk partition as an example. Add the following content:
UUID=d489ca1c-5057-4536-81cb-ceb2847f9954 /data ext4 defaults 0 0
Take automatic mounting using the device name as an example. Add the following content:
/dev/vdb /data ext4 defaults 0 0
12. Press Esc, enter :wq, and press Enter.
Save the configuration and exit the editor.
13. Execute the following command to check whether the /etc/fstab
file has been written successfully.
If the command runs successfully, the file has been written. The newly created file system will automatically mount when the operating system starts up.
Creating a file system on a partition
Note:
This document uses the parted partition tool in the CentOS 7.5 operating system to configure the /dev/vdc
data disk as the primary partition. GPT is used as the default partition format, EXT4 format as the file system, and /data/newpart2
as the mount point. Disk automount at startup is configured. Note that the formatting operation may vary according to the operating system.
2. Run the following command as the root user to view the disk name.
If the returned result is as shown below, the current CVM instance has two disks, where /dev/vda
is the system disk and /dev/vdc
is the newly added data disk.
3. Run the following command to use the parted tool to partition the newly added data disk.
parted <Newly added data disk>
Take the newly mounted data disk /dev/vdc
as an example:
The returned information is similar to what is shown below:
4. Enter p
and press Enter to view the current disk partition format.
The returned information is similar to what is shown below:
Partition Table: unknown indicates that the disk partition format is unknown.
5. Run the following command to configure the disk partition format.
mklabel <Disk partition format>
If the disk capacity is larger than or equal to 2TB, only GPT partition format can be used:
6. Enter p
and press Enter to check whether the disk partition format has been configured successfully.
The returned information is similar to what is shown below:
Partition Table: gpt indicates that the disk partition format is GPT.
7. Enter unit s
and press Enter to set the unit of the disk to sector.
8. Take creating one partition for the entire disk as an example, enter mkpart opt 2048s 100%
and press Enter.
Where, 2048s indicates the initial disk capacity and 100% indicates the final disk capacity. This is for reference only. You can choose the number of disk partitions and their capacities based on business needs.
9. Enter p
and press Enter to view information about the newly created partition.
The returned information is similar to what is shown below:
This indicates the detailed information of the newly created partition /dev/vdc1
. 10. Enter q
and press Enter to exit the parted partition tool.
11. Run the following command to view the disk name.
The returned information is similar to what is shown below. You can now see the new partition /dev/vdc1
.
12. Run the following command to configure the file system of the newly created partition to that 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. The following example takes EXT4
as the file system:
The returned information is similar to what is shown below:
The formatting takes a while. Pay attention to the system's running status and do not exit. 13. Run the following command to create a new mount point.
Take creating a new mount point `/data/newpart2` as an example:
14. Run the following command to mount the new partition to the newly created mount point.
mount /dev/vdc1 <Mount point>
Take creating the /data/newpart2
mount point as an example:
mount /dev/vdc1 /data/newpart2
15. Run the following command to view the mount results.
The returned information is similar to what is shown below:
This indicates that the newly created partition /dev/vdc1
has been mounted to /data/newpart2
. Note:
If you don't need to configure disk automount at startup, skip the following steps.
16. Confirm the mounting method and get the corresponding information.
Based on business needs, you can use an elastic cloud disk's soft link, file system's UUID (universally unique identifier), or device name to automatically mount a disk. The descriptions and information acquisition methods are as follows:
|
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. | Run the following command to obtain the soft link of the elastic cloud disk. |
Use the UUID of the file system | Auto-mounting configuration may fail due to changes in a file system's UUID.For example, reformatting a file system will change its UUID. | Run the following command to obtain the UUID of the file system. |
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. | Run the following command to obtain the device name. |
17. Run the following command to back up the /etc/fstab
file to the /home
directory, for example:
18. Run the following command to use VI editor to open the /etc/fstab
file.
19. Press i to enter 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 launch>
(Recommended) 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-bm42ztpm-part1 /data/newpart2 ext4 defaults 0 2
Take automatic mounting using the UUID of the disk partition as an example. Add the following content:
UUID=fc3f42cc-2093-49c7-b4fd-c616ba6165f4 /data/newpart2 ext4 defaults 0 2
Take automatic mounting using the device name as an example. Add the following content:
/dev/vdc1 /data/newpart2 ext4 defaults 0 2
20. Press Esc, enter :wq, and press Enter.
Save the configuration and exit the editor.
21. Run the following command to check whether the /etc/fstab
file has been written successfully.
If the command runs successfully, the file has been written. The newly created file system will automatically mount when the operating system starts up.
Was this page helpful?