You can use the zpool list command to display basic information about pools.
With no arguments, the command displays all the fields for all pools on the system. For example:
# zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT tank 80.0G 22.3G 47.7G 28% ONLINE - dozer 1.2T 384G 816G 32% ONLINE - |
This output displays the following information:
The name of the pool.
The total size of the pool, equal to the sum of the size of all top-level virtual devices.
The amount of space allocated by all datasets and internal metadata. Note that this amount is different from the amount of space as reported at the file system level.
For more information about determining available file system space, see ZFS Space Accounting.
The amount of unallocated space in the pool.
The amount of space used, expressed as a percentage of total space.
The current health status of the pool.
For more information about pool health, see Determining the Health Status of ZFS Storage Pools.
The alternate root of the pool, if any.
For more information about alternate root pools, see Using ZFS Alternate Root Pools.
You can also gather statistics for a specific pool by specifying the pool name. For example:
# zpool list tank NAME SIZE USED AVAIL CAP HEALTH ALTROOT tank 80.0G 22.3G 47.7G 28% ONLINE - |
Specific statistics can be requested by using the -o option. This option allows for custom reports or a quick way to list pertinent information. For example, to list only the name and size of each pool, you use the following syntax:
# zpool list -o name,size NAME SIZE tank 80.0G dozer 1.2T |
The column names correspond to the properties that are listed in Listing Information About All Storage Pools.
The default output for the zpool list command is designed for readability, and is not easy to use as part of a shell script. To aid programmatic uses of the command, the -H option can be used to suppress the column headings and separate fields by tabs, rather than by spaces. For example, to request a simple list of all pool names on the system:
# zpool list -Ho name tank dozer |
Here is another example:
# zpool list -H -o name,size tank 80.0G dozer 1.2T |
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:
The log cannot be disabled.
The log is saved persistently on disk, which means the log is saved across system reboots.
The log is implemented as a ring buffer. The minimum size is 128 Kbytes. The maximum size is 32 Mbytes.
For smaller pools, the maximum size is capped at 1% of the pool size, where size is determined at pool creation time.
Requires no administration, which means tuning the size of the log or changing the location of the log is unnecessary.
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 |