On 06/12/15 15:20, Ivan Pozdeev wrote: > Hello Coreutils, > > The subj is a requirement if I'm copying between overlapping regions, and the > destination is further in the media than the source. > > The specific task I'm having is to move a partition a number of sectors > forward. > > To be completely clear, the algorithm is: copy a block, then seek to the > previous block (i.e. 2*bs bytes back). > > I don't currently see a use case for setting this for input/output > independently. > > An idea for the option name is `d'. > > There is a workaround for my particular case - `dd if=<block_device> > bs=<2*shift_bytes> | dd > of=<block_device> seek=<shift_blocks>' but it requires a few times > 2*shift_bytes of memory.
I see dd_rescue (and ddrescue) have "operate in reverse" options. The reason stated being: "If you have one spot of bad sectors within the partition, it might be a good idea, to approach this spot from both sides." For your use case you could compute the size and offset of the overlap, and use 2 dd invocations to copy the overlap area, then the rest. Or perhaps more simply use a loop to iterate in reverse using an appropriately large blocksize to minimize dd invocations. So while this is useful it is a bit of an edge case and there are alternatives using other tools or multiple dd invocations. I'd be 60:40 against adding it. cheers, Pádraig.
