After logging on to the Centos server remotely through SSH, the following operation is performed to remind you that the mounting operation will clear the data. make sure that the mounting disk has no data or you have not used the first step: list unmounted disk commands: fdisk-l prompt: if the device name of the data disk cannot be confirmed, use the df command to confirm the name of the system disk to exclude the error disk. Step 2: format the hard disk to be unmounted/dev/
Log on to the Centos server remotely using SSH and perform the following operations:
Reminder: data is cleared during the mounting Operation. make sure the mounting disk has no data or is not in use.
Step 1: list unmounted disksCommand: fdisk-l
Tip: If the device name of the data disk cannot be confirmed, use the df command to confirm the name of the system disk, so as to exclude the error disk from being attached.
Step 2: format the hard diskTake the unmounted/dev/sdb command as an example: fdisk/dev/sdb
Note: manually type at the arrow annotation area
Step 3: Create a partitionCommand: mkfs. ext4/dev/sdb1
Step 4: Mount a partitionCommand: mkdir/data
Mount/dev/sdb1/data # mount the sdb hard disk to/data
Step 5: write information to fstab to enable automatic mounting.
Command for automatic mounting upon startup: echo "/dev/sdb1/data ext4 defaults 0 0 0">/etc/fstab
Run the cet/etc/fstab command.
After restart, run the df command to view the mounted space and path.