ZFS and glabel

Ivailo A. Tanusheff ITanusheff at postbank.bg
Mon Nov 17 12:57:28 UTC 2014


Dear all,

I run to an interesting issue and I would like to discuss it with all of you.
The whole thing began with me trying to identify available HDD to include in a zfs pool through a script/program. 
I assumed that the easiest way of doing this is using glabel. For example:

root at FreeBSD:~ # glabel status
                                      Name  Status  Components
gptid/248e758c-e267-11e3-95bb-08002796202b     N/A  ada0p1
           diskid/DISK-VBdd471206-91164057     N/A  ada5
           diskid/DISK-VBe98b5e75-0d8cf6dc     N/A  ada8
           diskid/DISK-VB7d006584-01beca12     N/A  ada6
           diskid/DISK-VB721029c3-66a60156     N/A  ada7
           diskid/DISK-VB31481dbb-639540a1     N/A  ada2
           diskid/DISK-VB95921208-4eb19f41     N/A  ada4

So far it is OK and if I create pool like zpool create xxx ada4 then the line for ada4 will disappear from the glabel status.
As far as I remember though it is not recommended to use production pools based on the device naming, so I wanted to switch to gpt lable, i.e.  diskid/DISK-VB95921208-4eb19f41.
When I recreate pool like:
zpool create xxx           diskid/DISK-VB95921208-4eb19f41    the pool is created without problems, but the device does not disappear from the glabel status list, thus making my program running wrong.
Is this a problem with the zfs implementation, my server or the general idea is wrong?

BTW, if I label the disk additionally, like: 
glabel create VB95921208-4eb19f41 ada4
zpool create xxx label/VB95921208-4eb19f41

The glabel status again shows the right information. The problem with the latest approach is that if someone executes:
glabel destroy -f VB95921208-4eb19f41

The result becomes:
pool: xxx
 state: UNAVAIL
status: One or more devices are faulted in response to IO failures.
action: Make sure the affected devices are connected, then run 'zpool clear'.
   see: http://illumos.org/msg/ZFS-8000-HC
  scan: none requested
config:

        NAME                   STATE     READ WRITE CKSUM
        xxx                    UNAVAIL      0     0     0
          6968348230421469155  REMOVED      0     0     0  was /dev/label/VB95921208-4eb19f41

And the data is practically unrecoverable.

So my questions are:
- Is there a way to make glabel to show the right data when I use diskid/DISK-VB95921208-4eb19f41     
- Which is the most proper way of creating vdevs - with disk name (ada4), diskid (diskid/DISK-VB95921208-4eb19f41) or manual labeling? 
- How may I found which disks are free, if the diskid approach is the best solution?


Regards,

Ivailo Tanusheff

Disclaimer:

This communication is confidential. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this communication by mistake, please notify us immediately by responding to this email and then delete it from your system.
Eurobank Bulgaria AD is not responsible for, nor endorses, any opinion, recommendation, conclusion, solicitation, offer or agreement or any information contained in this communication.
Eurobank Bulgaria AD cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. If you suspect that the message may have been intercepted or amended, please call the sender.


More information about the freebsd-fs mailing list