1

sfdisk (version 2.23.2) on CentOS 7.6 is not showing the correct partition information about a disk:

Disk /dev/sdb: 15566 cylinders, 255 heads, 63 sectors/track
Units: cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1   *      0+  15566-  15567- 125034839+  ee  GPT .
sfdisk:         start: (c,h,s) expected (0,0,2) found (0,0,1)

/dev/sdb2          0       -       0          0    0  Empty
/dev/sdb3          0       -       0          0    0  Empty
/dev/sdb4          0       -       0          0    0  Empty

When I run fdisk it returns the correct (but different information):

Disk /dev/sdb: 128.0 GB, 128035676160 bytes, 250069680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
#         Start          End    Size  Type            Name
 1         2048         4095      1M  BIOS boot       
 2         4096      1028095    500M  Linux RAID      
 3      1028096      1437695    200M  Linux RAID      
 4      1437696    250068991  118.6G  Linux RAID 

Anyone know what the cause (and hopefully solution) of this is?

dwagon
  • 111
  • 2
    For GPT-labelled disks, sfdisk needs to be 2.26 or newer. https://unix.stackexchange.com/questions/12986/how-to-copy-the-partition-layout-of-a-whole-disk-using-standard-tools/12988#12988 – Mark Plotnick Aug 02 '19 at 03:07
  • 1
    maybe you can try sgdisk. – Skaperen Aug 02 '19 at 04:34
  • I call it a quality defect that the latest version of CentOS in 2019 ships a version of fdisk that doesn't support GPT disks. – Johan Myréen Aug 02 '19 at 05:52
  • It isn't so much that it fails - but that it lies. If it just bombed out it would be easier to understand. – dwagon Aug 02 '19 at 08:40
  • GPT is the one that's lying. GPT here is providing a Protective MBR. It has a single partition of type ee and a range that spans the entire disk. It's there just to indicate the disk isn't empty. sfdisk is reporting what it sees in the MBR as accurately as it can. – Mark Plotnick Aug 03 '19 at 01:23
  • @MarkPlotnick Though, even if I can't update... I can still mount the things correctly. It just won't be automatic and I won't have any information on what /dev/sdk2 means. At least fdisk -l was able to see the correct drive size, despite seeing no partitions. – Ray Foss Jan 03 '20 at 17:04

0 Answers0