# Recreating a ZFS partition



## jn (Mar 2, 2012)

I am about to replace a drive that shows ZFS checksum errors but can not remember how I partitioned the drive before. A working drive in the pool looks like this:

```
# gpart show ada2
=>        34  3907029101  ada2  GPT  (1.8T)
          34  3907029101     1  freebsd-zfs  (1.8T)
```
I tried this to partion the new drive but the result is not like the drive above:

```
# gpart create -s gpt ada4
# gpart add -t freebsd-zfs -l disk6 ada4
# gpart show ada4
=>        34  3907029101  ada4  GPT  (1.8T)
          34           6        - free -  (3.0k)
          40  3907029088     1  freebsd-zfs  (1.8T)
  3907029128           7        - free -  (3.5k)
```
How can I partition the new drive ada4 without getting small free unused blocks, similar to ada2?
Otherwise, will there be any problems using the created gpt/disk6 in the raidz1 pool due to the missing 3+3.5K?


----------



## SirDice (Mar 2, 2012)

Try this:
`# gpart add -t freebsd-zfs -b 34 -l disk6 ada4`


----------



## jn (Mar 2, 2012)

No luck with that:

```
# gpart destroy -F ada4
ada4 destroyed
# gpart create -s gpt ada4
ada4 created
# gpart add -t freebsd-zfs -b 34 -l disk6 ada4
ada4p1 added
# gpart show ada4
=>        34  3907029101  ada4  GPT  (1.8T)
          34           6        - free -  (3.0k)
          40  3907029088     1  freebsd-zfs  (1.8T)
  3907029128           7        - free -  (3.5k)
```


----------



## jn (Mar 2, 2012)

Instead I tried this

```
# gpart backup ada2 | gpart restore -F ada4
# gpart modify -i 1 -l disk6 ada4
# gpart show -l ada4
=>        34  3907029101  ada4  GPT  (1.8T)
          34  3907029101     1  disk6  (1.8T)
```
It did not create the device /dev/gpt/disk6 directly but after a reboot it was there. Learning how to create the partition from scratch would still be nice if you have an idea.


----------

