On Sat, Jan 09, 1999 at 12:14:26AM -0500, Adam Di Carlo wrote:
> On Fri, 8 Jan 1999 18:36:48 +0100 (CET), Vincent Renardias <vincent@ldsol.com> said:
> > On Fri, 8 Jan 1999, Adam Di Carlo wrote:
> >> There are reports that cfdisk indeed does not do well on drives
> >> with no partition table yet created at all. This is different from
> >> just having no partitions. Although I'm not sure off the bat how
> >> to create this condition (I think you can use 'fmthard' in
> >> solaris).
>
> > Both fdisk and cfdisk accept the '-z' option with creates a new
> > empty partition table. Is this what you need?
>
> Hmm. Maybe. Does it create a new one unconditionally? Or should it
> be run as a fallback plan?
>
> Enrique, do you have any comments?
"cfdisk -z" wipes out your current partition table, so it should be used
with extreme care. I'm adding code to boot-floppies_2.1.5 to detect that
cfdisk has failed and offer to run cfdisk -z instead (with big warnings
and such).
The best solution would be to hack cfdisk to be more permissive with
broken partition tables (hint: cfdisk.c, lines 1307-1360).
Other usefull hack would be adding meaningful return values. As it goes
now, cfdisk only returns two values:
0 - Everything went fine
1 - Something went wrong
It would be better to have at least the following: (patch attached).
0 - No errors.
1 - Error at command line. [Wrong number of cylinders/heads/sectors,
unknown parameter... Basically, any exit() from main()].
2 - Hardware problems. [BAD_SEEK, BAD_READ, BAD_WRITE or BAD_OPEN].
3 - Couldn't get geometry. [BAD_GEOMETRY, that means
ioctl(fd, HDIO_GETGEO,...) failed, and no values supplied on the
command line].
4 - Wrong partition table. [BAD_PRIMARY or BAD_LOGICAL].
Of course, the more the better.
That way I can detect on dbootstrap that "cfdisk" failed because of a broken
partition table, and offer to run "cfdisk -z" only in that case.
Thanks,
--
Enrique Zanardi ezanardi@ull.es
Attachment:
cfdisk.diff.gz
Description: Binary data