View hard disk partition
fdisk -l
Partition
fdisk /dev/sdb
Input n, p, 1, press enter, press enter, wq
Command (m for help): m
#Create a new partition
Command (m for help): n
Partition number (1-4): 1
#Enter 1, which is the main disk partition
First cylinder(1-175664, default 1):1
Last cylinder or + size or sizeM or + sizeK(1-1775664,default 175664): 回车
Using default value 175664
Check whether the logical disk has been built
fdisk -l
Format the partition and create a file system
mkfs.ext4 /dev/vdb1
Create mounted directory
mkdir /usr1
Enter partition information, it can be mounted automatically after restart
echo /dev/vdb1 /usr1 ext4 defaults 0 0 >> /etc/fstab
Mount the completed file system to the newuser folder
mount /dev/vdb1 /usr1
ormount -a
View the mount
df -h
Note: Do not mount the data disk to a directory with data, otherwise the data in the directory will be overwritten and hidden.
Reason : Linux's VFS (virtual file system) mechanism. After normal login, all directories and files seen are VFS directory trees constructed in memory when the kernel is loaded, instead of directly seeing the actual hard disk Directory tree. When you mount a device to a VFS mount point (such as /usr1), the system points the mount point /usr1 in the VFS to the last device you mounted. Then when you visit the mount point now, you will see the device you last mounted here. The previously mounted device is still there, but the mount point /wlserver no longer points to the previous device. So the previous data is hidden, but not deleted. If umount mounts, the data can come back.