Linux partition knowledge and partition of large disk

  

Most of the PCs we have access to today still use the BIOS + MBR combination that was inherited in the last century. BIOS, Basic Input-Output System, is an interface between software and hardware. It can be regarded as a translation between Chinese and English. Although the two are completely different, you can let the BIOS know. In the location, the BIOS is usually written to a ROM chip connected to the motherboard, of course, also directly written to the North Bridge, but quite rare. The BIOS is written almost entirely in assembly language, which largely determines the performance and stability of the motherboard.

MBR, Master Boot Record, which is our common partitioning method, but the end users outside the administrator rarely know its existence. The standard of MBR partition determines that MBR only supports below 2TB. Four partition entries are created in a hard disk (more than 2TB can only manage 2TB). To get more partitions, you need secondary structure – extended partition. The extended partition can be divided into one or more logical disks again, that is, the disk other than the C disk in the normal case, or the part other than the first partition. In some cases, the C disk in Windows may be a logical partition.

EFI, Extensible Firmware Interface, an alternative to the BIOS proposed by Intel Corporation. The location of EFI is very special. It is not the firmware and the interface itself. The EFI is just an interface between the operating system and the platform firmware. It feels like the relationship between the company, the CEO, and the CEO secretary. Under the CEO (Operating System) task, the CEO Secretary (EFI) is responsible for distributing the task assignment to the company's department managers (platform firmware), and the managers send the tasks to specific groups (various hardware) to complete.

GPT , globally uniquely identifies the GUID Partition Table, GUID, Globally Unique Identifier. The GUID Partition Table (GPT) was introduced as part of the Extensible Firmware Interface (EFI) program. Of course, you can also use GPT partitions in the BIOS PC, although GPT comes from the EFI program, but does not rely on EFI. GPT is more flexible than the Master Boot Record (MBR) partitioning scheme commonly used in PCs. For example, you can exceed the limit of 4 MBR partition entries. There are almost no restrictions on the number of partitions in the GPT specification. The 128 that you can find on the Internet are actually Windows systems (Windows that supports GPT). . GPT has a manageable disk size that exceeds 2TB of MBR (1TB = 1024GB) and reaches 18EB (1EB = 1024TB). In the MBR partitioning scheme, the booting of the operating system is through the MBR placed in the beginning (first sector) of the disk (where the MBR refers to the master boot record, not the master boot record partition scheme, both of which have the same name. I The guess is to distinguish it from the GPT partitioning scheme. The name of the master boot record is used to name the partitioning scheme. I can't find out the exact information. My guess is correct. I can only distinguish it.) . Putting important information (such as partition information, directories, etc.) in a sector is the method of the MBR partitioning scheme, and GPT puts this information in the partition. Intel's explanation is that it can be more clear and more secure. In order to protect itself from the disk management software under the MBR scheme, the GPT partition establishes a protection partition (Protective MBR) at the beginning of the disk (the first sector). The type of the partition is 0xEE. This protected partition size is 200MB under Apple OS (Mac OS X). This partition is called the GPT protected partition in the Window NT Disk Manager. This partition allows disk management software that does not recognize GPT to treat a GPT disk as an unknown partition, rather than mistakenly treating it as an unpartitioned disk.

File System Restrictions:

The following information is from: Wikipedia

ext3

Block Size Maximum File Size Maximum File System Size

1KiB 16GiB 2TiB

2KiB 256GiB 8TiB

4KiB 2TiB 16TiB

8KiB 16TiB 32TiB

ext4

Extents

Ext4 introduced the Extent file storage method to replace the block mapping method used by ext2/3. Extent refers to a series of contiguous physical blocks, which can increase the efficiency of large files and reduce split files. A single Extent supported by ext4 can be up to 128MB in a system with a single block of 4KB [1]. Four Outtents can be stored in a single inode; more than four Extents will be indexed in Htree mode.

Maximum file size 16 TiB (for 4k block filesystem)

Maximum volume size 1 EiB

xfs

The maximum supported file size is 263 = 9 x 1018 = 9 exabytes, the maximum file system size is 18 exabytes.

ReiserFS

Maximum file size 8 TiB

Maximum volume capacity 16 TiB

Disk partitioning method larger than 2T

Due to MBR partition The table only supports 2T disks, so disks larger than 2T must use the GPT partition table. The specific method is as follows:

The GPT format disk is equivalent to 4*16 bytes of the original MBR disk that retains 4 partition tables. Only the first 16 bytes are left, similar to the extended partition. The real partition table is after 512 bytes. The GPT disk does not have the limit of four primary partitions.

But fdisk does not support GPT, we can use parted to operate on GPT disks.

Parted is very powerful, both command line and interactive

Entering parted at the prompt will enter interactive mode. If there are multiple disks, we need to run Select sdx x is a disk for disk selection

Java code

parted>

parted>select sdb Assuming the disk is sdb

parted>mklabel Gpt Format MBR disk as GPT

#parted>mklabel msdos Convert GPT disk to MBR disk

parted>mkpart primary 0 100 Divide a starting position to 0 and a size of 100M Primary partition

parted>mkpart primary 100 200 Divide a primary partition with a starting position of 100M and a size of 100M

#parted>mkpart primary 0 -1 Divide the entire disk into a partition< Br>

parted>print Print current partition

parted>quit Exit

More commands for parted:

Java code

check NUMBER do a simple check on the file system

cp [FROM-DEVICE ] FROM-NUMBER TO-NUMBER copy file system to another partition

help [COMMAND] prints general help, or help on

COMMAND

mklabel LABEL-TYPE create a new Disklabel (partition

table)

mkfs NUMBER FS-TYPE make a FS-TYPE file system on

partititon NUMBER

mkpart PART-TYPE [FS -TYPE] START END make a partition

mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system

move NUMBER START END move partition NUMBER

name NUMBER NAME name partition NUMBER as NAME

print [free

Copyright © Windows knowledge All Rights Reserved