Freebsd – How to remove broken ZIL disk from ZFS pool

freebsdzfs

I have a ZFS pool, which contains two mirrored hard drives and ramdisk for logs. In my scenario is that log disk died:

# zpool status -x tank
  pool: tank
 state: FAULTED
status: An intent log record could not be read.
    Waiting for adminstrator intervention to fix the faulted pool.
action: Either restore the affected device(s) and run 'zpool online',
    or ignore the intent log records by running 'zpool clear'.
   see: http://illumos.org/msg/ZFS-8000-K4
  scan: none requested
config:

    NAME                    STATE     READ WRITE CKSUM
    tank                    FAULTED      0     0     0
      mirror-0              ONLINE       0     0     0
        ada0                ONLINE       0     0     0
        ada1                ONLINE       0     0     0
    logs
      6324139563861643487   UNAVAIL      0     0     0  was /dev/md1

Now I'd like to discard lost logs and remove the dead device from the pool, but I can not do that:

# zpool clear -F tank 6324139563861643487
cannot clear errors for 6324139563861643487: one or more devices is currently unavailable

I also can not bring the pool online:

# zpool remove tank 6324139563861643487 
cannot open 'tank': pool is unavailable

How do I ignore the intent log records?

Best Answer

There is an option which allows to import pool with a broken device. Her is how I managed to recover the pool:

# zpool export tank
# zpool import -m tank
# zpool status tank
  pool: tank
 state: DEGRADED
status: One or more devices could not be opened.  Sufficient replicas exist for
the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.
   see: http://illumos.org/msg/ZFS-8000-2Q
  scan: none requested
config:

NAME                    STATE     READ WRITE CKSUM
tank                    DEGRADED     0     0     0
 mirror-0              ONLINE       0     0     0
   gpt/disk1           ONLINE       0     0     0
   gpt/disk2           ONLINE       0     0     0
logs
 6324139563861643487   UNAVAIL      0     0     0  was /dev/md1
cache
 gpt/disk3             ONLINE       0     0     0

errors: No known data errors
# zpool clear tank
# zpool remove tank 6324139563861643487
# zpool status tank
  pool: tank
 state: ONLINE
  scan: none requested
config:

NAME                    STATE     READ WRITE CKSUM
tank                    ONLINE       0     0     0
 mirror-0              ONLINE       0     0     0
   gpt/disk1           ONLINE       0     0     0
   gpt/disk2           ONLINE       0     0     0
cache
 gpt/disk3             ONLINE       0     0     0

errors: No known data errors
Related Question