Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Sep 2012 12:12:41 -0700
From:      Jeff Anton <anton@hesiod.org>
To:        freebsd-hackers@freebsd.org
Subject:   gpart is junk
Message-ID:  <505624A9.7040508@hesiod.org>
In-Reply-To: <20120916120041.391C41065680@hub.freebsd.org>
References:  <20120916120041.391C41065680@hub.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
fdisk may be old, but it's a better utility.  Better documented, still 
referenced in the FreeBSD handbook...
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/install-steps.html

The fdisk -p and fdisk -f are vital functionality which are only 
reluctantly recognized with the backup and restore commands which didn't 
exist in the initial versions (read 7.4).  This is how the utility 
should have been thought about in the first place.
All partitioning work I do isn't one partition at a time, its about how 
everything fits together.  Consider from the 8.3 gpart man page the example:

=============
      Create an MBR scheme on ada0, then create a 30GB-sized FreeBSD slice,
      mark it active and install the boot0 boot manager:

            /sbin/gpart create -s MBR ada0
            /sbin/gpart add -t freebsd -s 30G ada0
            /sbin/gpart set -a active -i 1 ada0
            /sbin/gpart bootcode -b /boot/boot0 ada0

      Now create a BSD scheme (BSD label) with space for up to 20 
partitions:

            /sbin/gpart create -s BSD -n 20 ada0s1

      Create a 1GB-sized UFS partition and a 4GB-sized swap partition:

            /sbin/gpart add -t freebsd-ufs -s 1G ada0s1
            /sbin/gpart add -t freebsd-swap -s 4G ada0s1

      Install bootstrap code for the BSD label:

            /sbin/gpart bootcode -b /boot/boot ada0s1

==============

That all this work is broken down into eight different commands with all 
these options is very bad design.  I'll admit this is doing more that 
just what fdisk does, but my point is that all this information needs to 
be together in one human and machine readable form.  We need to be able 
to look at the whole picture of a device and say "that makes sense" then 
do it.  And this shouldn't be from some GUI junk either.
In a file, this information can be kept as a reference, as a 
confirmation that partitioning hasn't changed unexpectedly, and
modified if needed in a clear manner.

fdisk configuration files are very will documented and have no 
equivalent that I can tell from gpart.  Certainly there is no 
documentation that I've found about gpart which makes clear how I can 
edit a description of a partition scheme the way fdisk configuration 
files work.  The gpart backup/restore file format is not documented.

Also, when you do get problems, what does the kernel report...
Maybe:

GEOM: ad0s1: geometry does not match label (255h,63s != 1h,63s).

Does this say "gpart"? No.  Does this say partition? No.  What clues are 
there about how to fix this?  In the 7.4 geom man page there was no 
reference to gpart.

I still have 7.4 machines and the badness of geom is everywhere...

atlas.hesiod.org:root[30]: geom disk list
Geom name: ad0
Providers:
1. Name: ad0
    Mediasize: 250059350016 (233G)
    Sectorsize: 512
    Mode: r2w2e3
    fwsectors: 63
    fwheads: 16

Geom name: ad1
Providers:
1. Name: ad1
    Mediasize: 500107862016 (466G)
    Sectorsize: 512
    Mode: r1w1e3
    fwsectors: 63
    fwheads: 16

atlas.hesiod.org:root[32]: gpart show ad0
gpart: No such geom: ad0.

WTF!?  the disk list shows ad0 but the partition says whoa no such beast.

The whole geom system may be very important and may be the way to move 
forward.  But if it is so important, it's important to bring forward all 
the important functionality that we know from the past, i.e. fdisk and 
bsdlabel or their real useful equivalents well documented.

Jeff Anton




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?505624A9.7040508>