I have a QEMU image myserver.img
that is about 20GiB. The file serves as a "virtual" hard disk for the server. Now the first 512 bytes contain the MBR, and I am trying to overwrite those bytes with zeroes. On a normal disks, this one would work:
dd if=/dev/zero of=/dev/sda bs=512 count=1
But when I try that on the image file, the file gets overwritten and is only 512 bytes in size (instead of 20GiB). Is there a way to change only the first 512 bytes, preferably with dd
?
Add
conv=notrunc
:Try using dd with
conv=notrunc
From the dd man page
e.g.