# ZFS cannot remove log: no such device in pool



## Boeri (May 23, 2011)

I'm running FreeBSD bsd 9.0-CURRENT with v28 ZFS pool 


```
pool: tank
 state: ONLINE
 scan: none requested
config:

        NAME                  STATE     READ WRITE CKSUM
        tank                  ONLINE       0     0     0
          mirror-0            ONLINE       0     0     0
            label/disk1       ONLINE       0     0     0
            label/disk2       ONLINE       0     0     0
          mirror-1            ONLINE       0     0     0
            label/disk3       ONLINE       0     0     0
            label/disk4       ONLINE       0     0     0
          mirror-2            ONLINE       0     0     0
            label/disk5       ONLINE       0     0     0
            label/disk6       ONLINE       0     0     0
          mirror-3            ONLINE       0     0     0
            label/disk7       ONLINE       0     0     0
            label/disk8       ONLINE       0     0     0
          mirror-4            ONLINE       0     0     0
            label/disk9       ONLINE       0     0     0
            label/disk10      ONLINE       0     0     0
          mirror-5            ONLINE       0     0     0
            label/disk11      ONLINE       0     0     0
            label/disk12      ONLINE       0     0     0
          mirror-6            ONLINE       0     0     0
            label/disk13      ONLINE       0     0     0
            label/disk14      ONLINE       0     0     0
        logs
          label/label/disk15  ONLINE       0     0     0
        cache
          label/label/disk16  ONLINE       0     0     0

errors: No known data errors
```
When I try to remove the log device, I get the following error message.


```
[root@bsd ~]# zpool remove tank log label/label/disk15
cannot remove log: no such device in pool
```

I can't run any zpool or zfs command after running the zpool remove command. 
I even can't kill the process, I think because the diskwait 'D+' state

```
2740   0  D+     0:00.08  zpool remove tank log label/label/disk15
```

dmesg

```
GEOM: da0: the secondary GPT table is corrupt or invalid.
GEOM: da0: using the primary only -- recovery suggested.
GEOM: label/label/disk15: corrupt or invalid GPT detected.
GEOM: label/label/disk15: GPT rejected -- may not be recoverable.
GEOM: da2: the secondary GPT table is corrupt or invalid.
GEOM: da2: using the primary only -- recovery suggested.
GEOM: da3: the secondary GPT table is corrupt or invalid.
GEOM: da3: using the primary only -- recovery suggested.
GEOM: label/disk2: corrupt or invalid GPT detected.
GEOM: label/disk2: GPT rejected -- may not be recoverable.
GEOM: da4: the secondary GPT table is corrupt or invalid.
GEOM: da4: using the primary only -- recovery suggested.
GEOM: label/disk3: corrupt or invalid GPT detected.
GEOM: label/disk3: GPT rejected -- may not be recoverable.
GEOM: da5: the secondary GPT table is corrupt or invalid.
GEOM: da5: using the primary only -- recovery suggested.
GEOM: label/disk4: corrupt or invalid GPT detected.
GEOM: label/disk4: GPT rejected -- may not be recoverable.
GEOM: da6: the secondary GPT table is corrupt or invalid.
GEOM: da6: using the primary only -- recovery suggested.
GEOM: label/disk5: corrupt or invalid GPT detected.
GEOM: label/disk5: GPT rejected -- may not be recoverable.
GEOM: da7: the secondary GPT table is corrupt or invalid.
GEOM: da7: using the primary only -- recovery suggested.
GEOM: label/disk6: corrupt or invalid GPT detected.
GEOM: label/disk6: GPT rejected -- may not be recoverable.
GEOM: da8: the secondary GPT table is corrupt or invalid.
GEOM: da8: using the primary only -- recovery suggested.
GEOM: label/disk7: corrupt or invalid GPT detected.
GEOM: label/disk7: GPT rejected -- may not be recoverable.
GEOM: da9: the secondary GPT table is corrupt or invalid.
GEOM: da9: using the primary only -- recovery suggested.
GEOM: label/disk8: corrupt or invalid GPT detected.
GEOM: label/disk8: GPT rejected -- may not be recoverable.
GEOM: da10: the secondary GPT table is corrupt or invalid.
GEOM: da10: using the primary only -- recovery suggested.
GEOM: label/disk9: corrupt or invalid GPT detected.
GEOM: label/disk9: GPT rejected -- may not be recoverable.
GEOM: da11: the secondary GPT table is corrupt or invalid.
GEOM: da11: using the primary only -- recovery suggested.
GEOM: label/disk10: corrupt or invalid GPT detected.
GEOM: label/disk10: GPT rejected -- may not be recoverable.
GEOM: da12: the secondary GPT table is corrupt or invalid.
GEOM: da12: using the primary only -- recovery suggested.
GEOM: label/disk11: corrupt or invalid GPT detected.
GEOM: label/disk11: GPT rejected -- may not be recoverable.
GEOM: da13: the secondary GPT table is corrupt or invalid.
GEOM: da13: using the primary only -- recovery suggested.
GEOM: label/disk12: corrupt or invalid GPT detected.
GEOM: label/disk12: GPT rejected -- may not be recoverable.
GEOM: da14: the secondary GPT table is corrupt or invalid.
GEOM: da14: using the primary only -- recovery suggested.
GEOM: label/disk13: corrupt or invalid GPT detected.
GEOM: label/disk13: GPT rejected -- may not be recoverable.
GEOM: da15: the secondary GPT table is corrupt or invalid.
GEOM: da15: using the primary only -- recovery suggested.
GEOM: label/disk14: corrupt or invalid GPT detected.
GEOM: label/disk14: GPT rejected -- may not be recoverable.
```


```
[root@bsd ~]# camcontrol devlist
<ATA SSDSA2SH032G1GN 8860>         at scbus0 target 8 lun 0 (da0,pass0)
<ATA INTEL SSDSA2M080 02M3>        at scbus0 target 9 lun 0 (da1,pass1)
<ATA WDC WD1002FBYS-0 0C06>        at scbus0 target 10 lun 0 (da2,pass2)
<ATA WDC WD1002FBYS-0 0C06>        at scbus0 target 11 lun 0 (da3,pass3)
<ATA WDC WD1002FBYS-0 0C06>        at scbus0 target 12 lun 0 (da4,pass4)
<ATA WDC WD1002FBYS-0 0C06>        at scbus0 target 13 lun 0 (da5,pass5)
<ATA WDC WD1002FBYS-0 0C06>        at scbus0 target 14 lun 0 (da6,pass6)
<ATA WDC WD1002FBYS-0 0C06>        at scbus0 target 15 lun 0 (da7,pass7)
<ATA WDC WD1002FBYS-0 0C06>        at scbus0 target 16 lun 0 (da8,pass8)
<ATA WDC WD1002FBYS-0 0C06>        at scbus0 target 17 lun 0 (da9,pass9)
<ATA WDC WD1002FBYS-0 0C06>        at scbus0 target 18 lun 0 (da10,pass10)
<ATA WDC WD1002FBYS-0 0C06>        at scbus0 target 19 lun 0 (da11,pass11)
<ATA WDC WD1002FBYS-0 0C06>        at scbus0 target 20 lun 0 (da12,pass12)
<ATA WDC WD1002FBYS-0 0C06>        at scbus0 target 21 lun 0 (da13,pass13)
<ATA WDC WD1002FBYS-0 0C06>        at scbus0 target 22 lun 0 (da14,pass14)
<ATA WDC WD1002FBYS-0 0C06>        at scbus0 target 23 lun 0 (da15,pass15)
<LSILOGIC SASX28 A.1 7015>         at scbus0 target 28 lun 0 (ses0,pass16)
```


----------



## gkontos (May 23, 2011)

Your pool name is *logs* but you are trying to remove *log*

Your dmesg also suggests gpt corruption. Can you post the output of:

[CMD=""]#gpart show[/CMD]


----------



## usdmatt (May 23, 2011)

I'm not quite sure how you have managed to get a device called 'label/label/disk15'?
They are usually 'label/_labelname_' as with all your array disks.

Anyway the error you are getting is because you have the remove command wrong. (At least based on the same command in FreeBSD 8.2/ZFS v15)
It should just be:

[CMD="zpool"]remove poolname device[/CMD]
ie: [CMD="zpool"]remove tank label/label/disk15[/CMD]

You are trying to remove a disk called 'log', which obviously doesn't exist in the pool - as made clear by the error message. The fact that it locks up might be an issue with the dev version of ZFS.

I don't think the GPT errors are related to your ZFS problem but it's not right.
Is there are reason for using partitions rather than just labelling the entire disks?


----------



## Boeri (May 26, 2011)

Thank you for the feedback. I was experimenting with zfsguru and nexenta in the past, I must have been done something wrong 

I've destroyed old GPT tables and relabeled the disks.
[CMD=]# gpart destroy -F da1[/cmd]
[CMD=]# glabel label disk1 /dev/da1[/CMD]

Removing the log device works fine now with your commands. Thanks.


----------

