[linux-lvm] Repair thin pool

M.H. Tsai mingnus at gmail.com
Thu Feb 18 14:22:41 UTC 2016

2016-02-18 15:17 GMT+08:00 Mars <kirapangzi at gmail.com>:
> Hi,
> We have tried your tools, here's the result:
> <superblock>
>   <device dev_id="7050">
>   </device>
>   <device dev_id="7051">
>   </device>
> ...
> </superblock>
> <orphans>
>   <node blocknr="22496" flags="2" key_begin="0" key_end="128" nr_entries="126"/>
>   <node blocknr="17422" flags="2" key_begin="0" key_end="128" nr_entries="126"/>
>   <node blocknr="23751" flags="2" key_begin="0" key_end="2175" nr_entries="126"/>
> ...
>   <node blocknr="26257" flags="2" key_begin="7972758" key_end="50331647" nr_entries="242"/>
> </orphans>
> The output file have nearly 20000 lines and you can find it in attachment.

Looks strange. How many thin volumes do you have? The top-level
mappings tree contains 208 keys, so the top-level mapping tree might
point to a wrong location. Also, no mapped value was output, not sure
if it is a bug...

1. Please run lvs to show the device id
lvs -o lv_name,thin_id
The try to find the orphan nodes with key range containing the device
ids. That could be the real top-level tree node.

2. What's your pool chunk size?
lvs vgg145155121036c/pool_nas -o chunksize

3. Could you please provide your RAW metadata for me to debug? I want
to know why the output went wrong...
You don't need to dump the entire 16GB metadata:

(1) Please run thin_scan to know the metadata utilization (do not rely
on the metadata space map)

./pdata_tools thin_scan /dev/mapper/vgg145155121036c-pool_nas_tmeta0

You don't need to wait for it to complete scanning. Ctrl-C to stop the
program when it stuck for some minutes. The last line is the last
utilized metadata block. For example:

<single_block type="btree_leaf" location="234518" blocknr="234518"
ref_count="0" is_valid="1" value_size="4"/>
<single_block type="btree_leaf" location="234519" blocknr="234519"
ref_count="0" is_valid="1" value_size="32"/>
<single_block type="index_block" location="234520" blocknr="234520"
ref_count="0" is_valid="1"/>
(the program stuck here, break the program)

Then block#234520 is the last utilized metadata block. Usually it is
an index_block.

(2) dump & compress the used part. Send me the file if you can.
dd if=/dev/mapper/vgg145155121036c-pool_nas_tmeta0 of=tmeta.bin bs=4K
tar -czvf tmeta.tar.gz tmeta.bin

Ming-Hung Tsai

More information about the linux-lvm mailing list