ZFS Internals (part #2)
From the MANUAL page: The zdb command is used by support engineers to diagnose failures and gather statistics. Since the ZFS file system is always consistent on disk and is self-repairing, zdb should only be run under the direction by a support engineer.
An interesting point about ZFS block pointers, is the Data virtual address (dva). In my last post about ZFS internals, i had the following:
# zdb -dddddd cow/fs01 4 ... snipped ... Indirect blocks: 0 L1 0:1205800:400 1:b400:400 4000L/400P F=2 B=1211 0 L0 0:60000:20000 20000L/20000P F=1 B=1211 20000 L0 0:1220000:20000 20000L/20000P F=1 B=1211 segment [0000000000000000, 0000000001000000) size 16M
Let´s look the first data block (L0):
0 L0 0:60000:20000 20000L/20000P F=1 B=1211
The dva for that block is the combination of 0 (indicating the physical vdev where that block is), and the 60000, which means the offset from the begining of the physical vdev (starting after the vdev labels, plus the boot block), 4MB total.
So, let´s try to read our file using the dva information:
# perl -e "\$x = ((0x400000 + 0x60000) / 512); printf \"\$x\\n\";" 8960
ps.: 512 is the disk block size
# dd if=/var/fakedevices/disk0 of=/tmp/dump.txt bs=512 \ iseek=8960 count=256 256+0 records in 256+0 records out # cat /tmp/dump.txt | tail -5 The intent of this document is to state the conditions under which VIGRA may be copied, such that the author maintains some semblance of artistic control over the development of the library, while giving the users of the library the right to use and distribute VIGRA in a more-or-less customary fashion, plus the
That´s cool! Don´t you think?