Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1183236
Summary: | sfdisk: unssupported unit 'M' | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Richard W.M. Jones <rjones> |
Component: | util-linux | Assignee: | Karel Zak <kzak> |
Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | rawhide | CC: | jonathan, kzak |
Target Milestone: | --- | Keywords: | Reopened |
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2015-03-03 09:52:56 UTC | 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: | |||
Bug Depends On: | |||
Bug Blocks: | 910269 |
Description
Richard W.M. Jones
2015-01-17 14:21:27 UTC
(In reply to Richard W.M. Jones from comment #0) > Description of problem: > > libguestfs invokes sfdisk to get some partition information > from MBR partitions. Since about a month ago, we've started > to see this error: well, we have v2.26 in Fedora since last Friday :-) > sfdisk -uM /dev/sda > sfdisk: unssupported unit 'M' > > Version-Release number of selected component (if applicable): > > Broken in util-linux-2.26-0.2.fc22.x86_64 > (I'm not exactly clear when it worked, but recently) since v2.26, sfdisk supports -uS only. No cylinders, no megabytes are supported. The column SIZE is always in human readable {M,G,P...}iB units. Anyway, old version has no clue about another sector sizes than 512, so I guess the output has been wrong in some cases. The new version provides ability to specify output columns (e.g. -o DEVICE,START,END,SIZE) to make it more usable in scripts. I'll try improve -u to accept also 'M'. Hmm.. old "sfdisk -uM" prints also Start and End offsets in megabytes (rather than in sectors). I don't plan to support such crazy thing. It seems better to keep -uM unsupported at all than implement only fractional part of the original -uM functionality. I have added --bytes to fdisk and sfdisk to print SIZE column in bytes (we use the same for another tools,e.g. lsblk). Please, update your sfdisk call to not use -uM. BTW, for what purpose you call sfdisk? (In reply to Karel Zak from comment #2) > Hmm.. old "sfdisk -uM" prints also Start and End offsets in megabytes > (rather than in sectors). I don't plan to support such crazy thing. > > It seems better to keep -uM unsupported at all than implement only > fractional part of the original -uM functionality. > > I have added --bytes to fdisk and sfdisk to print SIZE column in bytes (we > use the same for another tools,e.g. lsblk). > > Please, update your sfdisk call to not use -uM. > > BTW, for what purpose you call sfdisk? It's to support a long-deprecated API: http://libguestfs.org/guestfs.3.html#guestfs_sfdiskm We don't drop deprecated APIs, and therefore would need to emulate the old behaviour, no matter how crazy it might have been. Looking more closely at the libguestfs code, we're not wanting this to print the partitions. We want it for creating partitions, which IMHO seems not crazy at all. ie. sfdisk -uM /dev/sda <<EOF ,127 128, EOF In fact, it seems quite a reasonable thing to do if you wanted a partition of size 128 MB. New sfdisk allows to specify size of the partition by {M,G,...}[iB] suffixes # sfdisk /dev/sdb <<EOF ,128M EOF of course if you want to specify Start/End sectors then you have to use sectors numbers without any suffix (but it's usually unnecessary -- the next partition starts after the previous by default). One of the reasons we deprecated guestfs_sfdiskM was it had a terrible API. In this case, it exposed the actual input of sfdisk as an API ... We live and learn. Now when I think about it ... I'll probably extend the parser used for sfdisk scripts to accept suffixes for Start/End sectors. It seems usable if you want to create gaps between partitions or you want to define a special offset for the first partition. Frankly, old sfdisk is unmaintained for very long time, it's useless for new disks etc. It's recommended to not use it. I hope the new sfdisk is more usable for humans, the nice advantage is that all is implemented in libfdisk (so for example scripts in sfdisk scripts is possible to use in cfdisk and fdisk too), and now we can maintain all the fdisk(s) together and share all the functionality. And finally it's not about MBR only, it supports GPT too. (and yes, I understand that this change is painful for users...) (In reply to Karel Zak from comment #6) > Now when I think about it ... I'll probably extend the parser used for > sfdisk scripts to accept suffixes for Start/End sectors. Implemented in v2.26 |