How to tell what disks are used for a zpool?

Hello,

Does anyone know how I can tell what disk are being not being used by a zpool?

For example in Veritas Volume manager, I can run a "vxdisk list" and disks that are marked as "online invalid" are disk that are not used.

I'm looking for a similar command in ZFS which will easily show what what disks are free.

I know I can use the "zpool status" which will show me what disks are being used by the pools.

zpool status will tell you what disks are spare ones, if any.

https://blogs.oracle.com/eschrock/entry/zfs\_hot_spares

There is no zpool/zfs command to find disks that are not in a zpool...

1 Like

Solaris seems to miss an easy "show all disks" command.
I have always used

format </dev/null

or, as non-root,

iostat -nE

I'm looking for something like this:

# vxdisk list
DEVICE TYPE DISK GROUP STATUS
hds9500-alua0_278 auto:cdsdisk - - online
hds9500-alua0_279 auto:cdsdisk - - online
hds9500-alua0_280 auto:sliced - - online
hds9500-alua0_281 auto:none - - online invalid
hds9500-alua0_282 auto:none - - online invalid
hds9500-alua0_283 auto:none - - online invalid

This is a "vxdisk list" which shows me all my disks attached to the system and what disk are used by VxVM (online) and the ones that are free (online invalid)

Anyone know how to do get such an output using zfs specific commands ?

The fact a disk is not used by VxVM (resp ZFS) doesn't necessarily mean it is free.

It might be used by something else. Moreover, the reality might be more subtle than the disk level approach you are expecting.

There might be primary and extended partitions (x86), there will likely be slices (x86 & SPARC) and any of them might be used by some volume manager (SVM, VxVM, ZFS, ASM) or directly contain a file system (UFS, FAT, SamFS, ...) or something else, especially if the device is shared/used by a different operating system.

You might run something like this to explore all of the potential partitions/slices:

for i in /dev/dsk/*; do
printf "%s : %s\n" $i "$(fstyp $i 2>&1)"
done | grep -v "cannot open"