Oracle Vm virtual machine Linux adds disk and mounts (super detailed)

1. Add a disk to the virtual machine

  1. Select the server with the disk to be added, right-click Settings – Storage – Controller – Add Hard Disk

insert image description here

  1. new disk
    insert image description here
  2. Select disk type
    insert image description here
  3. allocate size to disk
    insert image description here
  4. Set the required size
    insert image description here
  5. Select the disk you just created
    insert image description here
  6. save and exit
    insert image description here

2. linux mount disk

  1. Open the server that just added the disk to view the disk partition information

fdisk -l
insert image description here

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
insert image description here
3. After the default partition, you need to format the partition. Before that, you can check the partition in the system

df -Th

insert image description here
4. Here I follow the format in my system to format

mkfs.xfs /dev/sdb1

为什么是/dev/sdb1涉及名字变化问题这里就不多说了

insert image description here
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

insert image description here
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
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/qq_62242833/article/details/126503466
Recommended