Linux and hard disk partition

xiaoxiao2021-03-06  208

Usually, our hard drive has been occupied by Windows, and now let Linux check in, you have to make it a certain hard disk space. So we have to face the complex concept of "partition".

In order to achieve this goal, you can usually pass the following three methods:

1) Map all the data on the last logical partition to other partitions, delete the logical partition with partition tool, use this part of the space to Linux.

This method is simple, just use FDisk to delete the last logical partition. No need to say more.

2) Renew the hard disk partition, which is the most direct and most troublesome way. The specific operation is as follows:

Backup user's file

Start the system with MS-DOS system

. Delete the original partition with fdisk, rebuild the new partition, and the space allocated to Linux is not

Assigned to any partition

Reinstall the original user system

This method usually changes because of the system you want to install, so please refer to the article related to "Multi-System Currency" related to this website.

3) Re-being partitioned with some partition tools without deleting the original data of the hard disk. Such as partition magicians, etc. (About the use of these partition tools, we will explain the documentation).

See here, you can ask some readers to ask, what do you want to say? In fact, this article wants to talk to you in detail the concept of hard disk partition. The so-called "Do not build a high platform", I hope everyone can "know it, and know how it is."

First, the hard disk partition basis:

Usually, there are two hard drives used on the PC:

1) IDE interface: the most common;

2) SCSI interface: better than IDE, but more expensive!

The hard disk partition is operated for a hard disk, which can be divided into: primary partition, extended partition, logical partition. The main partition can be 1-3, and the extension partition can have 0-1, and there is no limit to the logical partition. Their relationships are shown below:

Figure 1 Relationship diagram of hard drive partition

We briefly explain that the primary partition and extension partition are flat-level, the extension partition itself cannot be used to store data, and it must be divided into several (1-n) logical partitions.

A hard disk can be divided into four primary partitions, one extension partition, 2 primary partitions, 1 extended partition, 1 primary partition 1 extension partition (most users only use this method).

Of course, if you wish to only divide only one primary partition, or two primary partitions, no expansion partition is also possible.

That is, no matter what operating system, only the primary partition, logical partition can be used directly. However, the file system format used by different operating systems is different. After the different operating systems, the partition has some new names: the FAT16 partition used by Earlier MSDOS, the FAT32 partition used by Windows, the NTFS partition used by Windows NT, The EXT2 partition and SWAP partition used by Linux ... and more.

Ok, let's take a look at how Windows uses these partitions:

Second, the partition under Windows:

Under Windows, use "drive letter", such as A, B, C, D, E ..., also represent a partition. This method makes the hard disk partition this thing is very simple. Where A and B are floppy drives, the hard disk partition is numbered from C.

Let's take a look at the example below:

Figure 2 Subregional number of windows

For Windows, it can only use one primary partition (in fdisk, called a primary DOS partition), you can use multiple logical partitions. The number of the hard disk drive is shown in the figure above.

Third, the partition under Linux:

And under Linux, it is more complicated. First, it naming each device: IDE device: two IDE interfaces (I call it first IDE, second IDE), and two IDEs can be connected to each IDE interface Equipment (I called the primary disk, slave "). Where the hard disk and the optical drive are IDE devices. Linux is naming this:

First IDE's primary disc: / dev / hda

From the front of the first IDE: / dev / hdb

Second IDE's primary disc: / dev / hdc

The slap of the second IDE: / dev / hdd

Don't ask me where my CD drive is there? !

SCSI device: This relative to everyone will be unfamiliar, it usually needs to add a SCSI card to drive. The first SCSI device is called: / dev / sda, the second block is / dev / sdb ... in this class.

Why have a "/ dev", because, in the UNIX / Linux system, all devices are made as a file, put it in the / dev directory.

Ok, I have finished the hard drive to say parties! As shown below:

Figure 2 Partition naming under Linux

That is, the primary partition (or extended partition) is named HDA1-HDA4, if not, skip. The logical partition in the extension partition is numbered from the HDA5 to push.

Note that here is the primary disc of the first IDE as an example, if it is the second hard disk, it is HDB1, HDB2, HDB5, HDB6, HDB7.

At this point, we can find that there is no matter how many IDE devices in Windows are sequentially assigned, and in Linux, it is carefully distinguished to treat each hard disk.

Fourth, divide the partition for Linux:

Everyone knows that every partition under Windows can be used to store files, and in the case of Linux, in addition to the partition of the file, a "SWAP (Exchange) partition" needs to be used to supplement memory, so two partitions are usually required:

1. Main partition: If you learn to use, it is recommended 2G;

2. Exchange partition: Just 1-2 times memory size, if 64-128M memory, the switching partition can be 128m, 128-256M memory, the exchange partition can be 256m.

Since the early Linux launcher LILO does not recognize the hard disk partition other than 8G, it is recommended to divide Linux within 8G.

V. Start system:

The MBR (main boot record) is placed in the logical first sector of each hard disk, which includes the primary partition and expansion partition information. When the machine is activated, when the boot is given to the hard disk, the program on the MBR is first executed. Then find the active partition, start the operating system. The multi-boot tools such as LILO, OS Loader are implemented by rewriting MBR. So, when everyone is installed, write lilo on the MBR, then install Windows 9x, then MBR is rewritten to become Windows 9x!

转载请注明原文地址:https://www.9cbs.com/read-128827.html

New Post(0)