xref: /freebsd/tools/diag/prtblknos/README (revision 10ff414c)
1# $FreeBSD$
2
3This is a little C-program that can be used to print out the list
4of blocks used by a requested list of inodes.
5
6For example, to list the blocks referenced by your kernel:
7
8guest_12 % df /
9Filesystem      1K-blocks     Used   Avail Capacity  Mounted on
10/dev/gpt/rootfs  20307196 10707336 7975288    57%    /
11
12guest_12 % ls -i /boot/kernel/kernel
13160603 /boot/kernel/kernel
14
15guest_12 % ./prtblknos /dev/gpt/rootfs 160603
16160603:	lbn 0-7 blkno 3217584-3217647
17	lbn 8-11 blkno 3217864-3217895 distance 216
18First-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
25Each contiguous range of blocks is printed on a line.
26The distance metric is the size of the gap from the end of the
27previous set of blocks to the beginning of the next set of blocks.
28Short distances are desirable.
29
30The logical block numbers (lbn above) describe filesystem-block
31size blocks which by today's default is 32Kb.
32
33The physical block numbers (blkno above) describe the smallest piece
34of disk space that an inode can reference which is a filesystem
35fragment. Since the default size for fragments today is 4Kb, the
36physical block numbers reference 4Kb blocks. The distances listed
37above are also in physical block size units. Thus a distance of 8
38means a separation of just one 32Kb block. For example lbn 11, ends
39at 3217895, the 32Kb first level indirect immediately follows it at
403217896-3217903, and lbn 12 starts distance 8 after lbn 11 immediately
41after the indirect block at 3217904.
42
43If you were to create a filesystem with the fragment size equal to
44half the block size (say 32Kb blocks with 16Kb fragments) then the
45physical block numbers listed would be 16Kb in size.
46
47	Marshall Kirk McKusick
48	January 19, 2018
49