misc/119068: dd yields a bogus error when input file is to small for output device

Sean Bruno sbruno at miralink.com
Thu Dec 27 09:30:05 PST 2007


>Number:         119068
>Category:       misc
>Synopsis:       dd yields a bogus error when input file is to small for output device
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 27 17:30:04 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator:     Sean Bruno
>Release:        RELENG_6
>Organization:
Miralink Inc
>Environment:
FreeBSD desdemona.office.miralink.com 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 11:05:30 UTC 2007     root at dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP  i386

>Description:
When using dd with an input file smaller than the block size of an output device, the error generated doesn't give the end user any clue as to why the dd failed.

For example, create a text file with a size of 256 bytes and attempt to dd that file to a drive which has 512 byte blocks:

desdemona # ls -la test.txt                                                        
-rw-r--r--  1 root  wheel  256 Dec 28 01:47 test.txt

dd if=test.txt of=/dev/ad5
dd: /dev/ad5: Invalid argument

The error should give some kind of indication that the input file is too small to use with the ouput device.  eg:

dd: /dev/ad5: Input file is smaller than block size of ouput.
>How-To-Repeat:
Create a text file that is smaller than 1 512 byte block, eg use "jot -c 128 0 > testfile"

Attempt to dd that testfile to a SATA or IDE drive which has 512 byte blocks:

dd if=testfile of=/dev/adX
>Fix:
Use a file that is large than the block size of the drive.

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list