1. Run fdisk -l to view details about the hard disk
We can see that there is a 536GB disk that has not been mounted
2. Initialize the partition
fdisk /dev/vdb
1) Select the partition number. The sum of Linux basic partition and extended partition cannot be greater than 4. Therefore, select the partition number from 1 to 4.
2) Run the t command and enter the partition type. Enter 8E to indicate the virtual logical volume partition. If the disk partition space is insufficient, it can be expanded online.
3) Enter the w command to rewrite the partition table.
3. View the created partition
1) Run the fdisk -l command to view the created partitions. Sometimes, you cannot see the new partitions. In this case, you cannot see information about the newly created partitions by running the fdisk command.
2) PartProbe is a tool that can modify the partition table in the kernel, enabling the kernel to re-read the partition table without restarting the system. Command:
partprobe /dev/vdb
fdisk -l
3) Initialize the physical disk partition as a physical volume for LVM use:
partprobe /dev/vdb
If this partProbe installation is not used
yum -y install lvm2
4. Create volume groups and logical volumes and format them
1) Create volume group szzx_vg: vgcreate szzx_vg /dev/vdb2
2) Create logical volume szzx_lv: lvcreate -l 100% VG-n szzx_lv szzx_vg
3) Format the logical volume mkfs.ext4 /dev/szzx_vg/szzx_lv
5. Create a directory. Mount the new partition to the created directory
Create directory data:
mkdir /data
2) Mount directory: mount /dev/szzx_vg/szzx_lv /data/
Run the df -h command to query the disk space
6. Set the partition to automatically mount after the system restarts.
vim /etc/fstab
This must be noted, or data loss may occur
/dev/mapper/szzx_vg-szzx_lv /data ext4 defaults 0 0
= = = = = = = = = = = = = = = = = the back of the operation is used to test whether successfully configured to restart automatically mount = = = = = = = = = = = = = = = = = =
Resume: reboot
Run the df-h command to check whether the disk is properly mounted