Attach a new hard disk to fdisk in centos 7

Source: Internet
Author: User
Attach a new hard disk to fdisk in centos 7

Note:
The fdisk tool does not support GPT. For GPT-format partitions, you need to use the powerful partition tool parted released by GNU.

-
++

Basic commands:
Fdisk # disk partition
Mkfs # format each partition
++

Common options for fdisk interactive commands

Example:
The system has two disks, SDA and SDB. SDA has been divided and partitioned and formatted for use. SDB is a disk without any operation.
Now we need to divide the 32 GB disk of SDB into two partitions, one 10 GB and the other 22 GB. And mount to/app-sdb1 and/app-sdb2 directory.

Start partitioning/dev/SDB
Fdisk/dev/SDB

Enter n to create a partition (primary partition or extended partition), Partition Number (1-4), Sector, partition size (10 Gb)
Create a 10 Gb partition and use P to view it

When creating the second disk partition, you do not need to enter the partition size at the end, indicating that all the remaining capacity is allocated to this partition. Finally, use P to view

After the two are distinguished, input W to save all the operations before

Format two partitions
Mkfs. XFS

To mount a formatted partition, you must first create two directories to partition and mount the two partitions.

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

Finally, use DF-h to check whether the mounting is successful.

Change the partition type of a disk partition

Currently, the partition types of the two partitions are XFS. Here we want to convert the sdb2 partition to the NTFS partition type.

Fdisk/dev/SDB

After the restart, mount the file to the corresponding directory and the original file also exists. If you format the partition, the data will be lost.

Attach a new hard disk to fdisk in centos 7

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.