From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1LFfeQm024474 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sun, 21 Feb 2016 10:41:40 -0500 Received: from mail-qg0-f54.google.com (mail-qg0-f54.google.com [209.85.192.54]) by mx1.redhat.com (Postfix) with ESMTPS id F2FC1C1F7B for ; Sun, 21 Feb 2016 15:41:38 +0000 (UTC) Received: by mail-qg0-f54.google.com with SMTP id y9so96908018qgd.3 for ; Sun, 21 Feb 2016 07:41:38 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: Date: Sun, 21 Feb 2016 23:41:38 +0800 Message-ID: From: "M.H. Tsai" Subject: Re: [linux-lvm] Repair thin pool Reply-To: LVM general discussion and development List-Id: LVM general discussion and development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , List-Id: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: LVM general discussion and development Cc: Mars Hi, I updated the program with some bug fix. Please download it again. https://www.dropbox.com/s/6g8gm1hndxp3rpd/pdata_tools?dl=0 Here's a quick guide to manually repair a metadata, if thin_repair doesn't help. 1. Run thin_scan to do some basic checking ./pdata_tools thin_scan [-o ] The output contains information about: (1) metadata blocks' type, properties, and integrity (2) metadata utilization, then you can ignore the rest of metadata (usually, the last block is an index_block) Example output: ... 2. Check data mapping tree and device details tree If you don't know how to use thin_debug or superblock's layout, then you can use thin_ll_dump to obtain the tree roots: ./pdata_tools thin_ll_dump [-o ] \ [--end ] Example output: ... ... According to thin_scan's output, we know that the data_mapping_root and device_details_root points to a wrong location. That's why thin_dump doesn't work. ... 3. Find the correct data mapping root and device details root (1) If you are using LVM, run lvs to know the thin device ids. That's the key for data mapping tree and device details tree. Try to find the nodes with key ranges containing the device ids (see thin_scan's output) (2) For device details tree, if you have less than 127 thin volumes, then the tree root is also a leaf. Check the nodes with value_size="24". Example: (1) data_mapping_root = 22917 or 25316 (see thin_ll_dump's output) (2) device_details_root = 26263 or 26267 (see thin_scan's output) Currently, thin_ll_dump only lists orphan nodes with value_size==8, so the orphan device-details leaves won't be listed. 4. Run thin_ll_dump with correct root information: ./pdata_tools thin_ll_dump --device-details-root= \ --data-mapping-root= [-o thin_ll_dump.xml] \ [--end=] Example: ./bin/pdata_tools thin_ll_dump server_meta.bin --device-details-root=26263 \ --data-mapping-root=22917 -o thin_ll_dump2.xml --end=26269 If the roots are correct, then the number of orphans should be less than before. 5. Run thin_ll_restore to recover the metadata ./bin/pdata_tools thin_ll_restore -i \ -E -o Example (restore to /dev/loop0): ./bin/pdata_tools thin_ll_restore -i thin_ll_dump.xml -E server_meta.bin \ -o /dev/loop0 Advance use of thin_ll_restore =============================== 1. Handle the case if the root was broken, and you can only find some internal or leaf nodes. Example: All the mappings reachable from block#1234 and #4567 will be dumped to device#1. ... 2. Create a new device If the device_id cannot be found in the device details tree, then thin_ll_dump will create a new device with default device_details values. Please let me know if you have any questions. Ming-Hung Tsai 2016-02-18 15:17 GMT+08:00 Mars : > Hi, > We have tried your tools, here's the result: > > ... > > The output file have nearly 20000 lines and you can find it in attachment. > > Thank you very much. > Mars