1. Preparation
One centos7 cloud host
50G Cloud Hard Drive
Mount the cloud disk to the cloud host
2. Mount the disk
1.1View new disk
[root@cgsl ]# fdisk –l
The number of the newly added disk found is /dev/vdc
1.2 Hard disk partition Enter fdisk mode
[root@cgsl ]# /sbin/fdisk /dev/vdc
Enter n to partition
[root@cgsl ]# Command (m for help): n
Select partition type
[root@cgsl ]# Select (default p): p
Select the number of partitions
[root@cgsl ]# Partition number (1-4, default 1): 1
Keep pressing Enter, and finally enter q to exit.
3. Format the partition Format the new partition into an ext3 file system
[root@cgsl ]# mkfs -t ext3 /dev/vdc
4. Mount the hard disk 1. Create a mount point and create a storage directory in the root directory
[root@cgsl ]# mkdir /storage
2. Mount /dev/vdc to /storage
[root@cgsl ]# mount /dev/vdc /storage
3. Set up automatic mounting at startup. Newly created partitions cannot be automatically mounted at startup. They must be mounted manually every time the machine is restarted. Setting up automatic mounting at boot requires modifying the /etc/fstab file
#vi /etc/fstab
Add a line at the end of the file /dev/vdc /storage ext3 defaults 1 2
Be careful to check your own hard disk format and use df -T to query.
The above is the detailed content of How to mount disk on CentOS 7 cloud host?. For more information, please follow other related articles on the PHP Chinese website!