Solaris ZFS Administration Guide

Displaying ZFS Storage Pool Command History

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

For example, the following syntax displays the command output for the root pool.


# zpool history
History for 'rpool':
2009-05-07.13:51:00 zpool create -f -o failmode=continue -R /a -m legacy -o cachefile=
/tmp/root/etc/zfs/zpool.cache rpool c1t0d0s0
2009-05-07.13:51:01 zfs set canmount=noauto rpool
2009-05-07.13:51:02 zfs set mountpoint=/rpool rpool
2009-05-07.13:51:02 zfs create -o mountpoint=legacy rpool/ROOT
2009-05-07.13:51:03 zfs create -b 8192 -V 2048m rpool/swap
2009-05-07.13:51:04 zfs create -b 131072 -V 1024m rpool/dump
2009-05-07.13:51:09 zfs create -o canmount=noauto rpool/ROOT/snv_114
2009-05-07.13:51:10 zpool set bootfs=rpool/ROOT/snv_114 rpool
2009-05-07.13:51:10 zfs set mountpoint=/ rpool/ROOT/snv_114
2009-05-07.13:51:11 zfs set canmount=on rpool
2009-05-07.13:51:12 zfs create -o mountpoint=/export rpool/export
2009-05-07.13:51:12 zfs create rpool/export/home

You can use similar output on your system to identify the exact set of ZFS commands that was executed to troubleshoot an error scenario.

The features of the history log are as follows:

To identify the command history of a specific storage pool, use syntax similar to the following:


# zpool history mypool
History for 'mypool':
2009-06-02.10:56:54 zpool create mypool mirror c0t4d0 c0t5d0
2009-06-02.10:57:31 zpool add mypool spare c0t6d0
2009-06-02.10:57:54 zpool offline mypool c0t5d0
2009-06-02.10:58:02 zpool online mypool c0t5d0

Use the -l option to display a long format that includes the user name, the hostname, and the zone in which the operation was performed. For example:


# zpool history -l mypool
History for 'mypool':
2009-06-02.10:56:54 zpool create mypool mirror c0t4d0 c0t5d0 [user root on neo:global]
2009-06-02.10:57:31 zpool add mypool spare c0t6d0 [user root on neo:global]
2009-06-02.10:57:54 zpool offline mypool c0t5d0 [user root on neo:global]
2009-06-02.10:58:02 zpool online mypool c0t5d0 [user root on neo:global]

Use the -i option to display internal event information that can be used for diagnostic purposes. For example:


# zpool history -i mypool
History for 'mypool':
2009-06-02.10:56:54 zpool create mypool mirror c0t4d0 c0t5d0
2009-06-02.10:57:31 zpool add mypool spare c0t6d0
2009-06-02.10:57:54 zpool offline mypool c0t5d0
2009-06-02.10:58:02 zpool online mypool c0t5d0
2009-06-02.11:02:20 [internal create txg:23] dataset = 24
2009-06-02.11:02:20 [internal property set txg:24] mountpoint=/data dataset = 24
2009-06-02.11:02:20 zfs create -o mountpoint=/data mypool/data
2009-06-02.11:02:34 [internal create txg:26] dataset = 30
2009-06-02.11:02:34 zfs create mypool/data/datab