2

I have 40gb image split into 10 4gb files, then combined with dm-linear to create single 40gb drive. One file got damaged single 4kb sector. However when I'm copying data unsing either dd or ddrescue resulting file is 4kb smaller than original file. It results in VM boot failure due to invalid physical disk size. How can i copy this image and fill this 4kb sector with 0s to preserve file size and offsets?

3

Use dd bs=4k conv=sync,noerror if=damaged_source_image of=destination_image

With noerror, dd will continue after encountering a read error. With sync, the unread bytes (due to the read error) will be written as zeros.

See this question for an extended discussion on this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.