https://jingyan.baidu.com/article/5225f26b4d8e15e6fa090882.html
parted创建GPT分区(fdisk不支持创建GPT分区,GPT支持大于2TB分区,MBR不支持)
2种分区结构简介
MBR分区
硬盘主引导记录MBR由4个部分组成
主引导程序(偏移地址0000H–0088H),它负责从活动分区中装载,并运行系统引导程序。
出错信息数据区,偏移地址0089H–00E1H为出错信息,00E2H–01BDH全为0字节。
分区表(DPT,Disk Partition Table)含4个分区项,偏移地
址01BEH–01FDH,每个分区表项长16个字节,共64字节为分区项1、分区项2、分区项3、分区项4
结束标志字,偏移地址01FE–01FF的2个字节值为结束标志55AA
GPT分区
GPT:GUID(Globals Unique Identifiers) partitiontable 支持128个分区,使用64位,支持8Z(512Byte/block )64Z ( 4096Byte/block)
使用128位UUID(Universally Unique Identifier) 表示磁盘和分区 GPT分区表自动备份在头和尾两份,并有CRC校验位
UEFI (统一扩展固件接口)硬件支持GPT,使操作系统启动
介绍2种分区表:
MBR分区表:(MBR含义:主引导记录)
所支持的最大卷:2T (T; terabytes,1TB=1024GB)
对分区的设限:最多4个主分区或3个主分区加一个扩展分区。
GPT分区表:(GPT含义:GUID分区表)
支持最大卷:18EB,(E:exabytes,1EB=1024TB)
每个磁盘最多支持128个分区
所以如果要大于2TB的卷或分区就必须得用GPT分区表。
Linux下fdisk工具不支持GPT,得使用另一个GNU发布的强大分区工具parted。
fdisk工具用的话,会有下面的警告信息:
WARNING: GPT (GUID Partition Table) detected on ‘/dev/sda’! The util fdisk doesn’t support GPT. Use GNU Parted.
parted工具对/dev/sda做GPT分区的过程:
parted /dev/sdb # 使用parted来对GPT磁盘操作,进入交互式模式
GNU Parted 1.8.1 Using /dev/sdb Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) mklabel gpt # 将MBR磁盘格式化为GPT
(parted) print #打印当前分区
(parted) mkpart primary 0 5TB # 分一个5T的主分区
(parted) mkpart primary 5TB 12TB # 分一个8T的主分区
(parted) print #打印当前分区
(parted) quit 退出
Information: Don’t forget to update /etc/fstab, if necessary.
操作实例:
root@node01:/mnt# parted /dev/sda
GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
Warning: The existing disk label on /dev/sda will be destroyed
and all data on this disk will be lost. Do you want to continue? Yes/No?
yes
(parted) print
Model: DELL PERC 6/i Adapter (scsi) Disk /dev/sda:
500GB Sector size (logical/physical): 512B/512B
Partition Table: gpt Number Start End Size File system Name Flags
(parted)mkpart primary 0KB 500GB
Warning: You requested a partition from 0.00B to 500GB.
The closest location we can manage is 17.4kB to 500GB.
Is this still acceptable to you? Yes/No?
yes
Warning: The resulting partition is not properly
aligned for best performance. Ignore/Cancel?
Ignore
(parted) print
Model: DELL PERC 6/i Adapter (scsi) Disk /dev/sda:
500GB Sector size (logical/physical): 512B/512B
Partition Table:
gpt Number Start End Size File system Name Flags
1 17.4kB 500GB 500GB primary
(parted)quit
Information: You may need to update /etc/fstab.
root@node01:/#fdisk -l
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'!
The util fdisk doesn't support GPT.
Use GNU Parted.
Disk /dev/sda: 499.6 GB, 499558383616 bytes 255 heads,
63 sectors/track, 60734 cylinders Units = cylinders
of 16065 * 512 = 8225280 bytes Sector size (logical/physical):
512 bytes / 512 bytes I/O size (minimum/optimal):
512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sda1 1 60735 487849983+ ee GPT