openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.69k stars 1.76k forks source link

zpool attach throws "no such device in pool" error #576

Closed kizzard closed 12 years ago

kizzard commented 12 years ago

Background: I initially created a 2 disc striped pool on FreeBSD and labelled the drives using glabel for easy identification. Then I installed linux and imported the pool which worked OK, albeit no longer using the labels for devices as /dev/label does not exist in linux.

zpool status after import:

# zpool status -v storage
  pool: storage
 state: ONLINE
 scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        storage     ONLINE       0     0     0
          sda       ONLINE       0     0     0
          sdb       ONLINE       0     0     0

errors: No known data errors

I then wanted to mirror each disk (to create a RAID10 like pool)

However this is what I got when trying to attach the first mirror:

# zpool attach storage sda sdc
cannot attach sdc to sda: no such device in pool

It appears to suggest that sda does not exist in the pool. However I know this is not true. I then tried the full device paths and even all of the other options such as the disk/by-id and disk/by-path device names and even tried to specify my own labels with zdev.conf, all to no avail.

Thanks to a helpful post on the zfs-fuse google group I found a way around this by retreiving the disc GUID using zdb -l and using this in place of the device name for sda:

# zpool attach storage 14855726366487100340 sdc

This was successful.

I don't know if this is a bug but I was urged to report it (and this seems a sensible thing to do).

I am aware of the risks of /dev/sdx for pool devices, and have switched to 'by-id' now that my problem has been resolved.

Here is the full output of zdb -l for sda which was originally labeled "label/storage0" with glabel in freebsd.:


--------------------------------------------
LABEL 0
--------------------------------------------
    version: 28
    name: 'storage'
    state: 0
    txg: 477994
    pool_guid: 2858493307105128233
    hostname: 'kimiko'
    top_guid: 14855726366487100340
    guid: 14855726366487100340
    vdev_children: 2
    vdev_tree:
        type: 'disk'
        id: 0
        guid: 14855726366487100340
        path: '/dev/sda'
        phys_path: '/dev/label/storage0'
        whole_disk: 1
        metaslab_array: 33
        metaslab_shift: 34
        ashift: 12
        asize: 2000394125312
        is_log: 0
        DTL: 120
        create_txg: 4
--------------------------------------------
LABEL 1
--------------------------------------------
    version: 28
    name: 'storage'
    state: 0
    txg: 477994
    pool_guid: 2858493307105128233
    hostname: 'kimiko'
    top_guid: 14855726366487100340
    guid: 14855726366487100340
    vdev_children: 2
    vdev_tree:
        type: 'disk'
        id: 0
        guid: 14855726366487100340
        path: '/dev/sda'
        phys_path: '/dev/label/storage0'
        whole_disk: 1
        metaslab_array: 33
        metaslab_shift: 34
        ashift: 12
        asize: 2000394125312
        is_log: 0
        DTL: 120
        create_txg: 4
--------------------------------------------
LABEL 2
--------------------------------------------
    version: 28
    name: 'storage'
    state: 0
    txg: 478130
    pool_guid: 2858493307105128233
    hostname: 'kimiko'
    top_guid: 14855726366487100340
    guid: 14855726366487100340
    vdev_children: 2
    vdev_tree:
        type: 'disk'
        id: 0
        guid: 14855726366487100340
        path: '/dev/disk/by-id/ata-WDC_WD20EARX-00PASB0_WD-WCAZAC703266'
        phys_path: '/dev/label/storage0'
        whole_disk: 1
        metaslab_array: 33
        metaslab_shift: 34
        ashift: 12
        asize: 2000394125312
        is_log: 0
        DTL: 120
        create_txg: 4
--------------------------------------------
LABEL 3
--------------------------------------------
    version: 28
    name: 'storage'
    state: 0
    txg: 478130
    pool_guid: 2858493307105128233
    hostname: 'kimiko'
    top_guid: 14855726366487100340
    guid: 14855726366487100340
    vdev_children: 2
    vdev_tree:
        type: 'disk'
        id: 0
        guid: 14855726366487100340
        path: '/dev/disk/by-id/ata-WDC_WD20EARX-00PASB0_WD-WCAZAC703266'
        phys_path: '/dev/label/storage0'
        whole_disk: 1
        metaslab_array: 33
        metaslab_shift: 34
        ashift: 12
        asize: 2000394125312
        is_log: 0
        DTL: 120
        create_txg: 4
kizzard commented 12 years ago

Sorry site issues last night caused this

marshalleq commented 6 months ago

Thanks still happening in 2024.