Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers

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

Essentially

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
add comment

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
add comment

Your Answer

 
discard

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.