Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Dec 2007 17:27:00 GMT
From:      Sean Bruno <sbruno@miralink.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/119068: dd yields a bogus error when input file is to small for output device
Message-ID:  <200712271727.lBRHR0hA071713@www.freebsd.org>
Resent-Message-ID: <200712271730.lBRHU4xd016407@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712271727.lBRHR0hA071713>