Posted: . At: 3:32 PM. This was 8 years ago. Post ID: 9375
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.

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.

ubuntu@ubuntu:~$ 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.

ubuntu@ubuntu:~$ 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.

ubuntu@ubuntu:~$ 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!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.