Linux Learning Record: Seven, Fdisk partitioning tool

Source: Internet
Author: User

One, Fdisk partitioning tool

Fdisk is an old partition tool from IBM that supports most operating systems, and almost all Linux distributions are equipped with FDISK, including the Linux resuce mode.

Fdisk is an MBR-based partitioning tool, so if you need to use GPT, you cannot partition with Fdisk.

Second, Fdisk is simple and practical
    • The fdisk command only works if you have Superuser privileges
    • Use the fdisk-l command to list all installed hard disks and their partition information
    • Use FDISK/DEV/SDA to partition the first SATA hard drive
    • After partitioning, you need to use the partprobe command to let the kernel update the partition information, otherwise a restart is required to identify the new partition

    • cat/proc/partitions View the contents of this file can also get the partition information

Third, testing

I installed the centos-6.9-x86_64 system in vitual box and added a 10G virtual SATA hard drive to test the following.

1. List partition information

As you can see, there are two SATA hard drives/dev/sda and/dev/sdb. The number of heads, number of sectors, and number of cylinders for both drives are also listed. Among them, the first hard disk has two partitions/dev/sda1,/dev/sda2, the 2nd hard disk does not have the partition.

Start is the start cylinder, end is the ending cylinder, Blocks is the partition capacity (or size), the Id is the partition type Id,system is the partition type.

2. Confirm Partition Information

Below, I use the fdisk/dev/sdb command to format the second SATA hard disk partition, which is an interactive interface:

3. Add Primary partition

Confirm that there are no partitions, add the primary partition below:

4. Add an extended partition

Add an extended partition:

5. Adding logical partitions

Now, with the primary and extended partitions, I add a logical partition to the extended partition:

Note that the partition type for both SDB1 and SDB5 is number 83rd Linux type.

6. Built-in encoding table

The specific ID and System can be viewed through the L or L directives, and the following are some of the coding tables built into Linux:

Of course, you can use the t instruction to modify the partition ID if necessary.

7. Write to the partition table, exit

Finally, save the current partitioning scheme with the W directive:

8. List partition information

OK, now let's look at the new partition information:

RELATED links: linux_fdisk command explanation

Linux Learning Record: Seven, Fdisk partitioning tool

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.