Skip to content

Instantly share code, notes, and snippets.

@jvprosser
Created February 17, 2016 20:54
Show Gist options
  • Save jvprosser/f2fbcd70fffa0e1dd583 to your computer and use it in GitHub Desktop.
Save jvprosser/f2fbcd70fffa0e1dd583 to your computer and use it in GitHub Desktop.
yum -y install gdisk
[root@ip-10-137-110-123 /]# gdisk
GPT fdisk (gdisk) version 0.8.10
Type device filename, or press <Enter> to exit:
[root@ip-10-137-110-123 /]# LSBLK
-bash: LSBLK: command not found
[root@ip-10-137-110-123 /]# LSBLK
-bash: LSBLK: command not found
[root@ip-10-137-110-123 /]# 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
[root@ip-10-137-110-123 /]# 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.
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): i
No partitions
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): x
Expert command (? for help): exit
Relocating backup data structures to the end of the disk
Expert command (? for help): q
[root@ip-10-137-110-123 /]# 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
[root@ip-10-137-110-123 /]# 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
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): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y
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'
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): 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'
Command (? for help): x
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
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.
[root@ip-10-137-110-123 /]# 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@ip-10-137-110-123 /]# reboot
Broadcast message from [email protected]
(/dev/pts/1) at 15:21 ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment