Am 10.06.2020 um 14:19 hat Sam Eiderman geschrieben: > Thanks David, > > Yes, I imaging the following use case: > > disk.vmdk is a 50 GB disk that contains 12 MB binary of zeroes in its > beginning. > /dev/sda is a raw disk containing garbage > > I invoke: > qemu-img convert disk.vmdk -O raw /dev/sda > > Required output: > The first 12 MB of /dev/sda contain zeros, the rest garbage, qemu-img > finishes fast. > > Kevin, from what I understood from you, this is the default behavior.
Sorry, I misunderstood what you want. qemu-img will write zeros to all unallocated parts, too. If it didn't do that, the resulting image on /dev/sda wouldn't be a copy of disk.vmdk. As the metadata (which blocks are allocated) cannot be preserved in raw images, you wouldn't be able to tell which part of the image contains valid data and which part needs to be interpreted as zeros even though it contains random garbage. What is your use case for this result where the actual virtual disk content is mixed with garbage? Kevin