3 ms·
> Am I just getting lucky with a race condition? Probably this is buffering, either from dd or from the kernel. $ dd if=/dev/urandom bs=1M count=1 of=test.b
by moonchild 6y ago
> Am I just getting lucky with a race condition?
Probably this is buffering, either from dd or from the kernel.
$ dd if=/dev/urandom bs=1M count=1 of=test.bin 2>/dev/null
$ cp test.bin test2.bin
$ cat < test2.bin | tee test2.bin >/dev/null
$ diff test.bin test2.bin
Binary files test.bin and test2.bin differ
$ wc -c test{2,}.bin
131072 test2.bin
1048576 test.bin
Notice the file got truncated at exactly 128k; a nice round size for a write cache.