This article hasn't been updated for over 5 years. The information below may be obsolete.

Retrieving ZFS zpool history commands

ZFS automatically logs successful zfs and zpool commands that modify pool state information. This information can be displayed by using the zpool history command.

Key features of the history log:

  • The log cannot be disabled.
  • The log is saved persistently on disk, which means that the log is saved across system reboots.
  • The log is implemented as a ring buffer. The minimum size is 128 KB. The maximum size is 32 MB.
  • For smaller pools, the maximum size is capped at 1% of the pool size, where the size is determined at pool creation time.
  • The log requires no administration, which means that tuning the size of the log or changing the location of the log is unnecessary.

Common zpool history commands:

  • Display command history for all pools:
    zpool history
    For example:
    root@global# zpool history
    History for 'rpool':
    2010-05-11.10:18:54 zpool create -f -o failmode=continue -R /a -m legacy -o 
    cachefile=/tmp/root/etc/zfs/zpool.cache rpool mirror c1t0d0s0 c1t1d0s0
    2010-05-11.10:18:55 zfs set canmount=noauto rpool
    2010-05-11.10:18:55 zfs set mountpoint=/rpool rpool
    2010-05-11.10:18:56 zfs create -o mountpoint=legacy rpool/ROOT
    2010-05-11.10:18:57 zfs create -b 8192 -V 2048m rpool/swap
    2010-05-11.10:18:58 zfs create -b 131072 -V 1536m rpool/dump
    2010-05-11.10:19:01 zfs create -o canmount=noauto rpool/ROOT/zfsBE
    2010-05-11.10:19:02 zpool set bootfs=rpool/ROOT/zfsBE rpool
    2010-05-11.10:19:02 zfs set mountpoint=/ rpool/ROOT/zfsBE
    2010-05-11.10:19:03 zfs set canmount=on rpool
    2010-05-11.10:19:04 zfs create -o mountpoint=/export rpool/export
    2010-05-11.10:19:05 zfs create rpool/export/home
    2010-05-11.11:11:10 zpool set bootfs=rpool rpool
    2010-05-11.11:11:10 zpool set bootfs=rpool/ROOT/zfsBE rpool
    
  • Show history for a specific pool:
    zpool history <pool_name>
    For example:
    root@global# zpool history bravo
    History for 'bravo':
    2010-05-13.14:13:15 zpool create bravo mirror c1t2d0 c1t3d0
    2010-05-13.14:21:19 zfs create bravo/snaps
    2010-05-14.08:10:29 zfs create bravo/src
    2010-05-14.08:10:54 zfs snapshot bravo/src@now
    2010-05-14.08:11:05 zfs clone bravo/src@now bravo/src_copy
    
  • Displays username, hostname, and zone/container for each action (long format):
    zpool history -l <pool_name>
    For example:
    root@global# zpool history -l bravo
    History for 'bravo':
    2010-05-13.14:13:15 zpool create bravo mirror c1t2d0 c1t3d0 [user root on br001]
    2010-05-13.14:21:19 zfs create bravo/snaps [user root on br001]
    2010-05-14.08:10:29 zfs create bravo/src [user root on br001]
    2010-05-14.08:10:54 zfs snapshot bravo/src@now [user root on br001]
    2010-05-14.08:11:05 zfs clone bravo/src@now bravo/src_copy [user root on br001]
  • Shows internal ZFS events in addition to user-initiated commands:
    zpool history -i <pool_name>
    For example:
    root@global# zpool history -i bravo
    2010-05-13.14:13:15 zpool create -f bravo mirror c1t2d0 c1t3d0
    2010-05-13.14:13:45 [internal pool create txg:6] pool spa 19; zfs spa 19; zpl 4;...
    2010-05-13.14:21:19 zfs create bravo/snaps
    2010-05-13.14:22:02 [internal replay_inc_sync txg:20451] dataset = 41
    2010-05-13.14:25:25 [internal snapshot txg:20480] dataset = 52
    2010-05-13.14:25:25 [internal destroy_begin_sync txg:20481] dataset = 41
    2010-05-13.14:25:26 [internal destroy txg:20488] dataset = 41
    2010-05-13.14:25:26 [internal reservation set txg:20488] 0 dataset = 0
    2010-05-14.08:10:29 zfs create bravo/src
    2010-05-14.08:10:54 [internal snapshot txg:53992] dataset = 42
    2010-05-14.08:10:54 zfs snapshot bravo/src@now
    2010-05-14.08:11:04 [internal create txg:53994] dataset = 58
    2010-05-14.08:11:05 zfs clone bravo/src@now bravo/src_copy