<h1 style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; font-size: 22px; clear: both; ">dd</h1><p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; font-size: 16px; ">Convert and copy a file, write disk headers, boot records, create a boot floppy. dd can make an exact clone of an (unmounted) disk, this will include all blank space so the output destination must be at least as large as the input.</p>
<span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "><pre style="font-family: 'courier new', 'Andale Mono', courier, monospace; font-size: 16px; ">Syntax
dd [<em>Options</em>]
        
Key
if=<i>FILE</i>
Input file : Read from FILE instead of standard input.
of=<i>FILE</i>
Output file : Write to FILE instead of standard output. Unless `conv=notrunc'
is given, `dd' truncates FILE to zero bytes (or the size specified
with `seek=').
ibs=<em>BYTES</em>
Read BYTES bytes at a time.
obs=<em>BYTES</em>
Write BYTES bytes at a time.
bs=<em>BYTES</em>
Block size, both read and write <i>BYTES</i> bytes at a time. This overrides `ibs'
and `obs'.
cbs=<em>BYTES</em>
Convert BYTES bytes at a time.
skip=<em>BLOCKS</em>
Skip BLOCKS `ibs'-byte blocks in the input file before copying.
seek=<em>BLOCKS</em>
Skip BLOCKS `obs'-byte blocks in the output file before copying.
count=<em>BLOCKS</em>
Copy BLOCKS `ibs'-byte blocks from the input file, instead of
everything until the end of the file.
conv=<em>CONVERSION</em>[,<em>CONVERSION</em>]...
Convert the file as specified by the CONVERSION argument(s).
(No spaces around any comma)
Conversions:
`ascii' Convert EBCDIC to ASCII.
`ebcdic' Convert ASCII to EBCDIC.
`ibm' Convert ASCII to alternate EBCDIC.
`block' For each line in the input, output `cbs' bytes, replacing the
input newline with a space and padding with spaces as
necessary.
`unblock' Replace trailing spaces in each `cbs'-sized input block with a newline.
`lcase' Change uppercase letters to lowercase.
`ucase' Change lowercase letters to uppercase.
`swab' Swap every pair of input bytes. GNU `dd', unlike others,
works when an odd number of bytes are read--the last byte is
simply copied (since there is nothing to swap it with).
`noerror' Continue after read errors.
`notrunc' Do not truncate the output file.
`sync' Pad every input block to size of `ibs' with trailing zero bytes.
</pre></span><p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; font-size: 16px; ">The numeric-valued options (BYTES and BLOCKS) can be followed by a multiplier: `b'=512, `c'=1, `w'=2, `xM'=M, or any of the standard block size suffixes like `k'=1024.</p>
<p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; font-size: 16px; "><strong>Examples:</strong></p><p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; font-size: 16px; ">Clone one hard drive onto another<span class="code" style="font-family: 'courier new', courier, 'Andale Mono', monospace; font-size: 16px; "> <br>
$ dd if=/dev/sda of=/dev/sdb</span></p><p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; font-size: 16px; ">Clone a hard drive<span class="code" style="font-family: 'courier new', courier, 'Andale Mono', monospace; font-size: 16px; "> </span>to an image file <br>
<span class="code" style="font-family: 'courier new', courier, 'Andale Mono', monospace; font-size: 16px; ">$ dd if=/dev/hda of=/image.img</span></p><p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; font-size: 16px; ">
Clone a hard drive to a zipped image file in 100Mb blocks <span class="code" style="font-family: 'courier new', courier, 'Andale Mono', monospace; font-size: 16px; "><br>$ dd if=/dev/hda bs=100M | gzip -c > /image.img</span></p>
<p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; font-size: 16px; ">Create a boot floppy:<br><span class="code" style="font-family: 'courier new', courier, 'Andale Mono', monospace; font-size: 16px; ">$ dd if=boot.img of=/dev/fd0 bs=1440</span></p>
<p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; font-size: 16px; "><i>"Success isn't something you chase. It's something you have to put forth the effort for constantly. Then maybe it'll come when you least expect it. Most people don't understand that" - Michael Jordan </i><br>
<br><b>Related</b>:<br><a href="http://www.codecoffee.com/tipsforlinux/articles/036.html" style="color: rgb(0, 0, 255); text-decoration: none; ">CodeCoffee.com</a> - dd examples<br><a href="http://ss64.com/bash/cp.html" style="color: rgb(0, 0, 255); text-decoration: none; ">cp</a> - Copy one or more files to another location<br>
<a href="http://ss64.com/bash/ddrescue.html" style="color: rgb(0, 0, 255); text-decoration: none; ">ddrescue</a> - Data recovery tool <br><a href="http://ss64.com/bash/install.html" style="color: rgb(0, 0, 255); text-decoration: none; ">install</a> - Copy files and set attributes<br>
<a href="http://ss64.com/bash/mtools.html" style="color: rgb(0, 0, 255); text-decoration: none; ">mtools</a> - Manipulate MS-DOS files<br><a href="http://ss64.com/bash/sum.html" style="color: rgb(0, 0, 255); text-decoration: none; ">sum</a> - Print a checksum for a file<br>
Equivalent Windows command: <a href="http://ss64.com/nt/fsutil.html" style="color: rgb(0, 0, 255); text-decoration: none; ">FSUTIL</a> file setzerodata</p>