System environment: CentOS7 64-bit
Scenario: Add a 100G SCSI hard disk to the virtual machine, divide it into an extended partition, format it as an ext4 file format, and mount it to the /opt directory
Steps: Partition -> Format -> Mount -> Automatically mount at startup
1. View disk information
sudo yum install util-linux-ng
lsblk
2. Partition
fdisk /dev/sdb
add new partition
n
Select partition type
e (extended partition)
Select the number of
partitions Partition number (1-4, default 1): 1
Set sector
Start sector (2048-83886079, default is 2048): Enter
Last sector, +sector or +size{K,M,G} (2048-83886079, default is 83886079): Enter
save
w
3. Formatting
mkfs -t ext4 /dev/sdb
4. Mount
mount /dev/sdb /opt
5. Automatically mount at boot
/dev/sdb /opt ext4 defaults 1 1