我前段時間在一個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分區