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 CentOS7 views commands for mounting and unmounting data disk partitions

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

Share

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

-- View the current disk mount

[root@localhost] # df-h

Filesystem Size Used Avail Use% Mounted on

/ dev/mapper/cl-root 37G 1.8G 36G 5% /

/ dev/xvda1 1014M 157M 858M 16% / boot

Enter the command fdisk-l to view the hard disk and find the data disk to be mounted here: / dev/xvde: 536.9 GB

[root@localhost ~] # fdisk-l

Disk / dev/xvde: 536.9 GB, 536870912000 bytes, 1048576000 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I size (minimum/optimal): 512 bytes / 512 bytes

-- format the disk

Using the data disk for the first time, format the data disk with the command mkfs.xfs / dev/vdb before mounting, here in xfs format

If you need to change to another file system format (such as ext4, etc.), you can change it to the corresponding format. If you use ext4, it is mkfs.ext4 / dev/vdb.

[root@localhost ~] # fdisk / dev/xvde-format disk

-- formatted disk name: / dev/xvde1

[root@localhost ~] # fdisk-l

/ dev/xvde1 2048 1048575999 524286976 83 Linux

-- format the disk, right? set the disk to xfs format

[root@localhost ~] # mkfs.xfs / dev/xvde1

-- enter n to partition

Command (m for help): n

-- Select the partition type (p primary partition)

Select (default p): P

-- Select the number of partitions (also partition id)

Partition number (1-4, default 1): 1

-- Select the size of the partition space and enter all the time.

Last sector, + sectors or + size {KMagne Mpeng} (2048-1048575999, default 1048575999):

Using default value 1048575999

Partition 1 of type Linux and of size 500 GiB is set

Finally, enter w to save the exit.

Command (m for help): W

-- Mount the data disk

-- create a data directory

[root@localhost /] # mkdir / data

-- Mount the data disk

[root@localhost /] # mount / dev/xvde1 / data/

-- check the mount

[root@localhost /] # df-h

Filesystem Size Used Avail Use% Mounted on

/ dev/mapper/cl-root 37G 1.8G 36G 5% /

/ dev/xvda1 1014M 157M 858M 16% / boot

/ dev/xvde1 500G 33m 500G 1% / data

-- automatic mounting of data disk on boot

-- check disk UUID

[root@localhost /] # blkid

/ dev/xvda1: UUID= "11a217c0-0c11-487e-83cb-c771e786170a" TYPE= "xfs"

Dev/mapper/cl-swap: UUID= "7e18e05b-c1fc-4393-83cb-d62d0bb2fea3" TYPE= "swap"

Dev/xvde1: UUID= "b6759bcf-bb01-4361-90cd-d5d38e12201b" TYPE= "xfs"

/ dev/xvde1 needs to be mounted automatically, namely UUID=b6759bcf-bb01-4361-90cd-d5d38e12201b

-- Editing vim / etc/fstab to add mount entries to complete automatic boot mount

UUID=b6759bcf-bb01-4361-90cd-d5d38e12201b / data xfs defaults 0 0

-- unmount mount point

[root@localhost /] # umount / dada

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