Linux entry notes: 7. fdisk partitioning tool, linuxfdisk

Source: Internet
Author: User
Tags superuser permission

Linux entry notes: 7. fdisk partitioning tool, linuxfdisk
I. fdisk partitioning Tool

Fdisk is a legacy partitioning tool from IBM that supports the vast majority of operating systems. fdisk is installed in almost all Linux distributions, including in Linux resuce mode.

Fdisk is an MBR-based partitioning tool. Therefore, if GPT is required, fdisk cannot be used for partitioning.

 

Ii. Use the fdisk command
  • The fdisk command can only be run with the superuser permission.
  • Use the fdisk-l command to list all installed hard disks and their partition information.
  • You can use fdisk/dev/sda to partition the first SATA hard disk.
  • After partitioning, you must use the partprobe command to let the kernel update the partition information. Otherwise, you must restart to identify the new partition.

  • Cat/proc/partitions you can view the content of this file and obtain the partition information.

 

Iii. Test

I installed the CentOS-6.9-x86_64 SYSTEM IN THE Vitual Box and added a 10G virtual SATA hard disk, test as follows.

 

1. List partition information

We can see that there are two SATA hard drives/dev/sda and/dev/sdb. The number of cores, slice, and cylinder of the two hard disks are also listed. The first hard disk has two partitions:/dev/sda1,/dev/sda2, and 2nd hard disks have no partitions.

Start is the Start cylindrical, End is the End cylindrical, Blocks is the partition capacity (or size), Id is the partition type ID, and System is the partition type.

 

 

2. Confirm partition information

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

 

3. Add a primary Partition

If no partition is found, add the primary partition below:

 

4. Add extended partitions

Add an extended partition:

 

5. Add logical partitions

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

Note that the partition types of sdb1 and sdb5 are both of the 83 Linux type.

 

6. built-in encoding table

The specific id and System can be viewed through the l or L commands. The following are some built-in encoding tables in Linux:

Of course, if necessary, you can use the t command to modify the partition id.

 

7. Write to the partition table and exit

Finally, use the w command to save the current Partition Scheme:

 

8. List partition information

Now let's check the new partition information:

 

Link: linux_fdisk command details

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.