Enter gdisk /dev/sdb at the shell prompt. If you’re comfortable using fdisk, then the process of using gdisk will be a snap for you because many of the commands are the same. At the gdisk prompt, you can enter ? to view a list of commands available. This is shown in the following example:
openSUSE:~ # gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.7
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Command (? for help): ?
. b back up GPT data to a file
.
. c change a partition's name
.
. d delete a partition
.
i show detailed information on a partition
l list known partition types
. n add a new partition
.
. o create a new empty GUID partition table (GPT)
.
. p print the partition table
.
. q quit without saving changes
.
. r recovery and transformation options (experts only)
.
. s sort partitions
.
. t change a partition's type code
.
. v verify disk
. w write table to disk and exit
.
. x extra functionality (experts only)
.
? print this menu
Command (? for help):
In this situation, I want to add a new partition to the disk, so I would enter n at the gdisk prompt. When I do, I’m prompted to specify the following:
• The partition number
• The size of the partition This can be done by specifying the beginning and ending sectors of the partition. You can also specify where on the disk you want the partition to start and end (such as at the 10GB and 20GB points on the disk).
• The type of partition The partition type numbers with gdisk are different from those used with MBR partitions. For example, to create a Linux partition, you use a partition type of 8300. You can press L at the gdisk prompt to view a list of all possible partition types and their codes.
This process is shown in the following example: Command (? for help): p
This process is shown in the following example: Command (? for help): p
• Disk /dev/sdb: 33554432 sectors, 16.0 GiB
•
Logical sector size: 512 bytes
Disk identifier (GUID): 1D3E9F48-D822-4DDF-AB94-C59B7A4E12C8
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 33554398
Partitions will be aligned on 2048-sector boundaries
Total free space is 12582845 sectors (6.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 20973567 10.0 GiB 8300 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.
Once this is done, you can enter p at the gdisk prompt to view a list of the partitions on the disk. As with fdisk, the changes you make with gdisk are not actually committed to disk until you write them. If you like the changes you made to the disk partitioning, press w at the gdisk prompt. If you want to delete a partition, press d. If you want to change a partition’s type, press t and then enter the partition type code you want to use. If you want to quit and start over without saving any changes, press q instead.
No comments:
Post a Comment