You can use the zpool list command to display basic information about pools.
With no arguments, the zpool list command displays the following information for all pools on the system:
# zpool list NAME SIZE ALLOC FREE CAP HEALTH ALTROOT tank 80.0G 22.3G 47.7G 28% ONLINE - dozer 1.2T 384G 816G 32% ONLINE -
This command output displays the following information:
The name of the pool.
The total size of the pool, equal to the sum of the sizes of all top-level virtual devices.
The amount of physical space allocated to all datasets and internal metadata. Note that this amount differs from the amount of disk space as reported at the file system level.
For more information about determining available file system space, see ZFS Disk Space Accounting.
The amount of unallocated space in the pool.
The amount of disk space used, expressed as a percentage of the total disk 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 one exists.
For more information about alternate root pools, see Using a ZFS Pool With an Alternate Root Location.
You can also gather statistics for a specific pool by specifying the pool name. For example:
# zpool list tank NAME SIZE ALLOC FREE CAP HEALTH ALTROOT tank 80.0G 22.3G 47.7G 28% ONLINE -
You can use the zpool list interval and count options to gather statistics over a period of time. In addition, you can display a time stamp by using the –T option. For example:
# zpool list -T d 3 2 Tue Nov 2 10:36:11 MDT 2010 NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT pool 33.8G 83.5K 33.7G 0% 1.00x ONLINE - rpool 33.8G 12.2G 21.5G 36% 1.00x ONLINE - Tue Nov 2 10:36:14 MDT 2010 pool 33.8G 83.5K 33.7G 0% 1.00x ONLINE - rpool 33.8G 12.2G 21.5G 36% 1.00x ONLINE -
You can use the zpool status –l option to display information about the physical location of pool devices. Reviewing the physical location information is helpful when you need to physically remove or replace a disk.
In addition, you can use the fmadm add-alias command to include a disk alias name that helps you identify the physical location of disks in your environment. For example:
# fmadm add-alias SUN-Storage-J4400.1002QCQ015 Lab10Rack5...
# zpool status -l tank pool: tank state: ONLINE scan: scrub repaired 0 in 0h0m with 0 errors on Fri Aug 3 16:00:35 2012 config: NAME STATE READ WRITE CKSUM tank ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_02/disk ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_20/disk ONLINE 0 0 0 mirror-1 ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_22/disk ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_14/disk ONLINE 0 0 0 mirror-2 ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_10/disk ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_16/disk ONLINE 0 0 0 mirror-3 ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_01/disk ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_21/disk ONLINE 0 0 0 mirror-4 ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_23/disk ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_15/disk ONLINE 0 0 0 mirror-5 ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_09/disk ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_04/disk ONLINE 0 0 0 mirror-6 ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_08/disk ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_05/disk ONLINE 0 0 0 mirror-7 ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_07/disk ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_11/disk ONLINE 0 0 0 mirror-8 ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_06/disk ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_19/disk ONLINE 0 0 0 mirror-9 ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_00/disk ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_13/disk ONLINE 0 0 0 mirror-10 ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_03/disk ONLINE 0 0 0 /dev/chassis/Lab10Rack5.../DISK_18/disk ONLINE 0 0 0 spares /dev/chassis/Lab10Rack5.../DISK_17/disk AVAIL /dev/chassis/Lab10Rack5.../DISK_12/disk AVAIL errors: No known data errors
Specific statistics can be requested by using the –o option. This option provides 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 Displaying Information About All Storage Pools or a Specific Pool.
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 list of all pool names on the system, you would use the following syntax:
# 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': 2012-04-06.14:02:55 zpool create -f rpool c3t0d0s0 2012-04-06.14:02:56 zfs create -p -o mountpoint=/export rpool/export 2012-04-06.14:02:58 zfs set mountpoint=/export rpool/export 2012-04-06.14:02:58 zfs create -p rpool/export/home 2012-04-06.14:03:03 zfs create -p -V 2048m rpool/swap 2012-04-06.14:03:08 zfs set primarycache=metadata rpool/swap 2012-04-06.14:03:09 zfs create -p -V 4094m rpool/dump 2012-04-06.14:26:47 zpool set bootfs=rpool/ROOT/s11u1 rpool 2012-04-06.14:31:15 zfs set primarycache=metadata rpool/swap 2012-04-06.14:31:46 zfs create -o canmount=noauto -o mountpoint=/var/share rpool/VARSHARE 2012-04-06.15:22:33 zfs set primarycache=metadata rpool/swap 2012-04-06.16:42:48 zfs set primarycache=metadata rpool/swap 2012-04-09.16:17:24 zfs snapshot -r rpool/ROOT@yesterday 2012-04-09.16:17:54 zfs snapshot -r rpool/ROOT@now
You can use similar output on your system to identify the actual ZFS commands that were executed to troubleshoot an error condition.
The features of the history log are as follows:
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 percent 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.
To identify the command history of a specific storage pool, use syntax similar to the following:
# zpool history tank 2012-01-25.16:35:32 zpool create -f tank mirror c3t1d0 c3t2d0 spare c3t3d0 2012-02-17.13:04:10 zfs create tank/test 2012-02-17.13:05:01 zfs snapshot -r tank/test@snap1
Use the –l option to display a long format that includes the user name, the host name, and the zone in which the operation was performed. For example:
# zpool history -l tank History for 'tank': 2012-01-25.16:35:32 zpool create -f tank mirror c3t1d0 c3t2d0 spare c3t3d0 [user root on tardis:global] 2012-02-17.13:04:10 zfs create tank/test [user root on tardis:global] 2012-02-17.13:05:01 zfs snapshot -r tank/test@snap1 [user root on tardis:global]
Use the –i option to display internal event information that can be used for diagnostic purposes. For example:
# zpool history -i tank History for 'tank': 2012-01-25.16:35:32 zpool create -f tank mirror c3t1d0 c3t2d0 spare c3t3d0 2012-01-25.16:35:32 [internal pool create txg:5] pool spa 33; zfs spa 33; zpl 5; uts tardis 5.11 11.1 sun4v 2012-02-17.13:04:10 zfs create tank/test 2012-02-17.13:04:10 [internal property set txg:66094] $share2=2 dataset = 34 2012-02-17.13:04:31 [internal snapshot txg:66095] dataset = 56 2012-02-17.13:05:01 zfs snapshot -r tank/test@snap1 2012-02-17.13:08:00 [internal user hold txg:66102] <.send-4736-1> temp = 1 ...