On 5/1/20 2:16 PM, François Revol wrote:
This allows to overlay bad sectors according to the mapfile generated by
ddrescue, to then see where sectors are used using fsck and trying to
copy files around.

Signed-off-by: François Revol <[email protected]>
---

Focusing on just the docs:

+++ b/filters/ddrescue/nbdkit-ddrescue-filter.pod
@@ -0,0 +1,74 @@
+=head1 NAME
+
+nbdkit-ddrescue-filter - nbdkit filter for serving from ddrescue dump
+
+=head1 SYNOPSIS
+
+ nbdkit --filter=ddrescue plugin [plugin-args...] ddrescue-mapfile=file.map
+
+ nbdkit --filter=ddrescue file file=file.img ddrescue-mapfile=file.map 
[plugin-args...]
+
+=head1 DESCRIPTION
+
+C<nbdkit-ddrescue-filter> is a filter for L<nbdkit(1)> which overlays
+bad blocks according to a GNU L<ddrescue(1)> mapfile.  This is mainly useful
+for testing disk images recovered with ddrescue, to detect which files
+or filesystem structures are impacted, or attempting fsck on them.

Oh cool, this sounds very similar to the existing extentlist plugin, but with a difference that extentlist uses the input to decide which portions of the file are advertised as sparse, while this one uses which portions of the file cause EIO errors during read. Is it worth trying to combine the two concepts into one filter, or do we want to keep it orthogonal as two separate filters? Can we teach both filters to reuse common code for parsing extent lists in different formats (the extentlist format is the same format documented by the nbdkit-sh-plugin .extents; yours is the ddrescue format, I am also interested in the 'qemu-img map --output=json' format)? In fact, if we introduce a common library for extent list parsing, teaching nbdkit-sh-plugin to accept all formats might be useful.

I ask this because one of my ideas for qemu-nbd and the 'qemu:dirty-bitmap:FOO' exposure of a bitmap is to have qemu-nbd report EIO for any part of the file not covered by the dirty bitmap. There is no easy way to emulate that in nbdkit yet (since nbdkit does not understand anything other than the base:allocation context), but this filter plus the nbd plugin would be a way to provide those semantics on top of existing qemu-nbd, if this filter could easily parse qemu-img's extent list.

+
+Note that the current implementation is read-only.
+
+=head1 EXAMPLES
+
+=over 4
+
+=item Expose a rescued disk image with detected bad sectors:
+
+ nbdkit --filter=ddrescue file file=disk.img ddrescue-mapfile=disk.map
+
+The above command serves the disk image disk.img and maps the bad
+sectors listed in disk.img so that read attempts on them do not return
+a valid block full of zeroes.

Wording suggestion:

and maps the bad sectors listed in disk.img so that read attempts over those portions of the file fail rather than returning a valid block containing garbage.

Or even make it configurable (via another .config knob) whether bad blocks read as zero or cause EIO.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

_______________________________________________
Libguestfs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to