copy and convert input blocks 



dd [bs=s] [cbs=s] [conv=conversion] [count=n] [ibs=s] [if=file] [imsg=string] [iseek=n] [obs=s] [of=file] [omsg=string] [seek=n] [skip=n]


dd reads and writes data by blocks, and can convert the data between formats. dd is frequently used for devices such as tapes which have discrete block sizes, or for fast multi-sector reads from disks. The conversions can accommodate computers that require de-blocking, conversion to/from EBCDIC and fixed length records.

dd processes input data as follows:

  1. dd reads an input block.
  2. If you specified conv=sync and this input block is smaller than the specified input block size, dd pads it to the specified size with null bytes. When you also specify a block or unblock conversion, dd uses spaces instead of null bytes.
  3. If you specified bs=size and requested no conversion other than sync or noerror, dd writes the input block (padded if necessary) to the output as a single block and omits the remaining steps.
  4. If you specified the swab conversion, dd swaps each pair of input bytes. If there is an odd number of input bytes, dd does not attempt to swap the last byte.
  5. dd performs all remaining conversions on the input data independently of the input block boundaries. A fixed-length input or output record may span these boundaries.
  6. dd gathers the converted data into output blocks of the specified size. When dd reaches the end of the input, it writes the remaining output as a block (with padding if conv=sync is specified). As a result, the final output block may be shorter than the output block size.



sets both input and output block sizes to size bytes. You can suffix this decimal number with w, b, k, or xnumber to multiply it by 2, 512, 1024, or number respectively. You can also specify size as two decimal numbers (with or without suffixes) separated by x to indicate the product of the two values. Processing is faster when ibs and obs are equal, since this avoids buffer copying. The default block size is 1b. bs=size supersedes any settings of ibs=size or obs=size.

If you specify bs=size and you request no other conversions than noerror, notrunc, or sync, dd writes the data from each input block as a separate output block; if the input data is less than a full block and you did not request sync conversion, the output block is the same size as the input block.


sets the size of the conversion buffer used by various conv options. You specify it in the same way as bs.

conv=conversion[, conversion, ...] 

specifies conversion method. conversion can be any of the following:


converts EBCDIC input to ASCII for output. dd copies cbs bytes at a time to the conversion buffer, maps them to ASCII, then strips trailing blanks, adds a newline, and copies this line to the output buffer.


converts variable-length records to fixed-length records. dd treats the input data as a sequence of variable-length records (each terminated by a newline or an EOF character) independent of the block boundaries. dd converts each input record by first removing any newline characters, then padding (with spaces) or truncating the record to the size of the conversion buffer. dd reports the number of truncated records on the standard error. You must specify cbs=size with this conversion.


converts ASCII input to EBCDIC for output. dd copies a line of ASCII to the conversion buffer, discards the newline, pads it with trailing blanks to cbs bytes, maps it to EBCDIC and copies it to the output buffer.


converts ASCII to a variant of EBCDIC which gives better output on many IBM printers.


converts uppercase input to lowercase.


ignores errors on input.


does not truncate the output file. If a block is explicitly written, it replaces the existing block; all other blocks are unchanged. See also of=file and seek=n.


swaps the order of every pair of input bytes. If the current input record has an odd number of bytes, this conversion does not attempt to swap the last byte of the record.


pads any input block shorter than ibs to that size with null bytes before conversion and output. If you also specified block or unblock, dd uses spaces instead of null bytes for padding.


converts lowercase input to uppercase.


converts fixed-length records to variable-length records by reading a number of bytes equal to the size of the conversion buffer (or the number of bytes remaining in the input, if less than the conversion buffer size), deleting all trailing spaces, and appending a newline character. You must specify cbs=size with this conversion.


uses convfile as a translation table if it is not one of the conversion formats listed here and it is the name of a file of exactly 256 bytes.

You may perform multiple conversions at the same time by separating arguments to conv with commas; however, some conversions are mutually exclusive (for example, ucase and lcase).


copies only n input blocks to the output.


sets the input block size to size bytes. Specify this option in the same way as bs.


reads input data from file. If you don't specify this option, dd reads data from the standard input.


displays string when all data has been read from the current volume, replacing all occurrences of %d in string with the number of the next volume to be read. dd then reads and discards a line from the controlling terminal, giving you a chance to change volumes (usually diskettes).


seeks to the nth block of the input file. The distinction between this and skip is that iseek does not read the discarded data; however there are some devices, such as tape drives and communication lines, on which seeking is not possible, so only skip is appropriate.


sets the output block size to size bytes. Specify this option in the same way as bs. The size of the destination should be a multiple of the value chosen for size. For example, if you choose obs=10k, the destination's size should be a multiple of 10k.


writes output data to file. If you don't specify this option, dd writes data to the standard output. dd truncates the output file before writing to it, unless you specified the seek=n operand. If you specify seek=n, but do not specify conv=notrunc, dd preserves only those blocks in the output file over which it seeks. If the size of the seek plus the size of the input file is less than the size of the output file, this can result in a shortened output file.


displays string when dd runs out of room while writing to the current volume. Any occurrences of %d in string are replaced with the number of the next volume to be written. dd then reads and discards a line from the controlling terminal, giving you a chance to change volumes (usually diskettes).


initially seeks to the nth block of the output file.


reads and discards the first n blocks of input.

It is possible to speed up the operation of dd on diskettes by matching the dd parameters to the disk format used. The input and output block size should be large enough to hold an entire track from the disk, allowing an entire track to be read in one pass. If the input and output block size do not match the track size, a number of passes must be made to complete the operation.

The number of blocks copied to the output is set to the number of tracks on the disk. For example, a 360K diskette is double sided and has nine sectors per track. Therefore, there are eighteen 512 byte blocks on each track of the diskette. The diskette has 40 tracks.

dd if=a: bs=18b count=40

reads all of the information of the diskette. Values suitable for use with common Windows diskette formats are summarized in the following table:

Size Cap. Command Line

5.25 360K dd if=a: bs=18b count=40
5.25 1.2M dd if=a: bs=30b count=80
3.5 720K dd if=a: bs=18b count=80
3.5 1.44M dd if=a: bs=36b count=80

Table 1: dd Values for Common PC Diskette Formats


dd if=file of=a:

Copies a file to drive A:, ignoring any Windows file system on the diskette. You can put data on a diskette more quickly and densely in this manner.

dd if=c: of=a: omsg='Please put disk %d in drive A'

dd copies everything from drive C: to drive A:. When the disk in drive A: is full, the utility prompts you to put the next disk in the drive and when you press ENTER, it continues.

dd if=in of=out conv=ascii cbs=80 ibs=6400 obs=512

Converts 80-byte fixed length EBCDIC card images in 6400 byte input blocks to variable length ASCII lines, 512 bytes to the output block.


Possible exit status values are:


Successful completion.


Failure due to any of the following:

— I/O errors on read/write
— insufficient memory
— invalid argument to a conversion

Failure resulting in a usage message, such as:

— an option that should contain = does not
— unknown or invalid command line option

badly formed number "number

A value specified as a number (for example, a block size) does not have the form of a number as recognized by dd. For example, you may have followed the number with a letter which dd does not recognize as a block size unit (w, b, k).


POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 7. Windows Server 2008 R2. Windows 8. Windows Server 2012. Windows 10. Windows Server 2016.

The conv=ascii, conv=ebcdic, and conv=ibm options are x/OPEN extensions to the POSIX standard. The conv=retry, conv=convfile, iseek, imsg, and omsg options plus the w suffix described in the bs= option are all extensions to both the POSIX and x/OPEN standards.

On Windows systems, dd recognizes disk drive names (for example, C:) and reads from or writes to them in a raw manner. On 7/2008R2/8/2012/10/2016 only, the physical disk drive names


may be used for full hard disk drive access, independent of the file system.

On 7/2008R2/8/2012/10/2016, dd recognizes device names only if you apply the prefix //./ to every device reference, as follows:

//./TAPE0   instead of TAPE0

It is strongly recommended, however, that you specify tape devices as described under tape. For example


has the same effect as specifying //./TAPE0, with the added advantage that dd automatically senses and sets the correct block size of the tape.


Before performing a raw disk input/output operation on a given disk you must first access a properly formatted disk of the same size in the same drive. For example, if you want to use a 1.44MB disk in drive A: for raw disk input, you first perform a command like ls or dir on a different, properly formatted 1.44 MB disk in that drive. Once this is done, place the disk that you want to use for raw disk input/output in the appropriate drive and issue the PTC MKS Toolkit command that you want to use.


PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


mt, tr

File Formats:

MKS Toolkit Backup and Tape Handling Solutions Guide

PTC MKS Toolkit 10.1 Documentation Build 15.