Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way in zfs to find out where blocks for a particular file are stored? I'd like to be able to ask for the locations of all the blocks for a file, including ditto blocks.

(Yes, I understand that this is low-level stuff not normally exposed to users.)

(v0.6.0.56-rc8, ZFS pool version 28, ZFS filesystem version 5, Ubuntu 11.10)

share|improve this question

This is non trivial and possibly beyond the scope of an SF question/answer as the tools required don't appear well documented. You can probably use zdb(1m) in conjunction with the on disk format doc to find the information you want. There is a blog on how to do this here


use ls -i to get the initial inode.

use zdb -ddddd <inodenum> to get the block information and decode it using the ODF

share|improve this answer

You can use ls -i to see the initial inode, after that I'd suggest reading the source code published to understand the on-disk data structures. After you've completed that I'd suggest writing your own tools to read the raw device and assemble all the block layout information you're interested in. There is a small-ish ZFS API (libzfs) project that only offers basic ZFS configuration like listing, creating etc. zpools.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.