MBR partition in Linux
For MBR partitions in Linux, the following section describes how to partition an MBR partition for a hard disk that is added to the server. Why is this MBR partition? We will talk about MBR partitioning later and use the fdisk tool that comes with the system. First, let's take a look at what fdisk is and enter "fdisk" in the command line, as shown below:
The above is information about fdisk and related help information.
Then, let's take a look at the partitions in the system and enter the command "fdisk-l. As follows:
It is found that there is a device/dev/sdb in the system, the size is 8589 M, we have not partitioned it. Next we will partition it.
Run the "fdisk/dev/sdb" command to enter the partition mode, as shown below,
Then we can type "m" to view the Help Command, as shown below:
These commands are the commands we need to use for partitioning. After learning about the basic commands, let's start partitioning and type "n" as follows:
This allows us to choose whether to split a primary partition or an extended partition. Let's split it into a primary partition and type "p" as follows:
Let's name this primary partition and name it 1. Type 1 as follows:
Then the size of the primary partition is allocated. Note that the unit of size here is cylinder, that is, the magnetic column. Some versions are not in this unit,
This is not important, because the basic steps are the same. The input range is 1 ~ 1044. If not entered, the default value is 1. Enter 1 as follows:
The starting point of the size is 1. What does it end? For example, if you want to allocate a size of MB to the primary partition, type "+ MB. As follows:
In this way, the primary partition is allocated. Then we can view the existing Partition Table and type "p" to see the primary partition we have completed, as shown below:
We can see that the primary partition we just completed occupies 522081 data blocks. If you want to continue partitioning, Type n as follows:
To create an extended partition, Type e as follows:
Still named. Because the name of the primary partition and the extended partition is 1 ~ 4. 1 has just been allocated to the primary partition. Let's name this extended partition 2.
Enter the following:
Are you familiar with this? The steps are the same, but the range is changed to 66 ~ 1044. Let's use the default one. Press enter as follows:
This time we plan to allocate MB to it, then type "+ MB", as shown below:
This completes another partition. Let's take a look at all the partitions. type p as follows:
Did you see the two partitions we just made? The following is the extended partition.
Of course, extended partitions cannot write data. Therefore, logical partitions must be added. Let's create a logical partition.
Similarly, Type n to continue partitioning, as shown below:
This discovery adds an option l because we have just created an extended partition, and only one extended partition can be created. Because we are either in the extended partition
Create a logical partition or continue to create the primary partition. Type l as follows:
We found that the magnetic column still started from 66. The magnetic column also started from 66 when we created the extended partition. This shows that logical partitions are actually extended partitions.
. Use the default value. Continue as follows:
This time, we allocated 1000 M to it and used up the size allocated to the extended partition. As follows:
Now, we have created logical partitions. Let's take a look at several partitions. type p as follows:
The logical partition name is sdb5.
Note that the preceding table is just a partition table. The real partition is not started yet. It's just like we build a house and draw the drawings first. So you can
Modify. Now I want to modify it. I think the extended partition is too small and I want to modify it again. How can this problem be solved?
You just need to delete the extended partition and then re-partition it. (All logical partitions under the extended partition are automatically deleted)
Remember the name of the extended partition we just named? For sequence 2, type "d" as follows:
Then type 2, as shown below:
Let's see if it is deleted. type p as follows:
Extended partitions are deleted along with logical partitions. Next let's start partitioning again. Type n as follows:
Still select create extended partition, Type e, as shown below:
Name it 2 again, as shown below:
By default, press enter as follows:
This time, we select all the remaining sizes for the extended partition, and type 1044, as shown below:
We can continue to create logical partitions for the rest, so I will not demonstrate it. The steps are exactly the same as described above.
What should we do when we plan all partitions? For example, the partition table that I have completed is as follows:
Note that the preceding statement is only a partition table. Next we need to write the Partition Table to the disk before it takes effect.
Enter w to write data to the disk. As follows:
Is our partition successful? Use "fdisk-l" to view the information, as shown below:
How about the partition we just created! Succeeded. This is the basic step for MBR partitioning.
++ ++ ++
Why is MBR partition?
Okay. Now we know the basic steps. Let's talk about MBR partitioning. This is the title of the preceding partitioning method. Yes. In fact, this is the traditional Partition
Method. This method has the following features:
(1) partition is limited. You can add up to four primary partitions and up to one extended partition.
(2) The number of primary and extended partitions ranges from 1 ~ 4. logical partitions are named by numbers 5 and later.
(3) The maximum capacity of a single partition is 2 TB.
The above is the characteristic of this partition, which can also be said to be its disadvantage. Corresponding to this, there is another partitioning method to solve this problem. In the following article, we will talk about it.
Note: This does not mean that the partition is complete and the hard disk can be used. Partitions are only the first step. They must be formatted and mounted before they can be used. Here we will first use partitions.
This article permanently updates the link address: