Derived from: http://www.c0t0d0s0.org/archives/7485-Find-out-in-depth-information-about-a-file-in-ZFS.html
Sometimes you need to acquire in-depth information about a file that isn't exposed by other commands like stat
.
ZFS allows you to do this with zdb
. However there's a confusing problem. If you're just trying to access a file on your root pool that doesn't have any nested datasets, you need use rpool/
instead of just rpool
(assuming "rpool" is the name of your root pool).
Here's 3 examples of acquiring information on /filepath
.
zdb -dddd rpool/ $(find /filepath -maxdepth 0 -printf "%i")
zdb -dddd rpool/ $(ls --inode --directory /filepath | cut --delimiter=' ' --fields=1)
zdb -dddd rpool/ $(stat --format '%i' /filepath)
If you don't use rpool/
, the error comes back as:
zdb: dmu_bonus_hold(2220608) failed, errno 2
Where 2220608
is the inode of the file/directory you're looking for.