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 data disk in CentOS7

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces CentOS7 how to mount the new data disk, the article is very detailed, has a certain reference value, interested friends must read it!

View hard disk information

First of all, let's use the command df-TH to view the current system mount:

We see that there is no new data disk mounted, the data disk is more than 200 gigabytes.

Then use the command fdisk-l to view the hard disk information.

You can see that there are two hard drives / dev/xvda and / dev/xvde. Boot xvda is the system disk, and xvde is our new data disk. In other words, the system found a new data disk / dev/xvde, but did not mount it. Note that sometimes the new data disk is not called xvde, it may be called xvdb.

Execute mount command

1. Execute the command fdisk / dev/xvde, enter fdisk mode, and start partitioning the newly added data disk.

In the echo information, enter n and enter, and then enter all the subsequent operations by default. The return message at the end of the image above tells us that there is a 200G hard disk partition and that it has been established.

2. Next, type p, enter, and view the details of the new partition.

As shown in the figure above, then enter w to save and write the partition result to the partition table.

If the echo message is as follows, the partition is successful:

The partition table has been altered!

Calling ioctl () to re-read partition table.

Syncing disks.

3. Execute the command partprobe to synchronize the new partition table changes to the operating system.

4. Execute the following command to set the new partition file system to the format required by the system.

Mkfs-t ext4 / dev/xvde1

5. Mount the newly created partition to the / mnt/datadisk mount point. / mnt/datadisk is a new mount point of our system, that is, the directory. If the directory does not exist, you can define the mount directory.

Mount / dev/xvde1 / mnt/datadisk

6. Use the command df-Th to check the disk mount.

The figure above shows that the new disk / dev/xvde1 has been successfully mounted to / mnt/datadisk.

Power on and mount automatically

The mounted disk needs to be automatically mounted on boot. Instead of using / etc/fstab to specify / dev/xvde1 directly, it is recommended to use UUID to configure auto-mount data disk.

First execute the command blkid / dev/xvde1 to query the UUID of the disk partition:

Dev/xvde1: UUID= "1d4e1d9d-d15c-1273-8442-2303b05b96ad" TYPE= "ext4"

Then edit / etc/fstab, adding a line at the end:

UUID=1d4e1d9d-d15c-1273-8442-2303b05b96ad / mnt/datadisk ext4 defaults 1 1

Just replace the UUID and directory with your own.

Finally, restart the machine and use df-TH to check the mount status. If you can see the new disk mount information, you are done.

The above is all the contents of the article "how to mount a new data disk in CentOS7". Thank you for reading! Hope to share the content to help you, more related 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

Servers

Wechat

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

12
Report