kern/162342: FreeBSD hides gpt labels after mounting ZFS partitions

Jeff Lawson jeff at bovine.net
Mon Nov 7 00:10:11 UTC 2011


>Number:         162342
>Category:       kern
>Synopsis:       FreeBSD hides gpt labels after mounting ZFS partitions
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 07 00:10:10 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Jeff Lawson
>Release:        8.2-RELEASE-p2
>Organization:
>Environment:
FreeBSD mfsbsd 8.2-RELEASE-p2 FreeBSD 8.2-RELEASE-p2 #3 r222557M: Thu Jun 16 23:58:02 CEST 2011     root at neo.vx.sk:/usr/obj/releng_8_2/sys/GENERIC  amd64

>Description:
If you use "gpart" to create a GPT disk with partitions that have gpt labels defined, then those labels are normally visible in /dev/gpt/

However, once any of those partitions are used by a ZFS pool that is imported, the label disappears from /dev/gpt/

After you stop using that ZFS pool with "zpool export", the missing labels do not reappear in /dev/gpt/ until you reboot.  The GUID entries in /dev/gptid/ are fine and do not disappear after importing the ZFS pool.


This forum thread from 5 months ago is about another user that has experienced similar frustration by this problem. (He ended up with a workaround of using the older style "glabel" which creates labels under /dev/label instead of relying on the GPT-specific labels):  http://forums.freebsd.org/showthread.php?t=24695

>How-To-Repeat:
The tutorial at this wiki page describes using "gpart add -l" to define labels and create an environment that replicates this problem:
http://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/Mirror

In particular, this command will create a GPT partition with a label:
Fixit# gpart add -s 60G -t freebsd-zfs -l disk0 ad0


Here is some actual output from my own system:

mfsbsd# ls -l /dev/gpt
total 0
crw-r-----  1 root  operator    0,  87 Nov  6 17:50 data0
crw-r-----  1 root  operator    0,  94 Nov  6 17:50 data1
crw-r-----  1 root  operator    0,  89 Nov  6 17:50 swap0
crw-r-----  1 root  operator    0,  92 Nov  6 17:50 swap1

(labels are present, as they should be)


mfsbsd# mkdir /zroot
mfsbsd# zpool import -R /zroot zroot
mfsbsd# ls -l /dev/gpt
total 0
crw-r-----  1 root  operator    0,  89 Nov  6 17:50 swap0
crw-r-----  1 root  operator    0,  92 Nov  6 17:50 swap1

(labels have disappeared after importing the ZFS pool)


mfsbsd# uname -a
FreeBSD mfsbsd 8.2-RELEASE-p2 FreeBSD 8.2-RELEASE-p2 #3 r222557M: Thu Jun 16 23:58:02 CEST 2011     

root at neo.vx.sk:/usr/obj/releng_8_2/sys/GENERIC  amd64
mfsbsd#


mfsbsd# gpart list | egrep 'Name|label'
1. Name: ad2p1
   label: (null)
2. Name: ad2p2
   label: data0               <----
3. Name: ad2p3
   label: swap0
1. Name: ad2
1. Name: ad3p1
   label: (null)
2. Name: ad3p2
   label: data1               <----
3. Name: ad3p3
   label: (null)
1. Name: ad3

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list