I've been using dd
in Linux to overwrite an external USB hard drive.
When I use the default block size of 512 bytes, with this command:
# dd if=/dev/zero of=/dev/sdb
throughout the whole operation, the hard drive (/dev/sdb) is being read from and written to alternately, approximately 1GB at a time. I.e. read 1GB
...write 1GB
...read 1GB
...write 1GB
etc. As much data is read from the hard drive as is written to it.
I know this is happening because it's showing in my custom Conky panel (diskio_read
, diskio_write
), which I know to be a 100% reliable indicator of disk I/O activity.
I've repeated this using a different external hard drive on a different computer. It happens via both USB 2.0 and USB 3.0.
In contrast, when I do the same thing, but use a block size of 1MB instead, with this command:
# dd if=/dev/zero of=/dev/sdb bs=1M
apart from a small amount of reading at the start, the hard drive is not read from at all during the operation.
Given that this phenomenon has happened on two different computers and two different hard drives of mine, using a standard Linux distro (Xubuntu 14.04), anyone who wants to should presumably be able to replicate it on their own computer.
Can someone please explain what is happening here?
grep . /sys/block/sdb/queue/*size*
give? – Stéphane Chazelas Dec 03 '15 at 17:16cat
. – Gilles 'SO- stop being evil' Dec 03 '15 at 23:45cat
. – EmmaV Dec 06 '15 at 00:28