我前段时间在一个20T的服务器进行分区,明明是20T,但是无论怎么分,都只有2T。
这是我就想到了Linux中MBR和GPT分区,而我们常用的fdisk命令是无法对进行GPT分区的,这时我们需要用到另一个分区工具gdisk
[root@localhost ~]# gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.6
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Command (? for help):
下面的一些操作和fdisk其实就是一样的啦
Command (? for help): n
Partition number (1-128, default 1):
First sector (34-419430366, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-419430366, default = 419430366) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.
然后就是写分区表,然后在格式化,然后在挂载
[root@localhost ~]# partprobe /dev/sdb # 写分区表
[root@localhost ~]# mkfs.xfs /dev/sdb1 # 格式化
meta-data=/dev/sdb1 isize=256 agcount=4, agsize=13107135 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=52428539, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal log bsize=4096 blocks=25599, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@localhost ~]# mount /dev/sdb1 /lewis # 挂载
然后验证sdb是否是GPT分区
下图sdb是GPT分区,sda是MBR分区