# How to locate GPTID for Disk to use with zpool?



## zennybsd (Aug 21, 2013)

I have drives like as follows where I would like to use ad0 and ad4 as a ZFS mirror pool and da1 for ZIL and L2ARC using GPTIDs instead of device names. da0 is my NanoBSD image:


```
geom disk list
Geom name: ad0
Providers:
1. Name: ad0
   Mediasize: 163928604672 (152G)
   Sectorsize: 512
   Mode: r0w0e0
   fwsectors: 63
   fwheads: 16

Geom name: ad4
Providers:
1. Name: ad4
   Mediasize: 160041885696 (149G)
   Sectorsize: 512
   Mode: r0w0e0
   fwsectors: 63
   fwheads: 16

Geom name: da0
Providers:
1. Name: da0
   Mediasize: 1038352384 (990M)
   Sectorsize: 512
   Mode: r2w2e7
   fwsectors: 32
   fwheads: 64

Geom name: da1
Providers:
1. Name: da1
   Mediasize: 67108864000 (62G)
   Sectorsize: 512
   Mode: r0w0e0
   fwsectors: 63
   fwheads: 255
```

But when I used the `glabel list` command, I only get the GPTIDs of mounted devices as follows:


```
glabel status
                  Name  Status  Components
                ufs/cf     N/A  da0s3
             ufs/nano0     N/A  da0s1a
ufsid/51e8b2d8fbdea238     N/A  da0s2a
             ufs/nano1     N/A  da0s2a
```

How can I discover /dev/gptid/xxx for /dev/ad0, /dev/ad4 and /dev/da1 for my zpool and cache/log to avoid future conflicts while relocating? 

Or is there an alternative way to handle the above situation using something other than GPTID for ZFS?! I heard that gpart with labels or cam works(*), but have no idea how to go about in this situation!

Any hints? Thanks in advance!

Ad (*): http://forums.freebsd.org/showthread.php?t=39410


----------



## J65nko (Aug 21, 2013)

Specifying a label with gpart(8) is a rather popular method.

```
[b]gpart[/b] add -t type [-a alignment] [-b start] [-s size] [-i index]
           [[color=blue]-l label[/color]] [-f flags] geom
```

From my mirrored 'ZFS madness' setup:

```
[cmd=#]ls -l /dev/gpt[/cmd]

crw-r-----  1 root  operator    0, 186 Aug  3 19:21 BOOT_1
crw-r-----  1 root  operator    0, 194 Aug  3 19:21 BOOT_2
crw-r-----  1 root  operator    0, 184 Aug  3 19:21 SYSTEM_1
crw-r-----  1 root  operator    0, 192 Aug  3 19:21 SYSTEM_2
```

See HOWTO: FreeBSD ZFS Madness or Root On ZFS @ FreeBSD 9


----------

