I was gonna copy a partition to another partition using dd (dd if=/dev/arch_data/root of=/dev/sdd3), and it worked. But then I accidentally re-ran the same command again, and it takes a while so I hit Control + C.

Will dd then cause any changes in data due to this?


The short answer is that you should be safe if both /dev/arch_data/root and /dev/sdd3 were not changed by anything else inbetween your two dd commands.

By default dd will copy data in blocks of 512 bytes which is the standard sector size of a hard drive (See Note 1). This means that if you stopped dd early it will have stopped after trying to write a whole sector of the hard drive. Under no circumstances does dd write something to disk and then change it. So if you stop early then nothing will have changed because the last thing dd did before stopping was to ask the OS to send a whole sector to disk.

Note 1

In recent years many hard drives have been manufactured with 4096 byte sectors. The hard drives will report to the OS that they support 512 byte sectors and they will behave correctly if the OS tries to write 512 bytes. But to make this work the hard drive internally reads a 4096 byte sector, changes 512 bytes and then writes back the whole 4096 bytes. This will not cause corruption. But this will slow down your write speed. If you don't know what hard drive you have then you might want to set bs=4096 just in case.

| improve this answer | |

Yes, dd will copy the data anytime you call it. Obviously, if you didn't change the input file (specified by if=), then the output file (specified by of=) will be the same. But some metadata will be changed, e.g., the last time the files were read or written (atime and mtime).

| improve this answer | |

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.