How to choose the partition of the disk when installing Centos?

1. Introduction of the problem

        When using Vmware to create a Centos system, the following page will appear, let us choose the way of disk partition. Compared with using Windows, the system will partition into C disk, D disk, E disk, etc. by default, so when we are asked to choose the partition here, we are at a loss and can only choose according to the default configuration every time. But not every default choice is suitable for your needs. In order to understand which is suitable, it is necessary to understand what is a partition?

 2. Basic expansion

        Before understanding what is a partition, it is necessary to understand what is a disk? In fact, the disk is easy to understand. The disk is like the phonograph we saw in the TV series Shanghai Beach. The specific structure is shown in the figure below. You can see a magnetic head rotating on the platter, just like a phonograph when it is running, so when we copy large files, you will hear a loud sound from the host because the platter is rotating rapidly and the magnetic head is reading crazily. write operation.

         The most important thing in this structural diagram is the platter and the magnetic head, which are composed of stacked platters. Each platter does not look smooth as in the structural diagram, but is actually divided into many tracks (in the figure below Circles of gray concentric circles). Drawing a straight line from the center of the circle to the outside can divide a magnetic track into arc segments (the green parts in the figure below), and the so-called arc segments are also sectors. A sector is also the smallest unit in a disk. Usually, the storage size of such a sector is 512 bytes (a sector of some advanced format disks can store up to 4096 bytes).

         It was also mentioned just now that the disk in the disk is not a single disk, but multiple disks overlapped to form a cylinder, and each disk has two upper and lower magnetic heads for reading and writing. In this cylinder, the tracks of the same radius on each platter form a cylinder, which is called the cylinder of the disk.

        A disk partition is the area formed between two cylinders. If a disk has two cylinders, it means that the disk has three partitions. The disk partition is to tell the operating system that the disk can be accessed in this partition area, such as the area between the A magnetic column and the B magnetic column, so that the operating system can read and write files in this designated area. , Query operation.

3. Problem solving

        Go back to the top one to select the disk partition method, and the relevant instructions for the corresponding options are as follows:

Use All Space: Use all partitions after deleting all partitions in the current disk.

Replace Existing Linux System(s): Replace all linux partitions in the current disk without replacing partitions created by other systems. This is the default option

Shrink Current System: Utilize (squeeze) all the free space that exists on the partition to create the system's default partition layout

Use Free Space: Use unused partition space

Create Custom Layout: Customize the partition method. 

        Here it is generally recommended to choose the way of custom partitioning, that is, option five - Create Custom Layout.

        For the way of custom partitioning, it is necessary to assign /boot, swap (swap) partition, and root directory, and assign them in this order.

        The /boot partition is the kernel of the operating system and the files used in the boot process, and the size of the notification setting is 200MB. The file format is selected as Ext4, and the size is fixed.

        The swap partition is similar to the virtual memory in Windows, that is, when the memory is insufficient, the hard disk space will be virtualized as memory to solve the insufficient memory situation. For example, when the memory size is 2G, when the memory is insufficient, the memory space occupied by programs that have not been operated for some time in the memory will be released, and the contents of this space will be temporarily copied to the designated swap partition on the disk for use when needed Then copy it back to memory from the swap partition. Generally speaking, the size of the swap partition will be set to twice the size of the memory, but it still needs to be considered according to the actual situation.

         The root partition usually allocates the rest of the disk space to /.

         The final result after division is as follows:

 4. Knowledge extension

          1) After the above steps are completed, there will be a prompt to format. The purpose of formatting is to write to the file system. Hard disks that have not been formatted cannot be used. Because the file attributes/permissions set by each operating system and the format of storing data will be different, so in order to be consistent with the configuration of the current decentralization selection, it must be formatted.

        2) When partitioning on the above, "File System Type" will be selected. Common formats in Linux file systems are divided into Ext2, Ext3, and Ext4, which are analogous to FAT and NTFS under Windows. Among them, Ext4 is optimized on the basis of Ext3, and some important data structures have been modified to support larger file systems and files. Compared with Ext2, Ext3 only has more log functions.

        Ext3 supports a file system of 16TB and a file of 2TB, while Ext4 supports a file system of 1EB (1048576TB) and a file of 16TB. Moreover, only 32,000 subdirectories are supported under Ext3, while Ext4 has no limit.

        Therefore, the file format selected for /boot and the root directory partition above is the default Ext4.

Guess you like

Origin blog.csdn.net/qq_35363507/article/details/127390889
Recommended