1. Add a disk to the virtual machine
- Select the server with the disk to be added, right-click Settings – Storage – Controller – Add Hard Disk
- new disk
- Select disk type
- allocate size to disk
- Set the required size
- Select the disk you just created
- save and exit
2. linux mount disk
- Open the server that just added the disk to view the disk partition information
fdisk -l
The information is given /dev/sdb is the disk we just created
2. Add partitions to the disk
fdisk /dev/sdb
Enter the interactive mode and start typing for the disk partition n
, then press Enter all the way, and finally enter w
3. After the default partition, you need to format the partition. Before that, you can check the partition in the system
df -Th
4. Here I follow the format in my system to format
mkfs.xfs /dev/sdb1
为什么是/dev/sdb1涉及名字变化问题这里就不多说了
5. Mount the disk
mount /dev/sdb1 /data #Mount the disk /dev/sdb1 to the /data directory
Check if the mount is successful
df -h #View disk partition information
6. Boot up and mount automatically
blkid /dev/sdb1 #View disk id information
vim /etc/fstab #Modify configuration file
Add the disk information to the /etc/fstab file and restart the server