Re: Removing fdisk and bsdlabel (legacy partition tools)

From: Miroslav Lachman <000.fbsd_at_quip.cz>
Date: Thu, 25 Jan 2024 09:57:57 UTC
On 25/01/2024 06:50, Cy Schubert wrote:
> In message <CANCZdfq+F1iFpUkDEYdcxPJfp96Ymz8KjBGaK_JNN1i09s7P=A@mail.gmail.c


>>
>> What can they do that gpart can't do?
> 
> This was quite a while ago, booted off my recovery USB attempting to repair
> some self caused damage. The ability to edit (vi) a file with starting
> addresses and lengths, visually using bsdlabel, was suited to my panicked
> state as I worked to recover the machine.
> 
> A visual view of columns of a bsdlabel, editing a label using vi, checking
> and double checking numbers before committing them is handy.The visual
> format and the ability to adjust the numbers in an editor before committing
> them is handy. You can't do this with gpart, as it's transactional. And
> bsdinstall doesn't give one the opportunity to check the numbers in detail
> on a console before committing them.

If you really like your editor of choice to edit partition table, you 
can use gpart backup and gpart restore like this:

gpart backup ada0 > ada0.part
vi ada0.part
gpart restore -F -l < ada0.part

> Maybe a good GSoC project may be to replace bsdlabel's driect writes to
> disk with geom calls. Though, t doesn't need to be bsdlabel, but some kind
> of utility that displays the existing label in an editor session where
> changes can be made, using the editor, and committed. This could even be an
> enhancement to bsdinstall: call it expert mode or whatever.

Manipulating partition table in editor session can be achieved by few 
lines of shell script as a wrapper around gpart backup & gpart restore.

Kind regards
Miroslav Lachman