]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/diag/prtblknos/README
Add an explanation of the block size units output by prtblknos.
[FreeBSD/FreeBSD.git] / tools / diag / prtblknos / README
1 # $FreeBSD$
2
3 This is a little C-program that can be used to print out the list
4 of blocks used by a requested list of inodes.
5
6 For example, to list the blocks referenced by your kernel:
7
8 guest_12 % df /
9 Filesystem      1K-blocks     Used   Avail Capacity  Mounted on
10 /dev/gpt/rootfs  20307196 10707336 7975288    57%    /
11
12 guest_12 % ls -i /boot/kernel/kernel
13 160603 /boot/kernel/kernel
14
15 guest_12 % ./prtblknos /dev/gpt/rootfs 160603
16 160603: lbn 0-7 blkno 3217584-3217647
17         lbn 8-11 blkno 3217864-3217895 distance 216
18 First-level indirect, blkno 3217896-3217903 distance 0
19         lbn 12-19 blkno 3217904-3217967 distance 8
20         lbn 20-75 blkno 3251816-3252263 distance 33848
21         lbn 76-83 blkno 3252368-3252431 distance 104
22         lbn 84-91 blkno 3252464-3252527 distance 32
23         lbn 92-852 blkno 3252896-3258983 distance 368
24
25 Each contiguous range of blocks is printed on a line.
26 The distance metric is the size of the gap from the end of the
27 previous set of blocks to the beginning of the next set of blocks.
28 Short distances are desirable.
29
30 The logical block numbers (lbn above) describe filesystem-block
31 size blocks which by today's default is 32Kb.
32
33 The physical block numbers (blkno above) describe the smallest piece
34 of disk space that an inode can reference which is a filesystem
35 fragment. Since the default size for fragments today is 4Kb, the
36 physical block numbers reference 4Kb blocks. The distances listed
37 above are also in physical block size units. Thus a distance of 8
38 means a separation of just one 32Kb block. For example lbn 11, ends
39 at 3217895, the 32Kb first level indirect immediately follows it at
40 3217896-3217903, and lbn 12 starts distance 8 after lbn 11 immediately
41 after the indirect block at 3217904.
42
43 If you were to create a filesystem with the fragment size equal to
44 half the block size (say 32Kb blocks with 16Kb fragments) then the
45 physical block numbers listed would be 16Kb in size.
46
47         Marshall Kirk McKusick
48         January 19, 2018