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 implement Centos7 formatting Partition and mounting

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

In this article Xiaobian for you to introduce in detail "Centos7 format partition and mount how to achieve", the content is detailed, the steps are clear, the details are handled properly, I hope this "Centos7 formatted partition and mount how to achieve" article can help you solve your doubts, the following follow the editor's ideas slowly in-depth, together to learn new knowledge.

1. View the current disk situation

[root@pgtest59 ~] # df-lh file system capacity used used mount point / dev/sdb3 50g 994m 50g 2% / devtmpfs 47g 047g 0% / devtmpfs 47g 047g 0% / dev/shmtmpfs 47g 11m 47g 1% / runtmpfs 47g 047g 0% / sys/fs/cgroup/dev/sdb1 1014m 134m 881m 14% / boot/dev/sdb5 392g 33m 392g / hometmpfs 9.3g 0 9.3g 0% / run/user/0tmpfs 9.3g 0 9.3g 0% / run/user/1001

This new hard disk is ready to be mounted to / data, so create a mount point first.

[root@pgtest59 ~] # mkdir / data

two。 View partition information

[root@pgtest59] # fdisk-l disk / dev/sda:17997.3 gb, 17997255147520 bytes, 35150888960 sector units = sector of 1 * 512 = 512 bytes sector size (logical / physical): 512 bytes / 4096 bytes iUnix size (minimum / optimal): 4096 bytes / 4096 bytes disk / dev/sdb:480.0 gb, 480036847616 bytes 937571968 sector units = sector of 1 * 512 = 512 bytes sector size (logical / physical): 4096 bytes / 4096 bytes iUnix size (min / best): 4096 bytes / 4096 bytes disk label type: dos disk identifier: 0x000b3fc7 device boot start end blocks id system/dev/sdb1 * 2048 2099199 1048576 83 linux/dev/sdb2 2099200 10487807 419430482 linux swap / solaris/dev/sdb3 10487808 115345407 52428800 83 linux/dev/sdb4 115345408 937570303 411112448 5 extended/dev/sdb5 115347456 937570303 411111424 83 linux

Note: the fdisk-l command can only see the device information that can perform partition operations (for example, the CD will not be displayed), and it will be displayed regardless of whether the partition is mounted or not.

Because the current disk is not formatted, mounting it directly will cause an error, for example:

/ * Mount without formatting * / [root@pgtest59 ~] # mount / dev/sda / data/mount: / dev/sda write protection, mount: unknown file system type "(null)" will be mounted read-only

3. Format Partition

[root@pgtest59 ~] # mkfs.xfs / dev/sda meta-data=/dev/sda isize=512 agcount=17, agsize=268435455 blks = sectsz=4096 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0data = bsize=4096 blocks=4393861120, imaxpct=5 = sunit=0 swidth=0 blksnaming = version 2 bsize=4096 ascii-ci=0 ftype=1log = internal log bsize=4096 blocks=521728, version=2 = sectsz=4096 sunit=1 blks, lazy-count=1realtime = none extsz=4096 blocks=0, rtextents=0

Note: this time the format is xfs format, or it can be formatted into ext4 or ext3 and other required formats.

4. Mount partition

/ * Mount partition * / [root@pgtest59 ~] # mount / dev/sda / data//* View results * / [root@pgtest59 ~] # df-th File system Type capacity available available mount point / dev/sdb3 xfs 50g 1.6g 49g 4% / devtmpfs devtmpfs 47g 047g 0% / devtmpfs tmpfs 47g 047g 0% / dev/shmtmpfs tmpfs 47g 11m 47g 1% / runtmpfs tmpfs 47g 047g 0% / sys/fs/cgroup/dev/sdb1 xfs 1014m 134m 881m 14% / boot/dev/sdb5 xfs 392g 33m 392g 1% / home/dev/sda xfs 17t 33m 17t 1% / datatmpfs tmpfs 9.3g 09.3g 0% / run/user/1001

5. Set the boot to start the automatic mount

This step is easy to miss. In many cases, after processing the previous steps, the partition has been mounted successfully, but if the machine is rebooted, the directory will not be used directly (the df command cannot be seen), so it needs to be set to boot to start automatic mount.

Vim / etc/fstab/* add the following information * / / dev/sda / data xfs defaults 0 0

Note: the device to be mounted can be one of the following:

The name of the device file, such as / dev/sda

Label of the Devic

This method is more commonly used in uuid,centos 7 of devices.

Pseudo file system: such as sysfs, proc, tmpfs, etc.

Read here, this "Centos7 format partition and mount how to achieve" article has been introduced, want to master the knowledge of this article still need to practice and use to understand, if you want to know more related articles, 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