Hello Bret! > Bret Quigley II wrote: >> Now, obviously that last data block is empty, but I'd still expect it >> to be present in the outfile, the same as any other empty block.
I might add that this is actually no inconsistency, because as Antonio clarified all "empty" blocks (= no input read) are not explicitly written (as zeros) but seeked over to the next write location. With --sparse output this skipping also applies to writes that would be all zeros. Even the -x (--extend-outfile) option will either just set the file size or fall back to seeking to the last byte position and write a single zero there. For non sparse output files (or where they are not supported) it is the filesystem that will fill the gaps with zeros after ddrescue is done. That’s why writing a few bytes to the end of a large file (e.g. when starting backwards) will be fast in ddrescue, but sometimes you can notice a delay with heavy disk writing activity after the file handle is closed. Antonio Diaz Diaz wrote: > It is nice that partclone saves the size of the partition in current_pos. All > you need to do is adding '-x 0x40000000' to your ddrescue command. Yes it’s wonderful that we can just pass the hex value as-is! However, in this particular case another option to use would be -p (--preallocate). It doesn’t need an argument and has the advantage to work correctly even if -i and/or -o are used (e.g. when mixing partitions and drives), while the argument to -x would have to be adapted. Kind regards, Florian > Am 27.01.2025 um 19:08 schrieb Antonio Diaz Diaz <[email protected]>: > > Hello Bret, > > Bret Quigley II wrote: >> First of all, let me just say thank you for the excellent ddrescue; >> I've used it to great success for many years. > > You are welcome! :-) > >> Today I discovered a surprising behavior that seems (to me) to be a >> bug: using `--domain-mapfile` omits trailing empty space in the >> created outfile. > > This is the expected behavior. It works just like '--size 1GiB', which copies > at most 1 GiB of data but does not extend the output file to 1 GiB. Ddrescue > does not write zeros to the output when it does not read anything from the > input. Just imagine if the mapfile had a extent of 8 EiB, as is the case when > ddrescue can't find out the size of the input device. > >> # Domain logfile created by partclone.ext4 v0.3.32 >> # Source: /dev/sdc1 >> # Offset: 0x00000000 >> # current_pos current_status >> 0x40000000 ? > > >> I can also get the expected output using `--extend-outfile`, e.g.: >> >> # ddrescue --domain-mapfile partclone-domain-mapfile --extend-outfile >> 1GiB /dev/sdc1 out.img out.log >> >> But that seems like an unnecessary workaround. > > As stated above, using -x is not an unnecessary workaround. Extending the > output file by default would be inconsistent and would cause real trouble. > > Best regards, > Antonio. >
