parted創(chuàng)建GPT分區(qū)(fdisk不支持創(chuàng)建GPT分區(qū)色徘,GPT支持大于2TB分區(qū),MBR不支持)
介紹2種分區(qū)表:
MBR分區(qū)表:(MBR含義:主引導(dǎo)記錄)
所支持的最大卷:2T (T; terabytes,1TB=1024GB)
對(duì)分區(qū)的設(shè)限:最多4個(gè)主分區(qū)或3個(gè)主分區(qū)加一個(gè)擴(kuò)展分區(qū)项贺。
GPT分區(qū)表:(GPT含義:GUID分區(qū)表)
支持最大卷:18EB,(E:exabytes,1EB=1024TB)
每個(gè)磁盤(pán)最多支持128個(gè)分區(qū)
所以如果要大于2TB的卷或分區(qū)就必須得用GPT分區(qū)表得糜。
Linux下fdisk工具不支持GPT敬扛,得使用另一個(gè)GNU發(fā)布的強(qiáng)大分區(qū)工具parted。
fdisk工具用的話(huà)朝抖,會(huì)有下面的警告信息:
# fdisk /dev/nvme0n1
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
下面是用parted工具對(duì)/dev/sda做GPT分區(qū)的過(guò)程:
# parted /dev/nvme0n1
GNU Parted 3.1
Using /dev/nvme0n1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
Warning: The existing disk label on /dev/nvme0n1 will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes
(parted) p
Model: Unknown (unknown)
Disk /dev/nvme0n1: 4001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
(parted) mkpart primary 0KB 4001GB
Warning: You requested a partition from 0.00B to 4001GB (sectors 0..7814037167).
The closest location we can manage is 17.4kB to 4001GB (sectors 34..7814037134).
Is this still acceptable to you?
Yes/No? Yes
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore
(parted) p
Model: Unknown (unknown)
Disk /dev/nvme0n1: 4001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17.4kB 4001GB 4001GB ext4 primary
(parted) q
Information: You may need to update /etc/fstab.
root@node01:/#fdisk -l
.....
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/nvme0n1: 4000.8 GB, 4000787030016 bytes, 7814037168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 3C3360DC-B16D-4644-97F5-DE051D620D9E
# Start End Size Type Name
1 34 7814037134 3.7T Microsoft basic primary
# mkfs.xfs -f /dev/nvme0n1p1
meta-data=/dev/nvme0n1p1 isize=512 agcount=4, agsize=244188660 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=976754637, imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=476930, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
# mkdir /data
# mount /dev/nvme0n1p1 /data
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 2.2T 0 disk
├─sda1 8:1 0 2M 0 part
├─sda2 8:2 0 1000M 0 part /boot
├─sda3 8:3 0 2.1T 0 part
│ └─centos-root 253:0 0 2.1T 0 lvm /
└─sda4 8:4 0 62.5G 0 part [SWAP]
sr0 11:0 1 1024M 0 rom
nvme0n1 259:0 0 3.7T 0 disk
└─nvme0n1p1 259:1 0 3.7T 0 part /data
# vi /etc/fstab
...
/dev/nvme0n1p1 /data xfs defaults 1 2