How do I remove an unavailabe cache device from a zpool?

I moved my zpool from one server to another (arch linux) by physically moving the disks, minus the cache disk to a new server and importing it. It works fine, but the old cache device still appears as unavailable:

zpool status storage
  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: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-4J
  scan: scrub repaired 0B in 08:59:05 with 0 errors on Sun Apr 23 08:59:06 2023
config:

        NAME                                    STATE     READ WRITE CKSUM
        storage                                 ONLINE       0     0     0
          raidz1-0                              ONLINE       0     0     0
            sda2                                ONLINE       0     0     0
            sdb2                                ONLINE       0     0     0
            sdc2                                ONLINE       0     0     0
            sdd2                                ONLINE       0     0     0
        cache
          f7a3305b-ce48-11ea-bdee-77fbe5732e17  UNAVAIL      0     0     0

errors: No known data errors

I want to get rid of it, not replace it, but remove and detach don’t work. I also tried exporting and reimporting the pool.

sudo zpool remove storage f7a3305b-ce48-11ea-bdee-77fbe5732e17
cannot remove f7a3305b-ce48-11ea-bdee-77fbe5732e17: no such device in pool
Asked By: Andreas Hartmann

||

This is how I solved it:

  1. zpool status -g
  2. Copy the guid of the cache device and remove it with zpool remove.

This may or may not be a minor bug: https://github.com/openzfs/zfs/issues/14871#issuecomment-1549424452

Answered By: Andreas Hartmann
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.