Attach a disk to the centos 7 VM Instance System
I. Preparation
One centos7 cloud host
50 GB cloud Disk
Attach a cloud disk to a VM instance
Ii. attaching a disk
1.1 view new disk
[root@cgsl ]# fdisk –l
Find the number of the Newly Added Disk:/dev/vdc
1.2 hard disk partition enters fdisk Mode
[root@cgsl ]# /sbin/fdisk /dev/vdc
Input 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
Press enter all the time and enter q to exit.
3. format the partition to format the new partition to the 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 under the root directory
[root@cgsl ]# mkdir /storage
2. Mount/dev/vdc to/storage
[root@cgsl ]# mount /dev/vdc /storage
3. Set automatic mounting upon startup the newly created partition cannot be automatically mounted upon startup. Manual mounting is required for each reboot of the machine. Modify the/etc/fstab file to set automatic mounting upon startup.
#vi /etc/fstab
Add/dev/vdc/storage ext3 defaults 1 2 at the end of the file
Make sure to query your hard disk format by using df-T.