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 Centos mounts the disk

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Editor to share with you how to mount Centos disk, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

1: view the unmounted disks on the server (ordinary disks, efficient disks, SSD disks). The command is as follows:

Fdisk-l

As can be seen from the figure above, the / dev/vdb 42.9GB of the server this disk is not mounted

If the disk is not mounted, there will be a similar word at the bottom: Disk / dev/sdc doesn't contain a valid partition table; or the disk does not have something like: sdb1 sdb2...

For example, it is clear from the picture below that the third hard drive does not have a partition. Disk / dev/sdc doesn't contain a valid partition table

2: disk partition (partition has primary partition, extended partition, logical partition). The command is as follows:

Fdisk / dev/vdb

N-> p-> 1-> enter-> enter-> w

The general meaning of the above picture is as follows:

N: add a partition

P: primary partition

The two carriage returns refer to the disk sector size at the beginning and end

W: write to disk

At this time, although the disk has been partitioned, but there is no file system, the disk is still not available.

The blogger server only bought one data disk, so I used it all as the main partition. If you want to divide a disk into several pieces, you can continue to partition by this command; you can continue to create extended partitions.

3: format the disk and write to the file system: the command is as follows:

Mkfs.ext4 / dev/vdb1 / / you can use ext3 or ext4 here

The interface shown in the figure below shows that the format disk was successfully written to the file:

4: Mount the new disk to a node of the operating system. The command is as follows:

Mkdir / huichengff

Mount / dev/vdb1 / huichengff

Create a huichengff at the root of the system and mount the disk to this directory; the mount location can be created at will

5: check the disk information to confirm whether the new disk is mounted successfully. The command is as follows:

Df

If the mount is successful, an interface such as the following figure will appear

6: view all the information on the disk

When we look at all the partitions again, we will have one more primary partition with the fdisk-l command, / dev/vdb1; as shown below:

7: set boot to start automatic mount

The newly created partition cannot be automatically mounted on boot, and must be mounted manually every time the machine is rebooted.

The / etc/fstab file needs to be modified to set auto-mount on boot. The command is as follows:

Vim / etc/fstab

/ / after opening, add the following code to the last line:

/ dev/vdb1 / huichengff ext4 defaults 0 1 / / if ext3 is used above, ext3 is also used here

The above is all the contents of the article "how to mount a disk in Centos". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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