Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to mount a new disk on a virtual machine

2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how the virtual machine mounts the new disk". In the daily operation, I believe that many people have doubts about how the virtual machine mounts the new disk. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the question of "how the virtual machine mounts the new disk"! Next, please follow the editor to study!

First use df to take a look at my computer's hard drive information:

Df-h

Add disks to the virtual machine

View the hard drive under dev:

(above, two partitions are added to each of the two hard drives, sda and sdb)

Next, we will install another hard drive:

1. Install the hard drive on the computer, restart the computer, and check to see if there is an extra hard drive under / dev/

Press m to display the menu:

Here is to ask whether you want to create a primary partition or an extended partition, this is the first time to create and select a primary partition p

Here I ask you the starting sector of a partition, and enter directly here (default), which is equivalent to entering 2048.

At this point, the first partition has been established. Note that you can continue to create the partition here (repeat the previous step)

But it is still not written to the hard disk sdb in memory. After that, type w, and I will only build a partition here.

Note: this is the entire disk sdb, not the disk partition sdb1

4. Create a file system (format partition)

The mainstream file systems in Linux are: ext4 and xfsd.

5. Mounting

Before mounting, you need to determine the mount directory. Here is / mnt/sdb1-zhi. If you don't have a directory, you'd better set up a directory under / mnt. This directory is specially mounted and you can do whatever you want. In the future, this partition will be associated with this / mnt/sdb1-zhi directory.

Manual mount

Mount / dev/sdb1 / mnt/sdb1-zhi/

It has been successfully mounted here, but it is only an one-time and will disappear after reboot

Permanent mount: write the information to fstab and let the system turn on automatic mount.

Command: echo "/ dev/sdb1 / data ext4 defaults 0" >

To edit the / etc/fstab file

Vim / etc/fstab

Like in the first line.

Hard disk path file path (mount point) the order in which custom options for file system type devices are forwarded to fsck

/ dev/mapper/CentOS-root / xfs defaults 0 0

UUID=e4ef36e1-0840-4a58-a4f7-c26f52ead6f1 / boot xfs defaults 0 0

We need to write our own partition and file path on the last line, which can be copied from the above

/ dev/sdb1 / mnt/sdb1-zhi ext4 defaults 0 0

Rollover: 0 do not rollover, do not backup 1 rollover, backup

Fsck: boot check disk sequence 0 means 1234 is not checked. For inspection order

After the above steps are completed, you need to judge whether it is correct or not.

Mount-a

Finally, let's sum up:

Step 1: format disk fdisk / dev/sdb-> create a partition to complete w save

Step 2: the kernel reread the partition table partprobe / dev/sdb

Step 3: create a file system (format partition) mkfs.ext4 / dev/sdb1

Step 4: Mount mount / dev/sdb1 / mnt/sdb1-zhi

Step 5: permanent mount command: echo "/ dev/sdb1 / data ext4 defaults 00" > step 6: check whether mount-an is successful

At this point, the study on "how to mount a new disk on a virtual machine" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report