Copying memstick image to a USB (flash/thumb) drive

Ronald F. Guilmette rfg at tristatelogic.com
Fri Mar 29 01:17:24 UTC 2013


In message <51543B7A.4030300 at qeng-ho.org>, 
Arthur Chance <freebsd at qeng-ho.org> wrote:

>On 03/28/13 10:32, Ronald F. Guilmette wrote:
>> It is possible, I would guess, that dd may notice the EOF occuring
>> before it has filled up an entire input buffer, and then just quit
>> at that point, _without_ writing the partial last block to the
>> output device.
>
>It will attempt to write a short block. E.g.
>
>arthur at fileserver[2]> ls -l t.pdf
>-rw-rw-r--  1 arthur  arthur  233812 Feb 18 12:26 t.pdf
>arthur at fileserver[2]> dd if=t.pdf of=/dev/null bs=1k
>228+1 records in
>228+1 records out
>233812 bytes transferred in 0.036731 secs (6365521 bytes/sec)
>
>Those +1 records are the final short block.

OK.  Thanks.  That's definitely good to know.

I wonder if this behavior is documented in the man page.  (It certainly
should be, if it isn't already.)

>> It seems to me that conv=sync is cheap insurance against this
>> possibility.
>
>It's used as an insurance against output devices which have a fixed (or 
>in the case of tape, a minimum) block size. If the short block is not an 
>exact integer multiple of the device block size then the final write 
>will fail.

Right.  I understand.

>conv=sync and a bs (or obs) that's a strict multiple of block 
>size prevents the problem. That's exactly your use case.

Right.


Regards,
rfg


More information about the freebsd-questions mailing list