Linux Entry Basics _centos (ii)--FDISK partition

Source: Internet
Author: User

Lesson 10 using Fdisk for Disk Management            FDISK is an old partition tool from IBM that supports most operating systems, and almost all Linux distributions have Fdisk installed, Included in Linux rescue mode can still use,            FDISK is an MBR-based partitioning tool, so if you use GPT, you cannot partition with Fdisk             Note:                    The FDISK command only has super super Level user rights to operate                     fdisk-l     can list all installed hard disk and partition information &nbs P                   FDISK/DEV/SDB     can partition the target disk:    &N Bsp                   instance:                        First, use     fdisk-l     To view our system's current drive information, such as           &N Bsp                                 &NBSP ;                         Then we use:    FDISK/DEV/SDB     to partition the SDB disk into the partition command,                                  &NBS P             This time, we can enter M view command help                                                 See,                        n    add A new partition   create a New section                         1, creating a primary partition Parimary partition steps like &N Bsp                                 &NBSP ;             Here, we follow the command prompt to enter n,                  & nbsp   &nbsp Next, the system prompts us: What partition do we need to create? E     Extended     extended partition, p    primary partition     Main division         &N Bsp                   We remember what we said earlier: Due to the partitioning mechanism of MBR: 446bytes     Install boot loader boot LOA der                                 () nbsp                          ,         &NB Sp                           +        &N Bsp                          ,         &NB Sp                          ,         &NB Sp               64bytes (16*4)     record zoning information   &NBsp                          ,         &NB Sp                          ,         &NB Sp                     +              &N Bsp                          ,         &NB Sp                          ,         &NB Sp         2bytes    55AA, permanent marking means the system is bootable               &NBSP ;                          ,         &NB Sp                                 &NBsp           =512bytes                      and nbsp     So, we can create up to 4 primary partitions, where we create a primary partition, and the rest are created as expanded partitions                   &NBSP ;     Continue above command operation:                        Input p-> system prompt input The area code (partition number (1-4), the numbers here also proves what we said above) we enter 1                    &NB Sp   First cylinder asked us to enter the starting cylinder number, the default value is 1, we do not enter, using the default value                 the        ->last cylinder, terminating cylinder number or partition size, we enter: +2g                &NBSP ;       Complete, at this point, enter P to view the disk information, we can see the information we just partitioned,                nbsp   Next, we're going to expand the partition                                           , we created the extended partition with the remaining disk space, as we said in the previous section, there is no way to use the expanded partition, which means that data cannot be formatted and stored.                     When we divide the extended partition, enter n         &N Bsp           We can see that there is no extended this option at this time, but rather the option of logical this logical partition, which is the addition of the logical partition in the extended partition, We can physically use this space only after the extended partition is divided into logical partitions. The partition number must be greater than or equal to 5, because 1-4 is the reserved word for the primary and extended partitions.                     Next, logical partitioning,                                            We're divided. Two logical partitions: SDB5 and SDB6.                     NOTE: When the partition is complete, our partition information is still in memory at this time, once our own power loss or lock screen, etc. Then our partition information disappears, our efforts just now in vain, at this time, we see the command table has a: W     Write table to disk and exit   Use this command to write our partition information to the 64bytes of the MBR of the disk. After executing the command you can see that the partition table has been altered, the partition table has been modified, calling IOCT () to read  partition Table calls the Ioct () method and reads it back into the partition table.                     If we don't want to live the partition there are some undesirable places, we can make any changes before the W command, of course, but also use Q     Quit without saving changes, exit Do not save changes                 Let's take a look at what we just did. The partition is out.                               &NBSP ; Note here:                    Sometimes, although we have written the partition information to our partition table, our system may not be updated. does not show the partition information we created, we can use                     partprobe     command to update the kernel Section info                 Generally we need to set up our partition's    id after partitioning, this ID is actually the identity partition is a Type of partition, such as we modify partition ID     command:    t     Change a partition ' s system id        & nbsp           Original partition information, note id                                    Edit the partition ID, here we are prompted to enter uppercase L to see a list of 16-digit meaning, and then we will change the SDB6 into a swap partition, Just enter 82 to go                               &N Bsp       View post-change zoning information                         &NB Sp           and above, if you confirm the changes, be sure to use the W command to save the changes

Linux Entry Basics _centos (ii)--FDISK partition

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.