Install gdisk
, an fdisk
-style tool for GUID Partition Tables (GPT)
# yum -y install gdisk
Observe tool's version
[root@ /]# gdisk
GPT fdisk (gdisk) version 0.8.10
Type device filename, or press <Enter> to exit:
Examine the storage device list
Note device xvda
has 10G capacity; partition xvda1
uses only 6G
[root@ /]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 10G 0 disk
└─xvda1 202:1 0 6G 0 part /
xvdb 202:16 0 75G 0 disk /mnt
xvdc 202:32 0 75G 0 disk /data0
xvdd 202:48 0 50G 0 disk
Create GUID Partition Table (GPT) map for partition xvda1
[root@ /]# gdisk /dev/xvda1
GPT fdisk (gdisk) version 0.8.10
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Use ? to list available commands
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
p - print the partition table to get the GUID
Command (? for help): p
Disk /dev/xvda1: 12582912 sectors, 6.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): BA7F7199-B97B-4A68-858C-10D82D732633
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 12582878
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
Command (? for help): q
Run gdisk
again to pick up new GPT entry
[root@ /]# gdisk /dev/xvda
GPT fdisk (gdisk) version 0.8.10
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): p
Disk /dev/xvda: 20971520 sectors, 10.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 0B62AD67-7BC0-452B-B7D7-9932C0E922EE
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 20971486
Partitions will be aligned on 2048-sector boundaries
Total free space is 8388541 sectors (4.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 12584959 6.0 GiB EF00
o - create a new empty GUID partition table (GPT)
Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y
n - add a new partition
Command (? for help): n
Partition number (1-128, default 1):
First sector (34-20971486, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-20971486, default = 20971486) 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'
t - change a partition's type code
Command (? for help): t
Using 1
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): EF00
Changed type of partition to 'EFI System'
x - extra functionality (experts only)
Command (? for help): x
g - Identify partition by GUID
The value entered is copied from output above
Expert command (? for help): g
Enter the disk's unique GUID ('R' to randomize): 0B62AD67-7BC0-452B-B7D7-9932C0E922EE
The new disk GUID is 0B62AD67-7BC0-452B-B7D7-9932C0E922EE
w - write table to disk and exit
Expert 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/xvda.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.
Since we've modified the root volume, we must reboot for the new partition table to take effect
[root@ /]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 6061632 5730976 16084 100% /
tmpfs 15405056 0 15405056 0% /dev/shm
/dev/xvdb 77398536 14761528 58705388 21% /mnt
/dev/xvdc 77398536 184216 73282700 1% /data0
cm_processes 15405056 2584 15402472 1% /mnt/var/run/cloudera-scm-agent/process
[root@ /]# reboot
Broadcast message from [email protected]
(/dev/pts/1) at 15:21 ...
Hi Thanks