Learn openzfs

###

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00003fd0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|
...
000043c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
0001ffd0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|
...
00020010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00021000 0c b1 ba 00 00 00 00 00 88 13 00 00 00 00 00 00 |................|
...
000210b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000213d0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|
...
000214b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000217d0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|
000217e0 51 c5 e5 d7 3c d9 79 66 b2 6d 81 67 56 bd 92 df |Q...<.yf.m.gV...|
000217f0 f7 c7 03 02 fa fb 73 8c 2b 8c 9c 74 8a 9e a3 b2 |......s.+..t....|
00021800 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
0003ffd0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|
0003ffe0 4a 12 20 c9 20 33 d9 75 a4 0b 73 a6 7f 7e 7f 06 |J. . 3.u..s..~..|
0003fff0 da 88 65 39 62 62 86 01 75 68 a3 f8 be a3 bf fd |..e9bb..uh......|
00040000


0x3fd0=12240
0x1ffd0=131024
0x20010=131088
0x213d0=136144
0x217d0=137168
0x3ffd0=262096
0x40000=262144

awk 'BEGIN{print 12240/1024}'
11.9531
awk 'BEGIN{print 131024/1024}'
127.953
awk 'BEGIN{print 131088/1024}'
128.016
awk 'BEGIN{print 136144/1024}'
132.953
awk 'BEGIN{print 137168/1024}'
133.953
awk 'BEGIN{print 262096/1024}'
255.953
awk 'BEGIN{print 262144/1024}'
256

dd if=/mnt/disk0 of=test bs=1K count=256
dd if=/mnt/disk0 of=test1 bs=1K count=256 skip=256
hexdump -C test1 | grep "11 7a 0c b1"
00003fd0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|
0001ffd0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|
000213d0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|
000217d0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|
0003ffd0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|

hexdump -C test | grep "11 7a 0c b1"
00003fd0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|
0001ffd0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|
000213d0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|
000217d0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|
0003ffd0 00 00 00 00 00 00 00 00 11 7a 0c b1 7a da 10 02 |.........z..z...|

zbt_magic: ZIO block tail magic number. The value is
0x210da7ab10c7a11 (zio-data-bloc-tail).
Why reverse order ?

Uberblock

ub_magic
The uberblock magic number is a 64 bit integer used to identify a device as containing ZFS data.
Big Endian: 0x00bab10c
Little Endian: 0x0cb1ba00

0x21000=135168
awk ‘BEGIN{print 135168/1024-128}’
4

1
2
3
4
5
6
7
8
9
hexdump -C disk0 | grep "0c b1 ba 00" -i
00021000 0c b1 ba 00 00 00 00 00 88 13 00 00 00 00 00 00 |................|
00021400 0c b1 ba 00 00 00 00 00 88 13 00 00 00 00 00 00 |................|
00061000 0c b1 ba 00 00 00 00 00 88 13 00 00 00 00 00 00 |................|
00061400 0c b1 ba 00 00 00 00 00 88 13 00 00 00 00 00 00 |................|
3ffa1000 0c b1 ba 00 00 00 00 00 88 13 00 00 00 00 00 00 |................|
3ffa1400 0c b1 ba 00 00 00 00 00 88 13 00 00 00 00 00 00 |................|
3ffe1000 0c b1 ba 00 00 00 00 00 88 13 00 00 00 00 00 00 |................|
3ffe1400 0c b1 ba 00 00 00 00 00 88 13 00 00 00 00 00 00 |................|