Bug 1212507

Summary: sfdisk-disk-geometry fails to display the disk geometry from the partition
Product: [Community] Virtualization Tools Reporter: Hu Zhang <huzhan>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: jonathan, kzak, leiwang, ptoscano, rjones, virt-maint, wshi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hu Zhang 2015-04-16 14:29:19 UTC
Description of problem:
sfdisk-disk-geometry fails to display the disk geometry from the partition.

Version-Release number of selected component (if applicable):
kernel-4.0.0-0.rc1.git0.1.fc22.x86_64
libguestfs-1.29.33-1.fc22.x86_64

How reproducible:
Always

Steps to Reproduce:
1. guestfish -a $img
2. run
3. sfdisk-disk-geometry /dev/sda

Actual results:
libguestfs: error: sfdisk_disk_geometry: /dev/sda1: sfdisk: invalid option -- 'G'                                                                                           

Usage:                                                                                                                                                                      
 sfdisk [options] <dev> [[-N] <part>]                                                                                                                                       
 sfdisk [options] <command>
...

Expected results:
sfdisk-disk-geometry displays the disk geometry from the partition successfully.

Additional info:

Comment 1 Richard W.M. Jones 2015-04-16 14:59:30 UTC
Indeed the sfdisk -G option has disappeared in Rawhide.  So
actually this is a bug in sfdisk.

Comment 2 Karel Zak 2015-04-16 16:54:04 UTC
This is not a bug, but expected change. There is no reason to use CHS.

Comment 3 Karel Zak 2015-04-16 17:11:28 UTC
Maybe we can add --getgeo to blockdev to have command line interface to the ioctl.

Comment 4 Richard W.M. Jones 2015-04-16 17:58:25 UTC
I'm going to switch this back to libguestfs.

Obviously it's a completely useless API, and CHS has no real relevance
to anything (except maybe possibly bootloaders), but we should at least
find a way to emulate it.

Comment 5 Karel Zak 2015-04-23 10:56:12 UTC
I forgot one thing, the new sfdisk still supports 

   -g, --show-geometry

to print disk geometry as returned by kernel ioctl (so ignore my comment #3:-)

# sfdisk --show-geometry /dev/sda
/dev/sda: 29185 cylinders, 255 heads, 63 sectors/track


The original sfdisk also provided 

   -G, --show-pt-geometry

to guess the geometry from partition table. This is no more supported by new sfdisk. (Note that the result from kernel and from PT is usually the same.)