RFC: making gpart default

Peter Wemm peter at wemm.org
Fri Nov 28 20:28:45 PST 2008

On Thu, Sep 25, 2008 at 9:59 AM, Marcel Moolenaar <xcllnt at mac.com> wrote:
> All,
> I'd like to switch all architectures to gpart for the reasons given
> below. All current partitioning schemes are supported by gpart and
> work on all platforms. On top of that, ia64 and powerpc are using
> gpart exclusively already.
> In short: gpart is the first step towards a unified set of
> tools and interfaces and provides the basis for extending
> file system related tools by allowing us to attach real
> meaning to partition types. With the commit and undo feature,
> gpart is ready for use by next generation installers that
> allow us to use any partitioning scheme on any platforms.
> Thoughts?

oh my god.  I just tried to use gpart.  This needs some SERIOUS help.

First, the 'gpart create' man page doesn't say what "scheme" is.
After guessing, I tried:

overcee# gpart create -s gpt /dev/twed1
gpart: 22 scheme 'gpt'

What does that mean?  It turns out that I didn't have GEOM_PART_GPT compiled in.

After continuing the guessing game:

overcee# gpart create -s gpt /dev/twed1
gpart: 22 provider '/dev/twed1'

That was useful.  Out other tools generally allow /dev prefixes to be optional.

overcee# gpart create -s gpt twed1
twed1 created

Now what?  Boot code.. there's no example of this either.  I tried:

overcee# gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 twed1
gpart: /dev/twed1p1: Invalid argument

I suppose that beats "22".

This works though:
overcee# gpart bootcode -b /boot/pmbr  twed1

This doesn't:
overcee# gpart bootcode -p /boot/gptboot -i 1 twed1
gpart: /dev/twed1p1: Invalid argument
I haven't figured this out yet.  I'm guessing this is because
/boot/gptboot isn't a multiple of 512 bytes.  The error message is
obviously giving no help here.

Let's try padding it:
overcee# dd if=/boot/gptboot of=/tmp/gptboot conv=sync
14+1 records in
15+0 records out
7680 bytes transferred in 0.000098 secs (78375316 bytes/sec)
overcee# gpart bootcode -p /tmp/gptboot -i 1 twed1

Yep, that worked.  Now for a partition...

overcee# gpart add -b 512 -s 512m -t freebsd-ufs twed1
gpart: 22 size '512m'
Huh? "22"?

overcee# gpart add -b 512 -s 1048576 -t freebsd-ufs twed1
twed1p2 added

But at least I think I'm getting some progress:
overcee# gpart show twed1
=>       34  976771053  twed1  GPT  (500.1GB)
         34        478      1  freebsd-boot  (244.7KB)
        512    1048576      2  freebsd-ufs  (536.9MB)
    1049088  975721999         - free -  (499.6GB)

So I continue.. I figure gpart would pick the first free space:
overcee# gpart add -s 4058062 -t freebsd-ufs twed1
gpart: Option 'b' not specified.

Apparently not...
overcee# gpart add -b 1049088 -s 4058062 -t freebsd-ufs twed1
twed1p3 added

Now one has to do a gpart show ; add ; show ; add loop to get the start address.

This is really, really raw and unfriendly stuff.

Peter Wemm - peter at wemm.org; peter at FreeBSD.org; peter at yahoo-inc.com; KI6FJV
"All of this is for nothing if we don't go to the stars" - JMS/B5
"If Java had true garbage collection, most programs would delete
themselves upon execution." -- Robert Sewell

More information about the freebsd-arch mailing list