gdisk -l [ equipment ]

gdisk Also called GPT fdisk, Count as fdisk Let's extend it , The main use is GPT Partition type , It's used to divide a system with a capacity greater than 2T The hard disk of .

Expand 1: Partition type GPT and MBR.GPT The biggest support 18EB(1EB=1024PB,1PB=1024TB),MBR The biggest support 2TB.

Expand 2( understand ):GPT, Globally unique identification partition table (GUID Partition Table), It USES 128 position GUID To uniquely identify each disk and partition . And MBR There is a single point of failure ,GPT Provides redundancy of partition table information , One in the head of the disk , One at the end of the disk ; It passes through CRC Check to detect GPT Errors and corruption in header and partition tables . By default, a hard disk supports 128 Zones ( Can be more ).

(1). Options

only one -l Options , List all partition tables of a disk

(2). Operation menu description

Mainly used in a few and fdisk almost :n、p、q、w.

The complete menu is as follows :

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

b take GPT Back up the data to a file

c Change the partition name

d Delete a partition

i Show partition details

l List known partition types . here 8200 yes Linux swap,8300 yes Linux filesystem( Corresponding fdisk Of 82 and 83). One more 8e00 yes Linux LVM

n Add a new partition

o Create a new blank GPT Partition table

p Displays the partition table of the current disk

q sign out gdisk Program , Don't save any changes

r Recovery and conversion options ( Experts only )

s Sort partitions

t Change the type of partition

v Verify the partition table

w Write the partition table to the referee and exit ( Save and exit )

x Extra functions ( Experts only )

? Display help information

Expand :Liunx LVM(Linux Logical volume management ), Put multiple hard disks ( Physical disk ) And hard disk partition ( Physical zoning ) Make a logical volume , Manage the volume as a whole , Dynamically expand and shrink the size of the partition , Safe, fast and convenient management .

(3). example

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

[[email protected] ~]# gdisk /dev/sdb

GPT fdisk (gdisk) version 0.8.10

 

Partition table scan:

  MBR: MBR only

  BSD: not present

  APM: not present

  GPT: not present

 

***************************************************************

Found invalid GPT and valid MBR; converting MBR to GPT format

in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by

typing 'q' if you don't want to convert your MBR partitions

to GPT format!

***************************************************************

 

 

Command (? for help): p // Displays the partition table of the current disk

Disk /dev/sdb: 4194304 sectors, 2.0 GiB

Logical sector size: 512 bytes

Disk identifier (GUID): 4E50861F-8360-4B97-986E-51F4080BF678

Partition table holds up to 128 entries

First usable sector is 34, last usable sector is 4194270

Partitions will be aligned on 2048-sector boundaries

Total free space is 2097085 sectors (1024.0 MiB)

 

Number  Start (sector)    End (sector)  Size       Code  Name

   1            2048         2099199   1024.0 MiB  8300  Linux filesystem

 

Command (? for help): d // Delete a partition

Using 1

 

Command (? for help): n // Create a new partition

Partition number (1-128, default 1):

First sector (34-4194270, default = 2048) or {+-}size{KMGTP}:  // Starting Sector

Last sector (2048-4194270, default = 4194270) or {+-}size{KMGTP}: +1G // Termination sector

Current type is 'Linux filesystem'

Hex code or GUID (L to show codes, Enter = 8300): // Partition type

Changed type of partition to 'Linux filesystem'

 

Command (? for help): w // Save and exit

 

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING

PARTITIONS!!

 

Do you want to proceed? (Y/N): y // Confirm coverage

OK; writing new GUID partition table (GPT) to /dev/sdb.

Warning: The kernel is still using the old partition table.

The new table will be used at the next reboot. // The prompt will take effect after the next restart

The operation has completed successfully.

forehead , It doesn't seem to be necessary . The format that should be formatted later (mkfs.xfs, Before that, pay attention to whether it is mounted , The mount needs to be unloaded and reformatted ), The mount of the mount .