LinuxCommandLibrary

zdb

Diagnose ZFS pool health and configuration

TLDR

Show detailed configuration of all mounted ZFS zpools

$ zdb
copy

Show detailed configuration for a specific ZFS pool
$ zdb -C [poolname]
copy

Show statistics about number, size and deduplication of blocks
$ zdb -b [poolname]
copy

SYNOPSIS

zdb [options] [pool]

PARAMETERS

-b
    Print block statistics.

-B
    Print blocks.

-c
    Specify a configuration file to use.

-C
    Print checksum errors.

-dddd
    Increase verbosity.

-e
    Run in expert mode, allowing modification of pool state.

-g
    Print the pool GUID.

-G
    Only process objects with the given GUID.

-i
    Print the inode for the given object.

-k
    Print kernel state.

-l
    Print the label for the given vdev.

-L
    Print all labels.

-m
    Print metadata.

-M
    Print metadata summary.

-n
    No execute mode.

-o
    Seek to this offset in the object.

-p
    Print pool state.

-r
    Repair object.

-s
    Start at offset.

-S
    Print SPA state.

-t
    Print the MOS transaction.

-T
    Print all transactions.

-u
    Attempt to unmount the pool first.

-v
    Verify checksums.

-V
    Print vdev state.

-x
    Print extended statistics.

-X
    Print extended blocks.

-h
    Display help.

DESCRIPTION

zdb is a powerful but potentially dangerous command-line tool used for querying and debugging ZFS storage pools.

It provides access to low-level ZFS data structures, allowing administrators to inspect pool health, identify data corruption, and potentially recover data from damaged pools. However, improper use of zdb can lead to further data loss or pool corruption.

Therefore, zdb should only be used by experienced ZFS administrators who understand the underlying ZFS architecture and the potential risks involved. It's often employed as a last resort when standard ZFS tools like 'zpool status' or 'zpool scrub' fail to resolve issues. The command is typically used for tasks such as identifying corrupted metadata, examining pool configuration information, and analyzing data block allocation.

CAVEATS

zdb can be extremely dangerous if misused. It can lead to permanent data loss or pool corruption. Use with extreme caution and only when necessary.

EXPERT MODE (-E)

Using the '-e' flag enables expert mode, allowing zdb to modify the pool state. This should only be used as a last resort by individuals with extensive ZFS knowledge, as incorrect modifications can irreversibly damage the pool.

DATA RECOVERY CONSIDERATIONS

When using zdb for data recovery, it's crucial to have a recent backup of the pool if possible. Before attempting any repairs, create a read-only snapshot of the pool to preserve the original state. This provides a fallback option if the repair process fails.

HISTORY

zdb was developed as part of the ZFS project by Sun Microsystems (now Oracle). It has been continuously improved and maintained since its initial release.

Its primary purpose is to provide a debugging tool for ZFS storage pools, allowing developers and administrators to analyze and diagnose pool issues. Usage has evolved from internal development debugging to being used for extreme data recovery scenarios.

SEE ALSO

zpool(8), zfs(8)

Copied to clipboard