{"id":5000,"date":"2021-02-25T23:54:43","date_gmt":"2021-02-25T23:54:43","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=5000"},"modified":"2021-02-25T23:54:43","modified_gmt":"2021-02-25T23:54:43","slug":"qnap-thin-pool-repair","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/qnap-thin-pool-repair","title":{"rendered":"Qnap Thin pool repair"},"content":{"rendered":"<p><strong>Stop all of services and umount all of volumes<\/strong><\/p><p><strong>Step1: Stop all of services<\/strong><\/p><p>\/etc\/init.d\/services.sh stop<\/p><p>\/etc\/init.d\/qsnapman.sh stop<\/p><p>\/sbin\/daemon_mgr lvmetad stop &#8220;\/sbin\/lvmetad&#8221; rm \/var\/run\/lvm\/lvmetad.socket<\/p><p><strong>Step2: Confirm which volume group or pool need to repair<\/strong><\/p><p>pvs # list all of volume groups<\/p><p>lvs -a # list all of volumespools and volume groups<\/p><p>lvs -o+time # can list the created date\/time of volumespools lvs -o+thin_id # can list the devices id of volumes<\/p><p><strong>Check Volume Groups using &#8220;pvs&#8221; command<\/strong><\/p><p>PV VG Fmt Attr PSize PFree<\/p><p>\/dev\/drbd1 vg1 lvm2 a&#8211; 7.24t 0 # \/dev\/drbd1 indicates md1(RAID group 1)<\/p><p>\/dev\/drbd2 vg2 lvm2 a&#8211; 7.26t 0 # \/dev\/drbd2 indicates md1(RAID group 2)<\/p><p>.<\/p><p>.<\/p><p>.<\/p><p># One Volume Group may include &gt;= 2 RAID groups<\/p><p><strong>Check devices on the volume group\/pool which we need to repair using &#8220;lvs -a&#8221; command<\/strong><\/p><table><tbody><tr><td><p>LV<\/p><\/td><td><p>VG<\/p><\/td><td><p>Attr<\/p><\/td><td><p>LSize<\/p><\/td><td colspan=\"2\"><p>Pool Origin<\/p><\/td><td><p>Data% Meta%<\/p><\/td><td><p>Move Log Cpy%Sync<\/p><\/td><\/tr><tr><td><p>Convert<\/p><\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td colspan=\"2\">\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><\/tr><tr><td><p>lv1<\/p><\/td><td><p>vg1<\/p><\/td><td><p>Vwi-aot&#8212;<\/p><\/td><td><p>6.00t<\/p><\/td><td colspan=\"2\"><p>tp1<\/p><\/td><td><p>100.00<\/p><\/td><td><p># Data volume 1<\/p><\/td><\/tr><tr><td><p>lv1312<\/p><\/td><td><p>vg1<\/p><\/td><td><p>-wi-ao&#8212;-<\/p><\/td><td><p>756.00m<\/p><\/td><td colspan=\"2\"><p># snapshots pool<\/p><\/td><td>\u00a0<\/td><td>\u00a0<\/td><\/tr><tr><td><p>lv2<\/p><\/td><td><p>vg1<\/p><\/td><td colspan=\"3\"><p>Vwi-aot&#8212; 200.00g tp1<\/p><\/td><td colspan=\"2\"><p>100.00<\/p><\/td><td><p># Data volume 2<\/p><\/td><\/tr><tr><td><p>lv544<\/p><\/td><td><p>vg1<\/p><\/td><td colspan=\"3\"><p>-wi&#8212;&#8212;- 74.14g<\/p><\/td><td colspan=\"2\"><p># Reserved to repairing temporary<\/p><\/td><td>\u00a0<\/td><\/tr><tr><td><p>snap10001<\/p><\/td><td><p>vg1<\/p><\/td><td><p>Vwi-aot&#8212;<\/p><\/td><td colspan=\"2\"><p>6.00t tp1<\/p><\/td><td><p>lv1<\/p><\/td><td><p>100.00<\/p><\/td><td><p># Snapshot volume<\/p><\/td><\/tr><tr><td><p>snap10002<\/p><\/td><td><p>vg1<\/p><\/td><td><p>Vwi-aot&#8212;<\/p><\/td><td colspan=\"2\"><p>6.00t tp1<\/p><\/td><td><p>lv1<\/p><\/td><td><p>100.00<\/p><\/td><td><p># Snapshot volume<\/p><\/td><\/tr><tr><td><p>.<\/p><\/td><td>\u00a0<\/td><td>\u00a0<\/td><td colspan=\"2\">\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><\/tr><tr><td><p>.<\/p><\/td><td>\u00a0<\/td><td>\u00a0<\/td><td colspan=\"2\">\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><\/tr><tr><td><p>.<\/p><\/td><td>\u00a0<\/td><td>\u00a0<\/td><td colspan=\"2\">\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><\/tr><\/tbody><\/table><p><strong>Step3: Assume vg1 need to repair, we need to umount the volumes which belong to the vg1(lv1 will be mounted in \/share\/CACHEDEV1_DATA&#8230;.. and so on&#8230;.)<\/strong><\/p><p><strong>If there is any volumes or snapshots which is mounted and the mounted volumes belong to the volume group which need to repair, please umount them<\/strong><\/p><p># below umount all of data volumes umount \/share\/CACHEDEV1_DATA<\/p><p>umount \/share\/CACHEDEV2_DATA<\/p><p>.<\/p><p>.<\/p><p>umount \/share\/CACHEDEV${#}_DATA<\/p><p># below umount snapshots umount \/dev\/mapper\/vg1-snap*<\/p><p><strong>if can not umount, lsof \/share\/CACHEDEV{#}_DATA to check, and &#8220;kill -9&#8221; these process. Try to umount the volumes again.<\/strong><\/p><p><strong>Remove all of cache devices and inactivate volume group<\/strong><\/p><p><strong>Step1: You can list which cache devices on the pool:<\/strong><\/p><p>ls -l \/dev\/mapper\/ # will list all of devices on the pool<\/p><p><strong>Step2: The result of the above command looks like below(below assume vg1 is the volume group which need to repair)<\/strong><\/p><table><tbody><tr><td><p>brw&#8212;&#8212;-<\/p><\/td><td><p>1<\/p><\/td><td><p>admin<\/p><\/td><td><p>administrators<\/p><\/td><td><p>253,<\/p><\/td><td><p>9<\/p><\/td><td><p>2020-02-15<\/p><\/td><td><p>10:16<\/p><\/td><td><p>cachedev1<\/p><\/td><\/tr><tr><td><p>brw&#8212;&#8212;-<\/p><\/td><td><p>1<\/p><\/td><td><p>admin<\/p><\/td><td><p>administrators<\/p><\/td><td><p>253,<\/p><\/td><td><p>50<\/p><\/td><td><p>2020-02-15<\/p><\/td><td><p>10:16<\/p><\/td><td><p>cachedev2<\/p><\/td><\/tr><tr><td><p>crw&#8212;&#8212;-<\/p><\/td><td><p>1<\/p><\/td><td><p>admin<\/p><\/td><td><p>administrators<\/p><\/td><td><p>10,<\/p><\/td><td><p>236<\/p><\/td><td><p>2020-02-15<\/p><\/td><td><p>18:14<\/p><\/td><td><p>control<\/p><\/td><\/tr><tr><td><p>brw&#8212;&#8212;-<\/p><\/td><td><p>1<\/p><\/td><td><p>admin<\/p><\/td><td><p>administrators<\/p><\/td><td><p>253,<\/p><\/td><td><p>7<\/p><\/td><td><p>2020-02-15<\/p><\/td><td><p>10:16<\/p><\/td><td><p>vg1-lv1<\/p><\/td><\/tr><tr><td><p>brw&#8212;&#8212;-<\/p><\/td><td><p>1<\/p><\/td><td><p>admin<\/p><\/td><td><p>administrators<\/p><\/td><td><p>253,<\/p><\/td><td><p>8<\/p><\/td><td><p>2020-02-15<\/p><\/td><td><p>10:16<\/p><\/td><td><p>vg1-lv1312<\/p><\/td><\/tr><tr><td><p>brw&#8212;&#8212;-<\/p><\/td><td><p>1<\/p><\/td><td><p>admin<\/p><\/td><td><p>administrators<\/p><\/td><td><p>253,<\/p><\/td><td><p>10<\/p><\/td><td><p>2020-02-15<\/p><\/td><td><p>10:16<\/p><\/td><td><p>vg1-lv2<\/p><\/td><\/tr><tr><td><p>brw&#8212;&#8212;-<\/p><\/td><td><p>1<\/p><\/td><td><p>admin<\/p><\/td><td><p>administrators<\/p><\/td><td><p>253,<\/p><\/td><td><p>11<\/p><\/td><td><p>2020-02-18<\/p><\/td><td><p>01:00<\/p><\/td><td><p>vg1-snap10001<\/p><\/td><\/tr><tr><td><p>brw&#8212;&#8212;-<\/p><\/td><td><p>1<\/p><\/td><td><p>admin<\/p><\/td><td><p>administrators<\/p><\/td><td><p>253,<\/p><\/td><td><p>13<\/p><\/td><td><p>2020-02-19<\/p><\/td><td><p>01:00<\/p><\/td><td><p>vg1-snap10002<\/p><\/td><\/tr><tr><td><p>brw&#8212;&#8212;-<\/p><\/td><td><p>1<\/p><\/td><td><p>admin<\/p><\/td><td><p>administrators<\/p><\/td><td><p>253,<\/p><\/td><td><p>15<\/p><\/td><td><p>2020-02-20<\/p><\/td><td><p>01:00<\/p><\/td><td><p>vg1-snap10003<\/p><\/td><\/tr><tr><td><p>brw&#8212;&#8212;-<\/p><\/td><td><p>1<\/p><\/td><td><p>admin<\/p><\/td><td><p>administrators<\/p><\/td><td><p>253,<\/p><\/td><td><p>17<\/p><\/td><td><p>2020-02-21<\/p><\/td><td><p>01:00<\/p><\/td><td><p>vg1-snap10004<\/p><\/td><\/tr><tr><td><p>brw&#8212;&#8212;-<\/p><\/td><td><p>1<\/p><\/td><td><p>admin<\/p><\/td><td><p>administrators<\/p><\/td><td><p>253,<\/p><\/td><td><p>19<\/p><\/td><td><p>2020-02-22<\/p><\/td><td><p>01:00<\/p><\/td><td><p>vg1-snap10005<\/p><\/td><\/tr><tr><td><p>.<\/p><\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><\/tr><tr><td><p>.<\/p><\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><\/tr><tr><td><p>.<\/p><\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><td>\u00a0<\/td><\/tr><\/tbody><\/table><p><strong>Step3: Find cachedev${#} and remove them using dmsetup<\/strong><\/p><p>dmsetup remove cachedev1 dmsetup remove cachedev2<\/p><p>.<\/p><p>.<\/p><p>.<\/p><p>dmsetup remove cachedev${#}<\/p><p><strong>Step4: Inactivate the volume group which need to repair<\/strong><\/p><p>lvchange -an vg1 # Assume vg1 is the volume group which need to repair<\/p><p><strong>Step5: Please check again with &#8220;ls -l \/dev\/mapper&#8221; command to confirm there is no any block device of vg1. The result should be the below:<\/strong><\/p><p>crw&#8212;&#8212;- 1 admin administrators 10, 236 2020-02-15 18:14 control<\/p><p><strong>Collect logs of thin pool metadata and backup metadata of the thin pool<\/strong><\/p><p><strong>Step1: Download collect tools<\/strong><\/p><p><a href=\"http:\/\/download.qnap.com\/Storage\/tsd\/utility\/tp_collect.sh\">wget http:\/\/download.qnap.com\/Storage\/tsd\/utility\/tp_collect.sh<\/a><\/p><p><strong>Step2: Execute collect tools to collect logs of the metadata or backup metadata of the pool<\/strong><\/p><p>sh tp_collect.sh<\/p><p><strong>When the tp_collect.sh start running, please remember enter \u201cpool id\u201d. The pool id is the id of the pool which we want to repair. For examples: vg1\/tp1, please input 1vg2\/tp2, please input 2&#8230;&#8230;and so on&#8230;..<\/strong><\/p><p><strong>If execute tp_collect fail, you need to let the customer plug one USB external drive(about 100G or more) in the NAS to backup metadata<\/strong><\/p><p># assume vg1\/tp1 need to collect or repair lvchange -ay vg1\/tp1_tmeta<\/p><p># Change directory to the USB external device cd \/share\/external\/DEVXXXXXX<\/p><p># backup metadata using dd command<\/p><p>dd if=\/dev\/mapper\/vg1-tp1_tmeta of=tmeta.bin bs=1M<\/p><p><strong>If tp_collect is executed completely or successfully, you can skip the above flow and please backup collect.tgz.<\/strong><\/p><p><strong>Step 3: Please confirm the backup of metadata is correct<\/strong><\/p><p># A. thin check original metadata<\/p><p>pdata_tools_8192(or 4096) thin_check \/dev\/mapper\/vg1-tp1_tmeta<\/p><p># B. thin check backup metadata<\/p><p>pdata_tools_8192(or 4096) thin_check \/mnt\/collect\/tmeta.bin # If the metadata is backup in the USB external drive, please pdata_tools_8192(or 4096) thin_check \/share\/external\/DEVXXXXXX\/tmeta.bin<\/p><p><strong>The result of the above A, B need to be the same. If the A, B is the same, Please be sure to backup the tmeta.bin to another storage or USB<\/strong><\/p><p><strong>external drive!!! If the vg{#}-tp{#} repaired fail, the vg{#}-tp{#}_tmeta can be restored using tmeta.bin.<\/strong><\/p><p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Stop all of services and umount all of volumesStep1: Stop all of services\/etc\/init.d\/services.sh stop\/etc\/init.d\/qsnapman.sh stop\/sbin\/daemon_mgr lvmetad stop &#8220;\/sbin\/lvmetad&#8221; rm \/var\/run\/lvm\/lvmetad.socketStep2: Confirm which volume group or pool need [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3449,3451],"class_list":["post-5000","post","type-post","status-publish","format-standard","hentry","category-research","tag-qnap","tag-thin-pool-repair"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/5000","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=5000"}],"version-history":[{"count":2,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/5000\/revisions"}],"predecessor-version":[{"id":5002,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/5000\/revisions\/5002"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=5000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=5000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=5000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}