Using glabel

Paul Schenkeveld freebsd at psconsult.nl
Sat Jan 12 20:00:49 UTC 2013


On Fri, Jan 11, 2013 at 09:13:33PM -0800, Tim Gustafson wrote:
> Hi,
> 
> We have a few servers with 45 disks each.  It gets a bit cumbersome at
> the moment to map a failed drive (reported via "zpool status") to a
> physical device.  The physical devices are labeled with serial
> numbers, and ZFS reports device nodes.  I was wondering if I could use
> "glabel" to label each of the disks we have with their serial number
> to make identification easier, and then reconfigure the zpool to
> import the drives by gptid, rather than device node.
> 
> So, my thinking was along the lines of:
> 
> - obtain the device serial numbers, probably using smartctl
> - zpool export tank
> - glabel -v SERIAL-NUMBER-0 /dev/ada0
> - glabel -v SERIAL-NUMBER-1 /dev/ada1
> - glabel -v SERIAL-NUMBER-2 /dev/ada2
> - snip 43 more glabel lines
> - zpool import tank -d /dev/gptid
> 
> Is there any reason that this is a bad idea?  Do I have the command
> sequence correct?

Using labels instead of auto-enumerated names (ada0, ada1 ...) is
generally a good idea I think and makes sysadmin life a bit easier.

You can use glabel to label your disks or partition the disks with gpart
(using the GPT scheme) and let gpt put a label on each (-l flag).

In the past I always used glabel for that but since I had disks fail
on me and found out that a replacement disk of the same capacity was
actually several sectors smaller than the original, I changed to using
gpart and allocate all but the few last MB of every disk so that if I
have to replace a broken disk by one which is a bit smaller it won't
give a problem.

Labels created using the -l option of gpart appear in /dev/gpt instead
of /dev/label but that should be no problem.  ZFS finds the labelled
partitions first, even without using the -d flag.

HTH

Paul Schenkeveld


More information about the freebsd-fs mailing list