zdb question

Dave Baukus daveb at spectralogic.com
Thu Feb 28 14:00:33 UTC 2019


If one uses zdb -R <pool name> <dva> to read the contents of every disk block
associated with the DVA in a raidz2 pool then does one expect the
dump of each DVA to be the exact USER WRITTEN contents of the file ?
Or does this usage of zdb pull in the raidz2 checksum blocks and/or padding ?
Looking at the code, I don't think so.

I ask because I have a file of known contents (every byte was written as 0x42 == 'B'),
and if I execute the script below and redirect the output to a file then
the contents of the output file has chunks of non-B characters.

For example:

Offset 300000, DVA 1:9f08e2ff000:120000
Found vdev type: raidz

1:9f08e2ff000:120000
           0 1 2 3 4 5 6 7   8 9 a b c d e f  0123456789abcdef
010000:  01000321b60d0000  0afb2f931d805100  ....!....Q.../..
010010:  02ac211c00020f00  00e2000680110031  .....!..1.......
010020:  39345f58656c6966  0f001334322e3639  fileX_4996.24...
010030:  050040cb1f0c0002  02020c003a35352f  ..... at ../55:....
010040:  3822050040ea1f00  210c00020f002136  ... at .."86!.....!

-----

Whereas I expect every DVA chunk to look like:

Offset 0, DVA 1:9f08e0bf000:120000
Found vdev type: raidz

1:9f08e0bf000:120000
           0 1 2 3 4 5 6 7   8 9 a b c d e f  0123456789abcdef
000000:  4242424242424242  4242424242424242  BBBBBBBBBBBBBBBB
000010:  4242424242424242  4242424242424242  BBBBBBBBBBBBBBBB
000020:  4242424242424242  4242424242424242  BBBBBBBBBBBBBBBB
000030:  4242424242424242  4242424242424242  BBBBBBBBBBBBBBBB
000040:  4242424242424242  4242424242424242  BBBBBBBBBBBBBBBB

----

On the other hand, if I use a simple program to read the file and verify that every byte
is 0x42 then no errors are reported.

What gives ?
Am I misusing zdb ?

P.S.
The file was written to a degraded pool.
Two disks in each raidz2 strip were purposely turned off.
See zpool status below.

----

The Script:

#!/usr/local/bin/bash
#
PROG=$(basename $0)
POOL=${1:-none}         # pool name
ZDB_FILE=${2:-none}     # output of  zdb -dddddd  <obj set> <obj id>

error()
{
         printf "${PROG}: $*\n" >&2
         exit 22
}

[ "$POOL" == "none" ] && error "no pool name specified"
[ "$ZDB_FILE" == "none" ] && error "no zdb file specified"

# Look for lines like:
# 800000   L0 0:93f601cb000:120000 100000L/100000P F=1 B=65275/65275
# and pull out the offset (column1) and the DVA (column3)
#
awk '
         $2 == "L0" {
                 printf("%s %s\n",  $1, $3);
         }
' $ZDB_FILE | while read offset dva xxx
do
         echo "Offset ${offset}, DVA $dva"
         zdb -R ${POOL} ${dva}
         echo "============================="
done

----

   pool: SATA_POOL
  state: DEGRADED
status: One or more devices has been removed by the administrator.
         Sufficient replicas exist for the pool to continue functioning in a
         degraded state.
action: Online the device using 'zpool online' or replace the device with
         'zpool replace'.
   scan: none requested
config:

         NAME                      STATE     READ WRITE CKSUM
         SATA_POOL                 DEGRADED     0     0     0
           raidz2-0                DEGRADED     0     0     0
             da55                  ONLINE       0     0     0
             da56                  ONLINE       0     0     0
             da57                  ONLINE       0     0     0
             da59                  ONLINE       0     0     0
             da60                  ONLINE       0     0     0
             2538734703746996008   REMOVED      0     0     0  was /dev/da61
             da62                  ONLINE       0     0     0
             da63                  ONLINE       0     0     0
             da64                  ONLINE       0     0     0
             da65                  ONLINE       0     0     0
             da66                  ONLINE       0     0     0
             da67                  ONLINE       0     0     0
             15457613580284781672  REMOVED      0     0     0  was /dev/da68
             da69                  ONLINE       0     0     0
             da70                  ONLINE       0     0     0
             da71                  ONLINE       0     0     0
             da72                  ONLINE       0     0     0
             da73                  ONLINE       0     0     0
           raidz2-1                DEGRADED     0     0     0
             da74                  ONLINE       0     0     0
             da75                  ONLINE       0     0     0
             da76                  ONLINE       0     0     0
             da77                  ONLINE       0     0     0
             da78                  ONLINE       0     0     0
             13650864469774425690  REMOVED      0     0     0  was /dev/da79
             da80                  ONLINE       0     0     0
             da81                  ONLINE       0     0     0
             da82                  ONLINE       0     0     0
             da83                  ONLINE       0     0     0
             da84                  ONLINE       0     0     0
             da85                  ONLINE       0     0     0
             6184301131260543456   REMOVED      0     0     0  was /dev/da86
             da87                  ONLINE       0     0     0
             da88                  ONLINE       0     0     0
             da89                  ONLINE       0     0     0
             da90                  ONLINE       0     0     0
             da91                  ONLINE       0     0     0

errors: No known data errors

-- 
Dave Baukus


More information about the freebsd-fs mailing list