[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] a tiny tool for checking and repairing damaged qcow2 im
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] a tiny tool for checking and repairing damaged qcow2 image |
Date: |
Wed, 16 Aug 2017 07:55:58 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Cc'ing QCOW2 maintainer.
ÕÅÓÑ¼Ó <address@hidden> writes:
> Hi,
>
> I want to introduce a tiny tool(https://github.com/zhangyoujia/qcow2-dump)
> for checking and repairing damaged qcow2 image.
>
> I met many damaged qcow2 images when I work.
>
> It does't always work by using the qemu-img command to check and repair these
> damaged qcow2 images.
>
> The functions of the qemu-img check command are too limited for developers.
>
> It's difficult to known where is damaged, and difficult to repair the damage
> too.
>
> For example: more than one active L2 entries point to the same active
> cluster(mostly caused by refcount error), such as:
>
> Active Cluster:
> ----------------------------------------------------------------
> REUSED cluster offset: 0x44000000 | l1_index: 2, l2_index: 1017 |
> refcount: 2
> REUSED cluster offset: 0x44000000 | l1_index: 12, l2_index: 7780
>
> REUSED cluster offset: 0x45000000 | l1_index: 2, l2_index: 1273 |
> refcount: 2
> REUSED cluster offset: 0x45000000 | l1_index: 12, l2_index: 6742
>
> REUSED cluster offset: 0x4a000000 | l1_index: 2, l2_index: 2553 |
> refcount: 2
> REUSED cluster offset: 0x4a000000 | l1_index: 12, l2_index: 7068
>
> The results of qemu-img check command are wrong which only show refcount
> errors and copied errors, but do not show the active cluster reused errors.
> so if you use qemu-img check -r sub-command to repair this qcow2 image, it
> only increases refcount of the reused cluster, but does not rebuild the
> reused active cluster. that does't work. (eg: reused_active_cluster.png)
>
> That's why I want to make a tool has more functions.
>
> qcow2-dump has some improvements compare with qemu-img check command:
>
> 1. -m check: output the status of qcow2 image and statistics of metadata.
> (eg: rebuild_refcount_table.png)
>
> 2. -m error: output of -m check + the damaged positions of qcow2 image. (eg:
> reused_active_cluster.png & error.tgz)
>
> 3. -m dump: output of -m error + dump all metadata of qcow2 image. (eg:
> dump.tgz)
>
>
> qcow2-dump also has some functions for repairing damaged qcow2 image:
>
> 1. rebuild damaged refcount table. (eg: rebuild_refcount_table.png)
> qcow2-dump -R all rebuild_refcount_table.qcow2
>
> 2. rebuild reused active cluster. (eg: reused_active_cluster.png)
> qcow2-dump -R all -r reused_active_cluster.qcow2
>
> 3. delete damaged qcow2 snapshot header. (eg: invalid_snapshot_header.png)
> qcow2-dump -D snapshot[0] vm-disk-2.qcow2
>
> 4. -m edit / -m copy: for repairing some special damage. (eg: comments of
> qcow2_edit_modify is a instance)
>
> ...
>
> But this tool is not good enough yet, hope to receive your advices to improve
> it.
>
> Best wishes
> youplus