Using glabel

Warren Block wblock at wonkity.com
Sun Jan 13 15:30:48 UTC 2013


On Sun, 13 Jan 2013, kpneal at pobox.com wrote:

>> 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).
>
> Don't use glabel pretty much ever. It stores the label inside the
> partition (or disk). If the end of the partition is ever touched then
> the label goes *poof*. Stick to gpt labels.

If you label a partition, the label device will be one block smaller in 
size.  The metadata is hidden and safe, as long as it is accessed 
through the label device.

   # diskinfo -v /dev/da0p1
   /dev/da0p1
 	512         	# sectorsize
 	512000      	# mediasize in bytes (500k)
 	1000        	# mediasize in sectors

   # glabel label teeny /dev/da0p1
   # diskinfo -v /dev/label/teeny
   /dev/label/teeny
 	512         	# sectorsize
 	511488      	# mediasize in bytes (499k)
 	999         	# mediasize in sectors

Note the size in sectors.  The problem is that sometimes people don't 
realize that the label device (/dev/label/teeny) is offering those extra 
features and will continue to use the raw partition in newfs commands 
and such.

Anyway, GPT labels are still preferable to glabel because they can be 
created at the same time as partitions and don't use any extra metadata.

ZFS has its own metadata, and newer versions are supposed to leave the 
last megabyte or so unused to allow for actual versus nominal disk 
sizes.  I'm not clear whether there's a good reason to use additional 
labels instead of just giving ZFS the whole disk.  Unless you aren't 
planning on using the whole disk for ZFS, of course.


More information about the freebsd-fs mailing list