Welcome: Hunan Intelligent Applications Tecgnology CO.,ltd.-HNIAT.com
Language: Chinese ∷  English

Basic knowledge

How fdisk mounts a new hard disk under CentOS 7

Load new hard disk with fdisk under CentOS 7
Notice:
The fdisk tool does not support GPT. For partitions in GPT format, you need to use another powerful partitioning tool parted released by GNU

+++++++++++++++++++++++++++++++++

Basic commands:
fdisk # disk partition
mkfs #Format each partition
+++++++++++++++++++++++++++++++++

Common options for the fdisk interactive command



example:
The system has two disks sda and sdb, sda has been divided, partitioned and formatted in use, sdb is a disk that has not done any operations.
Now divide the 32GB disk of sdb into two partitions, one is 10GB and the other is 22GB. And mount to the /app-sdb1 and /app-sdb2 directories.





Start partitioning /dev/sdb
fdisk /dev/sdb



Enter n, create partition (primary or extended), partition number (1-4), sector, partition size (10GB)
Create a 10GB partition here, use p to view



When creating the second disk partition, you do not need to enter the partition size at the end, it means that all the remaining capacity is given to this partition. Finally check with p



After the two partitions are divided, enter w to save all previous operations



Format both partitions
mkfs.xfs



To mount a formatted partition, first create two directories to partition and mount these two partitions

mkdir /app-sdb1-10GB
mkdir /app-sdb2-22GB



Finally, use df -h to check that the mount has been successful



################################################## #####

Change the partition type of a disk partition
The partition type of the current two partitions is xfs, here I want to convert the partition of sdb2 to the partition type of NTFS



fdisk /dev/sdb


After the restart is completed, remount to the corresponding directory, and the original file also exists. If the partition is formatted, the data will be lost.

################################################## #####

Load the partition to the boot list
View partition UUID

blkid

Edit the boot partition table file

etc/fstab



According to the format in the figure, fill in the partition to be loaded into the startup item, then save and exit, restart the server to verify.
-----------------------------------
© Copyright belongs to the author: original work from 51CTO blogger OptimusSnow, please contact the author for reprint authorization, otherwise legal responsibility will be pursued
How fdisk mounts a new hard disk under CentOS 7
https://blog.51cto.com/snowlai/2312266

CONTACT US

Contact: Manager Xu

Phone: 13907330718

Tel: 0731-22222718

Email: hniatcom@163.com

Add: Room 603, 6th Floor, Shifting Room, No. 2, Orbit Zhigu, No. 79 Liancheng Road, Shifeng District, Zhuzhou City, Hunan Province

Scan the qr codeClose
the qr code