The trouble with using Linux partitioning Tools _unix Linux

Source: Internet
Author: User
Tags versions

Wen/Wu di

In the process of learning Linux, installing Linux is the first hurdle for every beginner. In the middle of the process, the biggest confusion is to partition the hard disk. Although the various versions of Linux now offer a friendly graphical interface, many people still feel like they can't do it. The main reason for this is the unclear zoning requirements for Linux, and the most effective partitioning tool-fdisk to use below it. Here are two aspects to explain this problem that bothers us all.

Zoning rules for Linux

1. Equipment Management

In Linux, each hardware device is mapped to a system file, which is no exception for IDE or SCSI devices, such as hard disks, optical drives, and so on.

Linux assigns a variety of IDE devices to a file made up of HD prefixes, and for a variety of SCSI devices, a file that consists of an SD prefix is assigned. For example, the first IDE device, Linux is defined as HDA; the second IDE device is defined as HDB; SCSI devices should be SDA, SDB, SDC, and so on.

2. Number of partitions

To partition, you must operate on each hardware device, which can be an IDE hard disk or a SCSI hard drive. For each hard drive (IDE or SCSI) device, Linux allocates a sequence number of 1 to 16, which represents the partition number on the hard drive. For example, the first partition of the first IDE hard disk, which is mapped below Linux is hda1, and the second partition is called Hda2. For SCSI hard drives are SDA1, SDB1, and so on.

3. The role of the various subregions

In Linux, each hard disk device can have up to 4 primary partitions (which contain extended partitions), and any one of the extended partitions occupies a primary partition number, that is, on one hard disk, the primary partition and the extended partition are up to 4. For earlier DOS and Windows (previous versions of Windows 2000), the system recognizes only one primary partition, and can further refine the partition by increasing the logical disk character (logical partition) on the extended partition.

The primary partition is used by the computer to start the operating system, so every operating system startup, or boot, should be hosted on the primary partition. This is the biggest difference between the primary partition and the extended partition and the logical partition. The best example of this is to specify the primary partition when installing the bootloader to boot Linux.

Linux requires that the primary partition (or extended partition) occupy the first 4 digits of 1 to 16th code. As an example of the first IDE hard disk, the primary partition (or extended partition) occupies the hda1, Hda2, Hda3, HDA4, and the logical partition takes up 12 numbers from Hda5 to Hda16. As a result, there are a maximum of 16 partitions per hard disk under Linux.

For logical partitions, Linux requires that they be built on extended partitions (as is the case on DOS and Windows systems), not on primary partitions. As a result, we can see that extended partitions can provide a more flexible partitioning model, but not as a guide to the operating system.

By removing the differences between the various partitions above, we can simply treat them equally.

5. Zoning indicators

For each Linux partition, the size of the partition and the type of partition are the main indicators. The size of the volume is easy for readers to understand, but the type of partition is not so easy to accept. The type of partition prescribes the format of the file system above this partition. Linux supports a variety of file system formats, including the familiar FAT32, FAT16, NTFS, HP-UX, and a variety of Linux-specific Linux native and Linux swap partitioning types. In a Linux system, these different types of partitions can be distinguished by the partition type number. The various types of numbers will be introduced when describing how Fdisk is used.

Fdisk use detailed

The following is an introduction to the use of Fdisk to consolidate the knowledge of the various Linux partitions learned above.

Fdisk is the most common partitioning tool in various Linux distributions, and is defined as the expert level partitioning tool that makes beginners a bit intimidating.

1.Fdisk parameter Description

When you run Fdisk, you first see the Welcome interface shown in Figure 1, where the user operates Fdisk by entering command parameters in this interface.


Figure 1 Fdisk Welcome interface

By prompting the user to type "M", you can display a description of each parameter of the FDISK command.

The reader can see that Fdisk has a lot of parameters, but often use a few, if the reader is proficient in these parameters can be fluent use of FDISK, Linux hard disk partition. Let's start with a brief description of the meaning of each parameter, and then specify several key parameters, as shown in table 1.

Table 1 Description of FDISK parameters

When users partition in Linux, the most commonly used parameters are D, L, M, N, p, Q, T, W, and so on.

2. Use FDISK to partition

In the Linux partitioning process, it is common to display the hard disk partition table information through the P parameter first, and then determine the future partition based on the information. As shown in Figure 2.


Table 1 shows the existing partitions

Figure 2 shows the size of the partition and the type of partition. If you want to completely change the hard disk partition format, you can use the D parameter to delete the existing hard disk partitions. such as D1,D2.

After you delete it, you can add a new partition by using the n parameter. When "n" is pressed, we can see the new partition shown in Figure 3.


Figure 3 New partitions

To select the new partition type, either the primary partition or the extended partition, and then either P or E. Their differences are explained in the above. The size of the partition is then set. Note that if you have an extended partition on your hard disk, you can only increase the logical partition and not increase the extended partition, as shown in Figure 4.


Figure 4 New Logical partitions

When partitioning is added, the type is the default Linux Native, and if you need to change some of these partitions into other types, such as Linux swap or FAT32, you can change it by command T, as shown in Figure 5.


Figure 5 Converting a partition type

When you press "T" to change the partition type, the system prompts you to change which partition and change the type (if you want to know the type of partition supported by the system, type L). Figure 5 indicates that the type of partition 5 is changed to the swap type of Linux 82nd.

The partition type number supported by Linux and its corresponding partition type can be referenced in table 2 (this information can be obtained by L command).


Table 2 partition type corresponding table

After you have changed the partition type, you can press "W" to save and exit. If you do not want to save, you can choose "Q" to exit directly.

Through the above two aspects of learning, I believe that for starters, zoning is no longer a stumbling block in the Linux step.

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.