List partitions on a GPT partition table with the Linux command line.

I tried to list the partitions on a Windows machine using an Ubuntu Live CD and I got this error when trying to use fdisk to list the partitions.

[email protected]:~$ sudo fdisk -l /dev/sda
 
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
 
 
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
256 heads, 63 sectors/track, 121126 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x09021ba4
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

Fdisk will not let you list partitions on a GPT partition table. Instead, use GNU parted. This command will list all partitions in a GPT partition table on a Windows machine.

[email protected]:~$ sudo parted -l
Model: ATA ST1000DM003-1CH1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
 
Number  Start   End     Size   File system  Name                          Flags
 1      1049kB  316MB   315MB  ntfs         Basic data partition          hidden, diag
 2      316MB   420MB   105MB  fat32        EFI system partition          boot
 3      420MB   555MB   134MB               Microsoft reserved partition  msftres
 4      555MB   501GB   500GB  ntfs         Basic data partition
 5      501GB   1000GB  499GB  ntfs         Basic data partition
 
 
Model: Verbatim STORE N GO (scsi)
Disk /dev/sdb: 15.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
 
Number  Start   End     Size    Type     File system  Flags
 1      4129kB  15.5GB  15.5GB  primary  fat32        lba
 
 
Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0
has been opened read-only.
Error: Can't have a partition outside the disk!

This will list it as machine parseable output.

[email protected]:~$ sudo parted -l -m
BYT;
/dev/sda:1000GB:scsi:512:4096:gpt:ATA ST1000DM003-1CH1;
1:1049kB:316MB:315MB:ntfs:Basic data partition:hidden, diag;
2:316MB:420MB:105MB:fat32:EFI system partition:boot;
3:420MB:555MB:134MB::Microsoft reserved partition:msftres;
4:555MB:501GB:500GB:ntfs:Basic data partition:;
5:501GB:1000GB:499GB:ntfs:Basic data partition:;
 
BYT;
/dev/sdb:15.5GB:scsi:512:512:msdos:Verbatim STORE N GO;
1:4129kB:15.5GB:15.5GB:fat32::lba;
 
Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0
has been opened read-only.
Error: Can't have a partition outside the disk!

No comments have been made. Use this form to start the conversation :)

Leave a Reply