Adding and removing ZFS zpool ZIL disk live by gptid

While this was primarily written for FreeNAS, it should still be applicable to any ZFS environment.

Note: You must be running FreeNAS 8.3.0 or later (specifically ZFS version 19 or later) for safe ZIL addition/removal, or you will lose the contents of your pool. See here for more information.

First, identify the drives in your zpool

zpool status

In my case, zpool name is tank, so

zpool status tank


  pool: tank
 state: ONLINE
  scan: scrub repaired 0 in 2h26m with 0 errors on Sun Feb 24 18:20:41 2013

        NAME                                            STATE     READ WRITE CKSUM
        tank                                            ONLINE       0     0     0
          raidz1-0                                      ONLINE       0     0     0
            gptid/7d6aebb4-7d35-11e2-a509-a0b3cce4f06c  ONLINE       0     0     0
            gptid/7e07dbb7-7d35-11e2-a509-a0b3cce4f06c  ONLINE       0     0     0
            gptid/7eaf492d-7d35-11e2-a509-a0b3cce4f06c  ONLINE       0     0     0
          gptid/7f31716a-7d35-11e2-a509-a0b3cce4f06c    ONLINE       0     0     0

errors: No known data errors

So now we have the gptid of the ZIL log: gptid/7f31716a-7d35-11e2-a509-a0b3cce4f06c

Now, remove the ZIL

zpool remove tank gptid/7f31716a-7d35-11e2-a509-a0b3cce4f06c

The log has been removed. Verify with

zpool status tank

Adding the ZIL back:

You can add the ZIL back using:

zpool add  log <disk_ID>

So, if you wanted to add the previous disk back:

zpool add tank log  gptid/7f31716a-7d35-11e2-a509-a0b3cce4f06c

But if you wanted to add a different disk as a log, you need the gptid

gptids are listed under /dev/gptid


ls -l /dev/gptid/

total 0
crw-r—– 1 root operator 0, 96 Feb 28 07:20 7d6aebb4-7d35-11e2-a509-a0b3cce4f06c
crw-r—– 1 root operator 0, 107 Feb 28 07:20 7e07dbb7-7d35-11e2-a509-a0b3cce4f06c
crw-r—– 1 root operator 0, 109 Feb 28 07:20 7eaf492d-7d35-11e2-a509-a0b3cce4f06c
crw-r—– 1 root operator 0, 110 Feb 28 07:20 7f31716a-7d35-11e2-a509-a0b3cce4f06c
Compare those gptid’s to what’s already in your pool to determine the correct disk to add.

Questions or comments about the above? Please leave them in the comments section below. Thank you!

, , ,