next up previous contents index
Next: sortthe data sorter Up: ddthe data duplicator Previous: Options

Examples

The canonical example is the one you have probably bumped at when you tried to create the first Linux diskette: how to write to a floppy without a MS-DOS filesystem. The solution is simple:

% dd if=disk.img of=/dev/fd0 obs=18k count=80
I decided not to use ibs because I don't know which is the better block size for a hard disk, but in this case no harm would have been if instead of obs I use bs - it could even be a trifle quicker. Notice the explicitation of the number of sectors to write (18KB is the occupation of a sector, so count is set to 80) and the use of the low-level name of the floppy device.

Another useful application of dd is related to the network backup. Let's suppose that we are on machine alpha and that on machine beta there is the tape unit /dev/rst0 with a tar file we are interested in getting. We have the same rights on both machines, but there is no space on beta to dump the tar file. In this case, we could write

% rsh beta 'dd if=/dev/rst0 ibs=8k obs=20k' | tar xvBf -
to do in a single pass the whole operation. In this case, we have used the facilities of rsh to perform the reading from the tape. Input and output sizes are set to the default for these operations, that is 8KB for reading from a tape and 20KB for writing to ethernet; from the point of view of the other side of the tar, there is the same flow of bytes which could be got from the tape, except the fact that it arrives in a rather erratic way, and the option B is necessary.

I forgot: I don't think at all that dd is an acronym for ``data duplicator'', but at least this is a nice way to remember its meaning ...


next up previous contents index
Next: sortthe data sorter Up: ddthe data duplicator Previous: Options

Converted on:
Mon Apr 1 08:59:56 EST 1996