所以就要使用gdisk命令

gdisk用法

 

gdisk
InteractiveGUIDpartitiontable
(GPT)
manipulator

GPTfdisk (akagdisk) isatext-modemenu-drivenprogramforcreationandmanipulation

ofpartitiontables.

1
使用gdisk的原因

(1)由于fdisk命令无法很好的扶持GPT分区

[root@local ~]# fdisk /dev/sdb
WARNING: fdiskGPTsupportiscurrentlynew, andthereforeinanexperimentalphase. Useatyourowndiscretion.
Welcometofdisk (util-linux 2.23.2).


Changeswillremaininmemoryonly, untilyoudecidetowritethem.
Becarefulbeforeusingthewritecommand.
Command (mforhelp):

而MB悍马H2分区不扶持胜出2T的分区,全数对于当今打大巴硬盘分区来讲只可以选取GPT分区,所以就要选拔gdisk命令

(2)gdisk也得以管理MBOdyssey分区的硬盘,不管您硬盘多大,都不言而谕。

2
用gdisk对硬盘就能够分区,这里以vmware虚构机为例

(1)查看为分区以前的磁盘消息,这里以/dev/sdc为例

[root@local ~]# gdisk -l /dev/sdd
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.
Disk /dev/sdd: 10485760 sectors, 5.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 5ECA06B5-A105-4DCB-B6DD-96A13D0C1A93
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 10485726
Partitions will be aligned on 2048-sector boundaries
Total free space is 10485693 sectors (5.0 GiB)

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

自然也可用fdis命令查看

[root@local ~]# fdisk -l /dev/sdc
Disk /dev/sdc: 5368 MB, 5368709120 bytes, 10485760 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 

(2)gdisk命令对磁盘实行操作

[root@local ~]# gdisk /dev/sdc
GPTfdisk (gdisk) version 0.8.6

Partitiontablescan:
MBR: notpresent
BSD: notpresent
APM: notpresent
GPT: notpresent

CreatingnewGPTentries.

Command (? forhelp):

(3)依照提示,输入?拿到援救

Command (? forhelp): ?
b    backupGPTdatatoafile
c    changeapartition'sname
d    deleteapartition                    #删除分区
i    showdetailedinformationonapartition
l    listknownpartitiontypes            #列出分区类型
n    addanewpartition                    #添加新分区
o    createanewemptyGUIDpartitiontable (GPT)
p    printthepartitiontable                #打印分区列表
q    quitwithoutsavingchanges            #不保存退出
r    recoveryandtransformationoptions (expertsonly)
s    sortpartitions
t    changeapartition'stypecode        #修改分区类型
v    verifydisk
w    writetabletodiskandexit            #保存退出
x    extrafunctionality (expertsonly)
?    printthismenu 

(4)增多三个新分区

Command (? forhelp): n

Partitionnumber (1-128, default 1): 1         #输入分区编号,默认为1,因为是/dev/sdc硬盘的第一块分区。
Firstsector (34-10485726, default = 2048) or {+-}size{KMGTP}:         #输入扇区的开始位置,选择默认即可,也可手动指定。
Lastsector (2048-10485726, default = 10485726) or {+-}size{KMGTP}:+2G     #输入扇区的结束位置,当然一般都是指定磁盘大小,这里输入+2G表示新分区大小为2G。
Currenttypeis 'Linuxfilesystem'
HexcodeorGUID (Ltoshowcodes, Enter = 8300):        #指定文件系统,默认即可,分区完成后可以修改。

Changedtypeofpartitionto 'Linuxfilesystem' 

(5)查看分区后的分区列表

Command (? forhelp): p    #查看分区列表
Disk /dev/sdc: 10485760 sectors, 5.0 GiB
Logicalsectorsize: 512 bytes
Diskidentifier (GUID): 428D4D72-0C16-4AD6-80A3-7BCACED6F40C
Partitiontableholdsupto 128 entries
Firstusablesectoris 34, lastusablesectoris 10485726
Partitionswillbealignedon 2048-sectorboundaries
Totalfreespaceis 6291389 sectors (3.0 GiB)
NumberStart (sector) End (sector) SizeCodeName
1 2048 4196351 2.0 GiB 8300 Linuxfilesystem    #看到分区已经添加成功 

(6)保存分区并脱离

Command (? forhelp):w

Finalcheckscomplete. AbouttowriteGPTdata. THISWILLOVERWRITEEXISTING
PARTITIONS!!

Doyouwanttoproceed? (Y/N):    y
OK; writingnewGUIDpartitiontable (GPT) to /dev/sdc.
Theoperationhascompletedsuccessfully. 

可以看来分区以增加功成业就

3
成立文件系统

[root@local ~]# mkfs.xfs /dev/sdc1
meta-data=/dev/sdc1 isize=512 agcount=4, agsize=131072 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=524288, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0

到此分区、文件系统创制作而成功,通过挂载就足以应用磁盘了