From nobody Fri Jan 26 17:45:21 2024 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TM4q30JRhz58XFZ for ; Fri, 26 Jan 2024 17:45:35 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TM4q25SGcz4vGm for ; Fri, 26 Jan 2024 17:45:34 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-55cdaa96f34so3947824a12.1 for ; Fri, 26 Jan 2024 09:45:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1706291133; x=1706895933; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=jCgKsxumiJd43BqED4YRyuqUjsvJQ4y+cGRo0z00GKs=; b=08aVsxznS7gW+bAkUfRJvvNsOVRHxbpqYlL+cT3PZsAcAzgDpl0Olh1pQ1ZOBJfXBP wzOeIGU3rw9fkhGQPX5Z8ChNDzmWnOtf2V8IMmdqoaTqei/T83C5ybmyDwSR2duhZp1J 0IQ4qdLE1Sz5dPddDrOAYHYYY01OK503MiLhXQ8xKvIEYAcKukyBxCWXc0TCeWalDUAH yi3vFAFx3T+vn8HsRZRXhbo9CDgMM2rTfMdZcPsrUfd61Bl/KdOqAYkTKA5kvB2cCBB7 oeZuqzk/cP8OZDtdTS8E9IC+lw/gYznbKkmqMusjyR1poezgY081Kg3lT7q9eptjt+R3 ptGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706291133; x=1706895933; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jCgKsxumiJd43BqED4YRyuqUjsvJQ4y+cGRo0z00GKs=; b=WQm4qurYPQHjq0w7IpCIlzKWNCFj53o8BGKStCwLLQFTKdewsYZQtl85GQRN7JenDM oR1dmYr148pEoBeK8SCKieTzMWbGRKb+scwZfOlJYXK+dKeUgm/8NKztN5I/IB83vhzw rD4WNd/sM74y1DTIZ27hjkkWX5AJ6WWDQkmc0sk2C6HXm+/24zh4isMIjZ7iN5CSZwqm N3ff8vsu9xSIkgzh78bG2o2apXCkdgxIvMN/V0cC250SfMRy18vHockvUEbNCetfnNQs lmfUgLwHzPb/xvESBlzhx3xpET/xXMG6/Y5i/vdGqVoReR9pBudLRerdISOE4+aXV2Fs BBGg== X-Gm-Message-State: AOJu0YzFMZcTrw3geqwv/GJnD0l6NosD8DkjVWgFmTODLYfSv0e7hMQD OdrEL5RqiuQ9PzKyI8QlFIkeNJcDXAT1z3XYhCCeRY/CB3zMx3NcxKsWiFkIy0ileo+mfIK5aXU +Aq41tAXzhupYF0I1OzrkwHX1DtXA6W07/sfq3gNrppHVfFhQXpc= X-Google-Smtp-Source: AGHT+IE7Nt4/pFTEAGPyInMXjpSCfpjrd2KHT8ouXdJHCzUPS7RvhpsppihDqnWH+9+7b3S2h56Q4R22ymT8w3A3ogY= X-Received: by 2002:aa7:c559:0:b0:55c:864e:790d with SMTP id s25-20020aa7c559000000b0055c864e790dmr273087edr.10.1706291133299; Fri, 26 Jan 2024 09:45:33 -0800 (PST) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 References: <202401261617.40QGHH8e006266@gndrsh.dnsmgr.net> In-Reply-To: <202401261617.40QGHH8e006266@gndrsh.dnsmgr.net> From: Warner Losh Date: Fri, 26 Jan 2024 10:45:21 -0700 Message-ID: Subject: Re: Removing fdisk and bsdlabel (legacy partition tools) To: "Rodney W. Grimes" Cc: Ed Maste , FreeBSD Current Content-Type: multipart/alternative; boundary="000000000000e24bb3060fdcdc7e" X-Rspamd-Queue-Id: 4TM4q25SGcz4vGm X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] --000000000000e24bb3060fdcdc7e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jan 26, 2024 at 9:17=E2=80=AFAM 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 wrote: > > > > > > > > > On Thu, 25 Jan 2024 at 11:00, Rodney W. Grimes > > > > > 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 !=3D FreeBSD, please STOP trying to assume that the users OF FreeBS= D > 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 CH= S > > 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 !=3D 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 produc= t 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 kerne= l > > won't > > even load if you have these wrong. So either you are booting some rescu= e > > disk > > to fix that (in which case you can craft it for your special > environment)., > > or you are > > rescue disk =3D=3D 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 the= se > > 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 > > > =3D> 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 --000000000000e24bb3060fdcdc7e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Fri, Jan 26, 2024 at 9:17=E2=80=AF= AM Rodney W. Grimes <fr= eebsd-rwg@gndrsh.dnsmgr.net> wrote:
[ Charset UTF-8 unsupported, converting... ]
> On Thu, Jan 25, 2024, 10:49?AM Rodney W. Grimes <
> fre= ebsd-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 actual= ly removing any of
> > these
> > > > > > binaries, of course.
> > > > >
> > > > > You seem to have missed /rescue.=C2=A0 Now think a= bout that long
> > > > > and hard, these tools classified as so important t= hat they
> > > > > are part of /rescue.=C2=A0 Again I can not stress = enough how often
> > > > > I turn to these tools in a repair mode situation.<= br> > > > >
> > > > I haven't missed rescue, it is included in the work= in progress I
> > > > mentioned. Note that rescue has included gpart since 20= 07.
> > > >
> > >
> > > 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 ne= ed to change, for what hardware, etc?
=C2=A0
>
> LBA start/end is all that's relevant these days. The CHS values ar= e
> completely ignored
> by FreeBSD. We use packet mode in the boot loader since about Pentium = 150MHz
> or so.

WORLD !=3D FreeBSD, please STOP trying to assume that the users OF FreeBSD<= br> are ONLY using FreeBSD!!!!

Yes. And the= world stopped using them too around that time, give or take 5 years.
=
=C2=A0
>
> I did have to change these back in the day when we inferred what the C= HS
> geometry
> was from the drive by looking at the MBR's partitions that you kne= w
> (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, RL= L, etc
> disks couldn't return their CHS, so DOS had to enshrine them in th= e 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 !=3D 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 may= be 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 s= hipping product where it didn't matter at
all on a set of SBC= s that were lagging the industry by 5 years.

Also,= UEFI doesn't care: It has no CHS APIs. It's all LBA. The only plac= es in the
standard where 'Cylinder' is mentioned is the (= now obsolete) name for fields in
a ATA packet that now mean diffe= rent parts of the LBA for modern commands.
=C2=A0
>
> 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 resc= ue
> disk
> to fix that (in which case you can craft it for your special environme= nt).,
> or you are

rescue disk =3D=3D any FreeBSD install media from the last 20 years.
your REALLY stuck in a small box Warner, please think outside
that box.=C2=A0 =C2=A0You 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.
=C2=A0
> creating a special thing in multi-user, so you can install=C2=A0 For a= ll 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.
=C2=A0
>
> sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
> >=C2=A0 =C2=A0 =C2=A0start 63, size 8388513 (4095 Meg), flag 80 (ac= tive)
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0beg: cyl 0/ head 1/ sector 1; > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0end: cyl 1023/ head 15/ sector 6= 3
> >
> > gpart show ada0
> > =3D>=C2=A0 =C2=A0 =C2=A063=C2=A0 8388545=C2=A0 ada0=C2=A0 MBR= =C2=A0 (4.0G)
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 63=C2=A0 8388513=C2=A0 =C2=A0 =C2=A01= =C2=A0 freebsd=C2=A0 [active]=C2=A0 (4.0G)
> >=C2=A0 =C2=A08388576=C2=A0 =C2=A0 =C2=A0 =C2=A032=C2=A0 =C2=A0 =C2= =A0 =C2=A0 - free -=C2=A0 (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.=C2=A0 Which this is now the third time I have
> > asked "how do I do bsdlabel -A -e with gpart"?=C2=A0 On= e
> > 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.= =C2=A0 You
> can find it with gpart list:
>=C2=A0 =C2=A0 % gpart list md0
>=C2=A0 =C2=A0 ....
>=C2=A0 =C2=A0 Consumers:
>=C2=A0 =C2=A0 1. Name: md0
>=C2=A0 =C2=A0 =C2=A0 =C2=A0Mediasize: 1073741824 (1.0G)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0Sectorsize: 512
> The rest of this/that are reported or you can do math:
>=C2=A0 =C2=A0 =C2=A0fwheads: 255 <- tracks/cylinder
>=C2=A0 =C2=A0 =C2=A0fwsectors: 63 <-- sectors/track
>=C2=A0 =C2=A0 =C2=A0last: 2097151 <-- sectors/unit - 1
> now, cylenders and sectors/cylinder you can compute. geom does this fo= r
> 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=C2=A0
--000000000000e24bb3060fdcdc7e--