AHCI driver and static device names

CyberLeo Kitsana cyberleo at cyberleo.net
Sat Dec 3 17:04:37 UTC 2011


On 12/03/2011 10:04 AM, Rob wrote:
> glabel looks to place a label on the whole disk, but the manpage is
> unclear (to me) how the partitions are handled.  If I use glabel to
> label a disk "test" and this disk has 4 partitions on it, then how is
> each partition accessed?  testp1...testp4 for gpt?

Ideally, you would label the partitions according to their usage. glabel
will automatically create labels for GPT partitions based on the GPT
'label' field; likewise for UFS, MSDOS, and ISO9660 filesystems.

For example, one of my (few remaining non-ZFS) machines looks like this:

----8<----
/dev/iso9660/root on / (cd9660, local, read-only)
/dev/ufs/boot on /boot (ufs, local, read-only)
/dev/ufs/conf on /conf (ufs, local, read-only, soft-updates)
----8<----

The root filesystem on this machine is actually mounted off a
uzip-compressed iso image on a BSD partition burned to some flash; but
the unimportant details are hidden behind the label, which just presents
a plain filesystem.

It doesn't really matter where these filesystems are: they can be moved
to completely different disks with wildly different partition schemes,
or even to iscsi- or ggate-imported disks, and the system will find them
perfectly by their labels.

This works for ZFS as well: since there's no guarantee where these disks
will show up, and the ZFS code will not be able to find them across
reboots if their names change, labels are useful for assigning static
names to the partitions or slices that make up a pool:

----8<----
  pool: amani
 state: ONLINE
 scrub: none requested
config:

	NAME              STATE     READ WRITE CKSUM
	amani             ONLINE       0     0     0
	  mirror          ONLINE       0     0     0
	    gpt/amani/r0  ONLINE       0     0     0
	    gpt/amani/r1  ONLINE       0     0     0
----8<----

To answer your question, though: You cannot combine GPT with glabel (or
any other geom class that writes data to the first or last 34 sectors of
a disk, like gmirror) due to layout conflicts. MBR and BSD schemes can
be used, since they occupy only the first sectors of the device, and
their monikers will be appended to the label. Thus, labeling a
single-slice MBR disk (/dev/ada0) with 'test' would produce /dev/ada0,
/dev/ada0s1, /dev/label/test, and /dev/label/tests1; nesting a BSD table
within s1 would add /dev/ada0s1a and /dev/label/tests1a as well.

> The other option seems to be to use tunefs or a partitioning tool to
> label each partition, which is even more ugly imo.

Ugly how? Labels appear a lot more semantically elegant than the opaque
'ada4s1a' moniker.

-- 
Fuzzy love,
-CyberLeo
Technical Administrator
CyberLeo.Net Webhosting
http://www.CyberLeo.Net
<CyberLeo at CyberLeo.Net>

Furry Peace! - http://wwww.fur.com/peace/


More information about the freebsd-questions mailing list