Tencent Cloud server Centos mount data disk method

  • 2020-12-10 01:04:46
  • OfStack

1. Check whether the hard disk device has a data disk


#  To perform first 
fdisk -l

#  Here are the results of the execution 

Disk /dev/vda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000736d7

  Device Boot   Start     End   Blocks  Id System
/dev/vda1  *      1    2611  20970496  83 Linux


#  Check Tencent cloud server data hard disk 
#  We can see that there is 20GB The data disk is not mounted. Look at the path ahead /dev/vda1

2. Partition of data Hard disk (optional)


#  perform 
fdisk /dev/vda1

#  Please input  n  , p ,  1 ,   Enter, enter, wq
#  Here, VDA Is the name of the data disk we see above, if you are not this need to replace according to your real disk name, if is and I 1 So, just copy it. 

Section 3.ext3 format partitions


#  Formatted as ext3 The file system 
mkfs.ext3 /dev/vda1

4. Mount the new partition


# A -  The new directory 
mkdir /home

# B -  Mount the partition 
mount /dev/vda1 /home

5. Write fstab to set boot auto mount


echo '/dev/vda1 /home ext3 defaults 0 0' >> /etc/fstab

Step 6 check for successful mount (ES23en-ES24en)


#  perform 
df -h

#  The following are the results of the execution 
Filesystem   Size Used Avail Use% Mounted on
/dev/vda1    20G 1.2G  18G  7% /
/dev/vda1    20G 1.2G  18G  7% /home

Related articles: