Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jan 2024 10:45:21 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        "Rodney W. Grimes" <freebsd-rwg@gndrsh.dnsmgr.net>
Cc:        Ed Maste <emaste@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: Removing fdisk and bsdlabel (legacy partition tools)
Message-ID:  <CANCZdfpNNbFnjk59-aZWJt7YQuxuH%2BY8cx=kz5z828-4vWpXsg@mail.gmail.com>
In-Reply-To: <202401261617.40QGHH8e006266@gndrsh.dnsmgr.net>
References:  <CANCZdfp9a0SoZARRAj=6%2BnVAKHXrFcELWd6G9zxL0gVGr=x2Rg@mail.gmail.com> <202401261617.40QGHH8e006266@gndrsh.dnsmgr.net>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Fri, Jan 26, 2024 at 9:17 AM Rodney W. Grimes <
freebsd-rwg@gndrsh.dnsmgr.net> wrote:

> [ Charset UTF-8 unsupported, converting... ]
> > On Thu, Jan 25, 2024, 10:49?AM Rodney W. Grimes <
> > freebsd-rwg@gndrsh.dnsmgr.net> wrote:
> >
> > > > On Thu, Jan 25, 2024, 9:11?AM Ed Maste <emaste@freebsd.org> wrote:
> > > >
> > > > > On Thu, 25 Jan 2024 at 11:00, Rodney W. Grimes
> > > > > <freebsd-rwg@gndrsh.dnsmgr.net> wrote:
> > > > > >
> > > > > > > These will need to be addressed before actually removing any of
> > > these
> > > > > > > binaries, of course.
> > > > > >
> > > > > > You seem to have missed /rescue.  Now think about that long
> > > > > > and hard, these tools classified as so important that they
> > > > > > are part of /rescue.  Again I can not stress enough how often
> > > > > > I turn to these tools in a repair mode situation.
> > > > >
> > > > > I haven't missed rescue, it is included in the work in progress I
> > > > > mentioned. Note that rescue has included gpart since 2007.
> > > > >
> > > >
> > > > What can fdisk and/or disklabel repair that gpart can't?
> > >
> > > As far as I know there is no way in gpart to get to the
> > > MBR cyl/hd/sec values, you can only get to the LBA start
> > > and end values:
> > >
> >
> > In the last 20 years when have you needed this?
>
> Last week, and probably about every other month for the last
> 30 years.
>

What. specifically did you need to change, for what hardware, etc?


> >
> > LBA start/end is all that's relevant these days. The CHS values are
> > completely ignored
> > by FreeBSD. We use packet mode in the boot loader since about Pentium
> 150MHz
> > or so.
>
> WORLD != FreeBSD, please STOP trying to assume that the users OF FreeBSD
> are ONLY using FreeBSD!!!!
>

Yes. And the world stopped using them too around that time, give or take 5
years.


> >
> > I did have to change these back in the day when we inferred what the CHS
> > geometry
> > was from the drive by looking at the MBR's partitions that you knew
> > (assumed really)
> > started on a cylinder value. This hasn't mattered in FreeBSD since sos
> > rewrote ata
> > the second time. DOS had to do these things because old-school MFM, RLL,
> etc
> > disks couldn't return their CHS, so DOS had to enshrine them in the MBR
> to
> > get
> > a hint (or have the drive type BIOS to just know). Since we use LBA
> > exclusively,
> > none of this matter to FreeBSD.
>
> WORLD != FreeBSD, and weither you like it or not your BIOS and CSM
> and UEFI are PROPBABLY reading those values and might even do a
> nice divide by zero for you should you write 0 in them.
>

Maybe rather than using all caps you could give a specific example. I've
not had to help anybody with CHS values in maybe 15 years, and even
then it was rare. In the prior 10 years to that I went from shipping product
where CHS had to be right, to shipping product where it didn't matter at
all on a set of SBCs that were lagging the industry by 5 years.

Also, UEFI doesn't care: It has no CHS APIs. It's all LBA. The only places
in the
standard where 'Cylinder' is mentioned is the (now obsolete) name for
fields in
a ATA packet that now mean different parts of the LBA for modern commands.


> >
> > I've certainly never needed to tweak these in single user mode on an
> > emergency
> > basis. Why? Because you can't get to single user mode because the kernel
> > won't
> > even load if you have these wrong. So either you are booting some rescue
> > disk
> > to fix that (in which case you can craft it for your special
> environment).,
> > or you are
>
> rescue disk == any FreeBSD install media from the last 20 years.
> your REALLY stuck in a small box Warner, please think outside
> that box.   You keep repeating FreeBSD FreeBSD FreeBSD, I have to
> inform you many of us who USE FreeBSD also USE other stuff, but
> we prefer to have FreeBSD be our goto system for this type of work.
>

Yes. I understand that. And with the packages installed, you still can
do that.


> > creating a special thing in multi-user, so you can install  For all these
> > use cases, fdisk
> > as a port is fine.
>
> I really do not want to have to maintain my own distribution.
>

And the project can no longer support programs that have buffer overflows
and other dangerous behavior when presented with untrusted information
from the disks that matters only to a few users.


> >
> > sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
> > >     start 63, size 8388513 (4095 Meg), flag 80 (active)
> > >         beg: cyl 0/ head 1/ sector 1;
> > >         end: cyl 1023/ head 15/ sector 63
> > >
> > > gpart show ada0
> > > =>     63  8388545  ada0  MBR  (4.0G)
> > >        63  8388513     1  freebsd  [active]  (4.0G)
> > >   8388576       32        - free -  (16K)
> > >
> > > Now I have learned that gpart backup/restore CAN get me
> > > at least basic bsdlabel -e function, but again it has
> > > no access to all the stuff stored that showsup with
> > > bsdlabel -A.  Which this is now the third time I have
> > > asked "how do I do bsdlabel -A -e with gpart"?  One
> > > person at least answered that with:
> > > gpart backup GEOM >backup
> > > vi backup
> > > gpart restore GEOM
> > >
> >
> > OK Let's look at these extra fields:
> >
> > # /dev/md0:
> > type: unknown
> > disk: amnesiac
> > label:
> > flags:
> > bytes/sector: 512
> > sectors/track: 63
> > tracks/cylinder: 255
> > sectors/cylinder: 16065
> > cylinders: 130
> > sectors/unit: 2097152
> > rpm: 3600
> > interleave: 1
> > trackskew: 0
> > cylinderskew: 0
> > headswitch: 0 # milliseconds
> > track-to-track seek: 0 # milliseconds
> > drivedata: 0
> >
> > type isn't used at all in FreeBSD.
> > disk is for /etc/disktab, something we've not really needed since
> FreeBSD 3
> > or so.
> > label can be set with gpart add/modify -l.
> > I've never used flags. Can't speak to that.
> > bytes/sector: This is a physical property of the drive, not the label.
> You
> > can find it with gpart list:
> >    % gpart list md0
> >    ....
> >    Consumers:
> >    1. Name: md0
> >       Mediasize: 1073741824 (1.0G)
> >       Sectorsize: 512
> > The rest of this/that are reported or you can do math:
> >     fwheads: 255 <- tracks/cylinder
> >     fwsectors: 63 <-- sectors/track
> >     last: 2097151 <-- sectors/unit - 1
> > now, cylenders and sectors/cylinder you can compute. geom does this for
> > reading/writing disk labels.
> > rpm is hard coded to 3600 these days. FreeBSD doesn't care.
> > The rest are for interleaving, which FreeBSD doesn't do, so we don't
> care.
> >
> > So you can influence the values, but they aren't used for anything by
> > FreeBSD
> > that matters.
> >
> > What if you need them for something else? Then just use the disklabel
> port.
> > You'll never need to hack them tn single user mode, so you can use the
> port
> > for all use cases.
>
> Booting a FreeBSD install image is the use case, you seem to not
> realize people do use that for "RESCUE".


FreeBSD 14 CD images will exist online for ~forever.

Warner

[-- Attachment #2 --]
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 26, 2024 at 9:17 AM Rodney W. Grimes &lt;<a href="mailto:freebsd-rwg@gndrsh.dnsmgr.net">freebsd-rwg@gndrsh.dnsmgr.net</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">[ Charset UTF-8 unsupported, converting... ]<br>
&gt; On Thu, Jan 25, 2024, 10:49?AM Rodney W. Grimes &lt;<br>
&gt; <a href="mailto:freebsd-rwg@gndrsh.dnsmgr.net" target="_blank">freebsd-rwg@gndrsh.dnsmgr.net</a>&gt; wrote:<br>
&gt; <br>
&gt; &gt; &gt; On Thu, Jan 25, 2024, 9:11?AM Ed Maste &lt;<a href="mailto:emaste@freebsd.org" target="_blank">emaste@freebsd.org</a>&gt; wrote:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; On Thu, 25 Jan 2024 at 11:00, Rodney W. Grimes<br>
&gt; &gt; &gt; &gt; &lt;<a href="mailto:freebsd-rwg@gndrsh.dnsmgr.net" target="_blank">freebsd-rwg@gndrsh.dnsmgr.net</a>&gt; wrote:<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt; These will need to be addressed before actually removing any of<br>
&gt; &gt; these<br>
&gt; &gt; &gt; &gt; &gt; &gt; binaries, of course.<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; You seem to have missed /rescue.  Now think about that long<br>
&gt; &gt; &gt; &gt; &gt; and hard, these tools classified as so important that they<br>
&gt; &gt; &gt; &gt; &gt; are part of /rescue.  Again I can not stress enough how often<br>
&gt; &gt; &gt; &gt; &gt; I turn to these tools in a repair mode situation.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; I haven&#39;t missed rescue, it is included in the work in progress I<br>
&gt; &gt; &gt; &gt; mentioned. Note that rescue has included gpart since 2007.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; What can fdisk and/or disklabel repair that gpart can&#39;t?<br>
&gt; &gt;<br>
&gt; &gt; As far as I know there is no way in gpart to get to the<br>
&gt; &gt; MBR cyl/hd/sec values, you can only get to the LBA start<br>
&gt; &gt; and end values:<br>
&gt; &gt;<br>
&gt; <br>
&gt; In the last 20 years when have you needed this?<br>
<br>
Last week, and probably about every other month for the last<br>
30 years.<br></blockquote><div><br></div><div>What. specifically did you need to change, for what hardware, etc?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
&gt; <br>
&gt; LBA start/end is all that&#39;s relevant these days. The CHS values are<br>
&gt; completely ignored<br>
&gt; by FreeBSD. We use packet mode in the boot loader since about Pentium 150MHz<br>
&gt; or so.<br>
<br>
WORLD != FreeBSD, please STOP trying to assume that the users OF FreeBSD<br>
are ONLY using FreeBSD!!!!<br></blockquote><div><br></div><div>Yes. And the world stopped using them too around that time, give or take 5 years.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
&gt; <br>
&gt; I did have to change these back in the day when we inferred what the CHS<br>
&gt; geometry<br>
&gt; was from the drive by looking at the MBR&#39;s partitions that you knew<br>
&gt; (assumed really)<br>
&gt; started on a cylinder value. This hasn&#39;t mattered in FreeBSD since sos<br>
&gt; rewrote ata<br>
&gt; the second time. DOS had to do these things because old-school MFM, RLL, etc<br>
&gt; disks couldn&#39;t return their CHS, so DOS had to enshrine them in the MBR to<br>
&gt; get<br>
&gt; a hint (or have the drive type BIOS to just know). Since we use LBA<br>
&gt; exclusively,<br>
&gt; none of this matter to FreeBSD.<br>
<br>
WORLD != FreeBSD, and weither you like it or not your BIOS and CSM<br>
and UEFI are PROPBABLY reading those values and might even do a<br>
nice divide by zero for you should you write 0 in them.<br></blockquote><div><br></div><div>Maybe rather than using all caps you could give a specific example. I&#39;ve</div><div>not had to help anybody with CHS values in maybe 15 years, and even</div><div>then it was rare. In the prior 10 years to that I went from shipping product</div><div>where CHS had to be right, to shipping product where it didn&#39;t matter at</div><div>all on a set of SBCs that were lagging the industry by 5 years.</div><div><br></div><div>Also, UEFI doesn&#39;t care: It has no CHS APIs. It&#39;s all LBA. The only places in the</div><div>standard where &#39;Cylinder&#39; is mentioned is the (now obsolete) name for fields in</div><div>a ATA packet that now mean different parts of the LBA for modern commands.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
&gt; <br>
&gt; I&#39;ve certainly never needed to tweak these in single user mode on an<br>
&gt; emergency<br>
&gt; basis. Why? Because you can&#39;t get to single user mode because the kernel<br>
&gt; won&#39;t<br>
&gt; even load if you have these wrong. So either you are booting some rescue<br>
&gt; disk<br>
&gt; to fix that (in which case you can craft it for your special environment).,<br>
&gt; or you are<br>
<br>
rescue disk == any FreeBSD install media from the last 20 years.<br>
your REALLY stuck in a small box Warner, please think outside<br>
that box.   You keep repeating FreeBSD FreeBSD FreeBSD, I have to<br>
inform you many of us who USE FreeBSD also USE other stuff, but<br>
we prefer to have FreeBSD be our goto system for this type of work.<br></blockquote><div><br></div><div>Yes. I understand that. And with the packages installed, you still can</div><div>do that.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
&gt; creating a special thing in multi-user, so you can install  For all these<br>
&gt; use cases, fdisk<br>
&gt; as a port is fine.<br>
<br>
I really do not want to have to maintain my own distribution.<br></blockquote><div><br></div><div>And the project can no longer support programs that have buffer overflows</div><div>and other dangerous behavior when presented with untrusted information</div><div>from the disks that matters only to a few users.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
&gt; <br>
&gt; sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)<br>
&gt; &gt;     start 63, size 8388513 (4095 Meg), flag 80 (active)<br>
&gt; &gt;         beg: cyl 0/ head 1/ sector 1;<br>
&gt; &gt;         end: cyl 1023/ head 15/ sector 63<br>
&gt; &gt;<br>
&gt; &gt; gpart show ada0<br>
&gt; &gt; =&gt;     63  8388545  ada0  MBR  (4.0G)<br>
&gt; &gt;        63  8388513     1  freebsd  [active]  (4.0G)<br>
&gt; &gt;   8388576       32        - free -  (16K)<br>
&gt; &gt;<br>
&gt; &gt; Now I have learned that gpart backup/restore CAN get me<br>
&gt; &gt; at least basic bsdlabel -e function, but again it has<br>
&gt; &gt; no access to all the stuff stored that showsup with<br>
&gt; &gt; bsdlabel -A.  Which this is now the third time I have<br>
&gt; &gt; asked &quot;how do I do bsdlabel -A -e with gpart&quot;?  One<br>
&gt; &gt; person at least answered that with:<br>
&gt; &gt; gpart backup GEOM &gt;backup<br>
&gt; &gt; vi backup<br>
&gt; &gt; gpart restore GEOM<br>
&gt; &gt;<br>
&gt; <br>
&gt; OK Let&#39;s look at these extra fields:<br>
&gt; <br>
&gt; # /dev/md0:<br>
&gt; type: unknown<br>
&gt; disk: amnesiac<br>
&gt; label:<br>
&gt; flags:<br>
&gt; bytes/sector: 512<br>
&gt; sectors/track: 63<br>
&gt; tracks/cylinder: 255<br>
&gt; sectors/cylinder: 16065<br>
&gt; cylinders: 130<br>
&gt; sectors/unit: 2097152<br>
&gt; rpm: 3600<br>
&gt; interleave: 1<br>
&gt; trackskew: 0<br>
&gt; cylinderskew: 0<br>
&gt; headswitch: 0 # milliseconds<br>
&gt; track-to-track seek: 0 # milliseconds<br>
&gt; drivedata: 0<br>
&gt; <br>
&gt; type isn&#39;t used at all in FreeBSD.<br>
&gt; disk is for /etc/disktab, something we&#39;ve not really needed since FreeBSD 3<br>
&gt; or so.<br>
&gt; label can be set with gpart add/modify -l.<br>
&gt; I&#39;ve never used flags. Can&#39;t speak to that.<br>
&gt; bytes/sector: This is a physical property of the drive, not the label.  You<br>
&gt; can find it with gpart list:<br>
&gt;    % gpart list md0<br>
&gt;    ....<br>
&gt;    Consumers:<br>
&gt;    1. Name: md0<br>
&gt;       Mediasize: 1073741824 (1.0G)<br>
&gt;       Sectorsize: 512<br>
&gt; The rest of this/that are reported or you can do math:<br>
&gt;     fwheads: 255 &lt;- tracks/cylinder<br>
&gt;     fwsectors: 63 &lt;-- sectors/track<br>
&gt;     last: 2097151 &lt;-- sectors/unit - 1<br>
&gt; now, cylenders and sectors/cylinder you can compute. geom does this for<br>
&gt; reading/writing disk labels.<br>
&gt; rpm is hard coded to 3600 these days. FreeBSD doesn&#39;t care.<br>
&gt; The rest are for interleaving, which FreeBSD doesn&#39;t do, so we don&#39;t care.<br>
&gt; <br>
&gt; So you can influence the values, but they aren&#39;t used for anything by<br>
&gt; FreeBSD<br>
&gt; that matters.<br>
&gt; <br>
&gt; What if you need them for something else? Then just use the disklabel port.<br>
&gt; You&#39;ll never need to hack them tn single user mode, so you can use the port<br>
&gt; for all use cases.<br>
<br>
Booting a FreeBSD install image is the use case, you seem to not<br>
realize people do use that for &quot;RESCUE&quot;.</blockquote><div><br></div><div>FreeBSD 14 CD images will exist online for ~forever.</div><div><br></div><div>Warner </div></div></div>

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfpNNbFnjk59-aZWJt7YQuxuH%2BY8cx=kz5z828-4vWpXsg>