Linux system mount data disk (Alibaba cloud)

Applicable system: Linux (Redhat, CentOS, Debian, Ubuntu)

* The Linux cloud server data disk has not been partitioned and formatted. You can partition and format it according to the following steps.

The following operations will divide the data disk into a partition for use.
 

 
1. View the data disk
Before partitioning and formatting the data disk, use the "df -h" command, you cannot see the data disk, you can use the "fdisk -l" command to view it. As shown below:


 
 

Friendly reminder: If you execute the fdisk -l command and find that there is no /dev/xvdb indicating that your cloud service has no data disk, then you do not need to mount it, and this tutorial is not applicable to you.

 


2. Partition the data disk
Execute the "fdisk /dev/xvdb" command to partition the data disk;
According to the prompt, enter "n", "p", "1" in turn, press Enter twice, and "wq", the partitioning starts and will be completed soon.

 


 


3. View the new partition
Use the "fdisk -l" command to see that the new partition xvdb1 has been created.


 

 

 


 4. Format the new partition
Use the "mkfs.ext3 /dev/xvdb1" command to format the new partition. The formatting time varies according to the size of the hard disk.
(You can also choose the ext4 format at your own discretion)

 

 

 


 5. Add partition information
Use the command "echo '/dev/xvdb1 /mnt ext3 defaults 0 0' >> /etc/fstab" ( without quotes ) to write the new partition information.
Then use the "cat /etc/fstab" command to view, and the following information appears, indicating that the writing is successful.
* If you need to mount the data disk to a folder separately, such as to store web pages alone, you can modify the /mnt part of the above command


 
 

 
6. Mount the new partition
Use the "mount -a" command to mount the new partition, and then use the "df -h" command to view it. If the following information appears, the mount is successful and the new partition can be used.


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326856368&siteId=291194637