Linux-GPT partition and parted disk partition example (extended)

One, GPT disk partition

1. Concept

The GPT partition mode uses the GUID partition table, which is a newer disk partition table structure standard derived from the EFI standard. Compared with the commonly used master boot record (MBR) partition scheme, GPT provides a more flexible disk partitioning mechanism.

2. Features

1. Supports large hard drives above 2TB.
2. There is almost no limit on the number of partitions per disk. Why do you say "almost"? This is because the Windows system only allows up to 128 partitions. But it's quite enough.
3. The partition size is almost unlimited. It's another "almost". Because it uses a 64-bit integer to represent the sector number. To put it in an exaggeration, the size of a partition represented by a 64-bit integer is already an "astronomical number", and you will not be able to see a hard disk of this size for several years, let alone a partition.
4. The partition table comes with a backup. A copy of the same partition table is saved at the beginning and the end of the disk. After one part is destroyed, it can be restored through the other part.
5. Each partition can have a name (different from the volume label).

3. Difference from MBR

1. The traditional MBR partitioning method has a limitation: it cannot support partitions of hard disks exceeding 2TB (or a single partition exceeding 2TB). This situation is really unacceptable (especially enterprise-level) when the amount of data is increasing sharply. Application, data volume of several terabytes at every turn).
MBR disk partition supports a maximum volume of 2.2TB, and each disk has a maximum of 4 primary partitions, or 3 primary partitions, 1 extended partition, and multiple logical partitions in the extended partition.
2. Globally unique identification partition table (GPT)
GPT is a partition structure of a physical hard disk. It is part of the extensible firmware interface standard and is used to replace the master boot record partition table in the BIOS.
GPT allows each disk to have up to 128 partitions, supports a volume size of up to 18EB (gigabytes), allows the primary disk partition table and backup disk partition table for redundancy, and also supports unique disk and partition IDs (GUID).
3. Summary
1. If the disk is smaller than 2TB, you can use fdisk /dev/sdb to partition, that is, MBR partition format
. 2. If the disk is larger than 2TB, you can use parted /dev/sdb to partition, because the MBR partition disk cannot be larger than 2.2TB, so More than 2TB generally use GPT partition format

1. Create a 4T disk in the virtual machine and restart it

Create 4T hard drive
Insert picture description here

2. Create a partitioned hard disk

fdisk-l-view hard disk name
parted /dev/sdb-disk partition
(parted) mklabel-create partition
new disk label? gpt
(parted) mkpart-create partition
partition name? []? sdb1
file system type? [ext2]? ext4
starting point? 0 (can be expressed as a percentage, such as Start? 0%, End? 50%)
end point? 500GB
Insert picture description hereInsert picture description here

3. Verify the partition information and save

(parted) print
Insert picture description here

4. Example of deleting a partition (extension, no demonstration here)

If the partition is wrong, you can use the rm command to delete the partition. For example, we want to delete the above partition, and then print the deleted result
(parted) rm 1 #The number of the partition used after rm is the Number printed with print

5. Format and mount (manual and automatic)

mkfs.ext4 /dev/sdb1-format

  1. Manually mount
    mkdir /mnt-create
    mount /dev/hdd1 /mnt-mount
    df -hT-view
    Insert picture description here
    Insert picture description here
  2. Automatically mount
    vi /etc/fstab-enter
    /dev /sdb1- /mnt-ext4-defaults-0-0 (mount)
    wq-save
    mount -a-refresh
    reboot-restart
    df -hT——View (here we can see that /dev/sdb1 has been successfully mounted to /mnt automatically)
    Insert picture description here
    Insert picture description here

Guess you like

Origin blog.csdn.net/s15212790607/article/details/113685139