Step 4: Format and mount the data disk
If you select a data disk when you create an instance, after you log on to the instance, the system needs to format the data disk and mount the data disk.
In addition, you can configure the data disk in multiple partitions according to your business needs. It is recommended that you use the system's own tools for partitioning operations.
Note : Cloud server ECS only supports two partitions of the data disk , not two partitions of the system disk (whether it is Windows or Linux). If you force a Third-party tool to partition the system disk two times, you may cause an unknown risk, such as a system crash, data loss, and so on.
This operation applies to non-I/O optimization +ssd cloud disk Linux (Redhat, CentOS, Debian, Ubuntu) instances. For I/O optimization instances +SSD Cloud disk partition mount, scripting tools are recommended: auto_fdisk_ssd.sh
1. Use Remote Connection tool, enter username root and password login to instance.
2, run the fdisk-l command to view the data disk. Note : You cannot see a data disk without partitioning and formatting the data disk by using the df-h command. In the following example, there is a 5 GB data disk that needs to be mounted.
If no/dev/xvdb is found after the fdisk-l command is executed, your instance does not have a data disk and therefore does not need to be mounted. This chapter can be ignored.
3, run fdisk/dev/xvdb , partition the data disk. According to the prompts, enter n ,p ,1 , two times carriage return,Wq , the partition begins.
4, run the fdisk-l command to view the new partition. The new partition XVDB1 has been created. As in the following example,/DEV/XVDB1. 、
5, run mkfs.ext3/dev/xvdb1 , the new partition to format. The time it takes to format depends on the size of the data disk. You can also decide to choose Other file formats, such as ext14.
6, run Echo '/dev/xvdb1/mnt ext3 defaults 0 0 ' >>/etc/fstab write new partition information. When you are done, you can use the cat/etc/fstab command to view. Note : Ubuntu 12.04 does not support barrier, so the correct command for the system is:Echo '/dev/xvdb1/mnt ext3 barrier=0 0 0 ' >>/etc/fstab You can modify the/mnt part of the above command if you need to mount the data disk to a folder separately, for example, to store the Web page separately.
7, run mount/dev/xvdb1/mnt mount the new partition, and then perform df-h view partition. If the data disk information appears, indicating that the mount is successful, you can use the new partition.