# FreeBSD 10 + ZFS + Advanced format



## ilemur (Jun 26, 2014)

Rebuilding my system and as well the RAIDZ. Have 4HDD's one of them is an advanced format drive. So after reading through all the how to's completed the following. Cleared all old labels with `glabel destroy` and `zpool labelclear` on al HDD's then `gpart destroy`. Created new GPT's: 
	
	



```
gpart create -s GPT daX
```
 X - stands for drives 5-8.

Then created partitions: `gpart add -t freebsd-zfs -l diskX -b 2048 -a 4k daX`, then gnop(): 
	
	



```
gnop create -S 4096 /dev/gpt/diskX
```
Then ran `zpool create storage raidz /dev/gpt/disk0.nop /dev/gpt/disk1.nop dev/gpt/disk2.nop dev/gpt/disk3.nop`. And finally `zpool export storage`

```
gnop destroy /dev/gpt/diskX.nop
```


```
zpool import storage
```

But all I get afterwards is this:


```
pool: storage
 state: ONLINE
status: One or more devices could not be used because the label is missing or
        invalid. Sufficient replicas exist for the pool to continue
        functioning in a degraded state.
action: Replace the device using 'zpool replace'.
   see: http://illumos.org/msg/ZFS-8000-4J
  scan: none requested
config:

        NAME STATE READ WRITE CKSUM
        istorage ONLINE 0 0 0
          raidz1-0 ONLINE 0 0 0
            gptid/5590aaa0-fc99-11e3-a329-000c29ff593d ONLINE 0 0 0
            gpt/disk1 ONLINE 0 0 0
            1309460414271469660 UNAVAIL 0 0 0 was /dev/diskid/DISK-%20%20%20%20%20%20ML0220F300BK7D
            gptid/66d2f780-fc99-11e3-a329-000c29ff593d ONLINE 0 0 0
```

Did I miss some steps?


----------



## wblock@ (Jun 26, 2014)

Only one gnop() device is needed.  ZFS will use the largest block size of the drives listed to set ashift when the pool is created.  It's not necessary to destroy that gnop() device, either, because it will go away on reboot.

Finally, since the whole drive is being used, GPT is not necessary.  You can just use the raw drives (da5, da6 ...), although it still needs the gnop() device.


----------



## phoenix (Jun 30, 2014)

On the first import after destroying the gnop devices, use `# zpool import -d /dev/gpt <poolname>`

That will force it to search/access the GPT labels device nodes first.

You should also add the following to /boot/loader.conf to get rid of the annoying and mostly useless GPTID device nodes:

```
kern.geom.label.gptid.enable="0"		# Disable the auto-generated GPT UUIDs for disks
kern.geom.label.ufsid.enable="0"		# Disable the auto-generated UFS UUIDs for filesystems
```

Finally, if you are going to use GPT and labels (excellent idea!), then you should create a single partition that covers the whole drive, and align it to 1M for improved performance:

```
# gpart create -s gpt daX
# gpart add -t freebsd-zfs -l diskY -a 1M daX
```


----------



## jkhilmer (Jul 1, 2014)

Maybe I'm paranoid, but I prefer to normalize all of my drives to present absolutely identical available space.  For a "4" TB, 4k native, 4k-presented disk:


```
gpart destroy -F $1
gpart create -s gpt $1
gpart add -t freebsd-zfs -b 256 -s 972554240 -a 4k $1
gnop create -S 4096 /dev/$1p1
```


----------

