# zpool gives only 3GB instead of 2.7TB



## dvl@ (Mar 20, 2013)

I am setting up to run some tests on FreeBSD 9.1 with ZFS.

I'm blocked by this series of command which results in a 3GB zpool, instead of an expected 2.7TB zpool.

Here are the commands:


```
[root@floater:~] # gpart create -s GPT ada1
ada1 created

[root@floater:~] # gpart add -a 1m -t freebsd-zfs -l Bay1.ada1 ada1
ada1p1 added

[root@floater:~] # gnop create -S 4k gpt/Bay1.ada1

[root@floater:~] # zpool create -f  -m /mnt examplecluster   /dev/gpt/Bay1.ada1.nop

[root@floater:~] # # df -h examplecluster
Filesystem        Size    Used   Avail Capacity  Mounted on
examplecluster    3.7G    144k    3.7G     0%    /mnt
[root@floater:~] # 

[root@floater:~] # gpart show ada1
=>        34  5860533101  ada1  GPT  (2.7T)
          34        2014        - free -  (1M)
        2048  5860530176     1  freebsd-zfs  (2.7T)
  5860532224         911        - free -  (455k)
```


I'm sure this is something simple that I'm overlooking.

FWIW, /mnt is empty before and after this process.


----------



## dvl@ (Mar 20, 2013)

FWIW, this seems to a problem related to this one drive.  I tried the same thing on ada5, all good.


----------



## dvl@ (Mar 20, 2013)

Is this relevant?


```
$ ls -l /dev/gpt/
total 0
crw-r-----  1 root  operator  0x90 Mar 20 18:00 Bay1.ada1
```


----------



## wblock@ (Mar 20, 2013)

That's just the GPT label you created.


----------



## dvl@ (Mar 20, 2013)

wblock@ said:
			
		

> That's just the GPT label you created.



Noted.  But it's hanging around after cleaning everything up.


----------



## wblock@ (Mar 20, 2013)

It will remain until that partition is deleted.


----------



## dvl@ (Mar 20, 2013)

The partition has been deleted.


```
[dan@floater:~/bin/benchmarks] $ gpart show ada1
=>        34  5860533101  ada1  GPT  (2.7T)
          34  5860533101        - free -  (2.7T)

[dan@floater:~/bin/benchmarks] $ ls -l /dev/gpt/
total 0
crw-r-----  1 root  operator  0x90 Mar 20 18:00 Bay1.ada1
[dan@floater:~/bin/benchmarks] $
```


----------



## wblock@ (Mar 20, 2013)

Hmm.  Try
`# true > /dev/ada1`


----------



## dvl@ (Mar 20, 2013)

```
root@floater:/home/dan/bin/benchmarks # true > /dev/ada1

root@floater:/home/dan/bin/benchmarks # ls -l /dev/gpt/
total 0
crw-r-----  1 root  operator  0x90 Mar 20 18:00 Bay1.ada1

root@floater:/home/dan/bin/benchmarks # gpart destroy ada1
ada1 destroyed

root@floater:/home/dan/bin/benchmarks # ls -l /dev/gpt/
total 0
crw-r-----  1 root  operator  0x90 Mar 20 18:00 Bay1.ada1
root@floater:/home/dan/bin/benchmarks #
```


----------



## Savagedlight (Mar 21, 2013)

Any chance it might be a mislabeled partition? Could try `# gpart show -l -p | grep Bay1` to find out.


----------



## dvl@ (Mar 21, 2013)

BINGO!  *ding* *ding* *ding*


```
# gpart show -l -p
=>       34  976773101    ada0  GPT  (465G)
         34         94  ada0p1  (null)  (47k)
        128         34          - free -  (17k)
        162    8388480  ada0p2  root  (4G)
    8388642   12582912  ada0p3  (null)  (6.0G)
   20971554   12582912  ada0p4  var  (6.0G)
   33554466   12582912  ada0p5  tmp  (6.0G)
   46137378  922746880  ada0p6  usr  (440G)
  968884258       2014          - free -  (1M)
  968886272    7886848  ada0p7  Bay1.ada1  (3.8G)
  976773120         15          - free -  (7.5k)
```

Now let's clean up:


```
# gpart delete -i 7 ada0
ada0p7 deleted
```

And try again:


```
gpart create -s GPT ada1
gpart add -a 1m -t freebsd-zfs -l Bay1.ada1 ada1
gnop create -S 4k gpt/Bay1.ada1
zpool create -f  -m /mnt examplecluster   /dev/gpt/Bay1.ada1.nop
df -h examplecluster
```

which gives:


```
# df -h examplecluster
Filesystem        Size    Used   Avail Capacity  Mounted on
examplecluster    2.7T    144k    2.7T     0%    /mnt
```

... as expected.

Now, how could I have figured this out earlier, say, without that `gpart show` command?


----------



## wblock@ (Mar 21, 2013)

gpart(8) ought to check for an existing GPT label before allowing it to be assigned again.  And that should have a flag to override it and assign the duplicate GPT label anyway, an "I know what I'm doing" option.


----------

