Disk Partition-gdisk usage, disk partition-gdisk

Source: Internet
Author: User

Disk Partition-gdisk usage, disk partition-gdisk

Gdisk usage

 

Gdisk-InteractiveGUIDpartitiontable (GPT) manipulator

GPTfdisk (akagdisk) isatext-modemenu-drivenprogramforcreationandmanipulation

Ofpartitiontables.

1. Reasons for using gdisk

(1) The fdisk command does not support GPT partitioning.

[root@local ~]# fdisk /dev/sdbWARNING: fdiskGPTsupportiscurrentlynew, andthereforeinanexperimentalphase. Useatyourowndiscretion.Welcometofdisk (util-linux 2.23.2).Changeswillremaininmemoryonly, untilyoudecidetowritethem.Becarefulbeforeusingthewritecommand.Command (mforhelp):

MBR partitions do not support partitions larger than 2 TB. For all hard disk partitions currently used, GPT partitions are only supported. Therefore, gdisk commands must be used.

(2) gdisk can also process hard disks in MBR partitions, no matter how large your hard disk is.

2. Use gdisk to partition the hard disk. Here we use vmwarevm as an example.

(1) view the disk information before partitioning. Here/dev/sdc is used as an example.

[root@local ~]# gdisk -l /dev/sddGPT fdisk (gdisk) version 0.8.6Partition table scan:MBR: not presentBSD: not presentAPM: not presentGPT: not presentCreating new GPT entries.Disk /dev/sdd: 10485760 sectors, 5.0 GiBLogical sector size: 512 bytesDisk identifier (GUID): 5ECA06B5-A105-4DCB-B6DD-96A13D0C1A93Partition table holds up to 128 entriesFirst usable sector is 34, last usable sector is 10485726Partitions will be aligned on 2048-sector boundariesTotal free space is 10485693 sectors (5.0 GiB)Number Start (sector) End (sector) Size Code Name

You can also use the fdis command to view

[root@local ~]# fdisk -l /dev/sdcDisk /dev/sdc: 5368 MB, 5368709120 bytes, 10485760 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes 

(2) perform operations on the disk using the gdisk command

[root@local ~]# gdisk /dev/sdcGPTfdisk (gdisk) version 0.8.6Partitiontablescan:MBR: notpresentBSD: notpresentAPM: notpresentGPT: notpresentCreatingnewGPTentries.Command (? forhelp):

(3) As prompted, enter? Get help

Command (? Forhelp ):? B backupGPTdatatoafilec changeapartition 'snamed deleteapartition # Delete partition I partition listknownpartitiontypes # list partition types n addanewpartition # Add new partition o partition (GPT) p printthepartitiontable # print partition list q: # exit r recoveryandtransformationoptions (expertsonly) s sortpartitionst changeapartition 'stypecode # modify partition type v verifydiskw writetabletodisk Andexit # Save and exit x extrafunctionality (expertsonly )? Printthismenu

(4) Add a new partition

Command (? Forhelp): nPartitionnumber (1-128, default 1): 1 # enter the partition number. The default value is 1 because it is the first partition of the/dev/sdc hard disk. Firstsector (34-10485726, default = 2048) or {+-} size {KMGTP}: # Start position of the input sector. Select the default value. You can also manually specify the value. Lastsector (2048-10485726, default = 10485726) or {+-} size {KMGTP}: + 2G # End position of the input sector. Of course, the disk size is usually specified, enter + 2 GB to indicate that the size of the new partition is 2 GB. Currenttypeis 'linuxfilesystem' HexcodeorGUID (Ltoshowcodes, Enter = 8300): # specify the file system. By default, the partition can be modified. Changedtypeofpartitionto 'linuxfilesystem'

(5) view the list of partitions after the partition

Command (? Forhelp): p # view the partition list Disk/dev/sdc: 10485760 sectors, 5.0 GiBLogicalsectorsize: 512 bytesDiskidentifier (GUID): Limit 128 entriesFirstusablesectoris 34, lastusablesectoris 10485726 Partitionswillbealignedon blocks 6291389 sectors (3.0 GiB) NumberStart (sector) End (sector) SizeCodeName1 2048 4196351 2.0 GiB 8300 Linuxfilesystem # check that the partition has been added successfully

(6) Save the partition and exit

Command (? forhelp):wFinalcheckscomplete. AbouttowriteGPTdata. THISWILLOVERWRITEEXISTINGPARTITIONS!!Doyouwanttoproceed? (Y/N):    yOK; writingnewGUIDpartitiontable (GPT) to /dev/sdc.Theoperationhascompletedsuccessfully. 

The partition is successfully added.

3. Create a File System

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

By now, the partition and file system have been created successfully, and the disk can be used through mounting.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.