|
dd is a common UNIX program whose primary purpose is the low-level copying and conversion of raw data. The title of the UNIX sixth edition manual page of May 1975 was dd - convert and copy a file, and some have suggested[citation needed] that since "cc" was already in use as the code for the C Compiler, "dd" was used instead; in any case, DD is an acronym for "data definition" in IBM JCL (to which the command's syntax bears a strong resemblance) and the name and syntax of the command is generally presumed to be a bit of gallows humor. Image File history File links This is a lossless scalable vector image. ...
Filiation of Unix and Unix-like systems Unix (officially trademarked as UNIX®, sometimes also written as or ® with small caps) is a computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs including Ken Thompson, Dennis Ritchie and Douglas McIlroy. ...
High level and low level are terms used in classifying levels of description and goals in many fields where systems could be described from different perspectives. ...
For other uses, see Data (disambiguation). ...
Sixth Edition Unix (also known as V6 Unix) was the first version of Unix to see wide release outside Bell Labs. ...
Almost all substantial UNIX and Unix-like operating systems have extensive documentation available as an electronic manual, split into multiple sections called man pages (short for manual pages and based on the command used to display them). ...
Wikibooks has a book on the topic of C Programming The C programming language (often, just C) is a general-purpose, procedural, imperative computer programming language developed in the early 1970s by Dennis Ritchie for use on the Unix operating system. ...
A diagram of the operation of a typical multi-language, multi-target compiler. ...
For other uses, see IBM (disambiguation) and Big Blue. ...
Job Control Language (JCL) is a scripting language used on IBM mainframe operating systems to instruct the Job Entry Subsystem (that is, JES2 or JES3) on how to run a batch program or start a subsystem. ...
Gallows humor is humor that makes light of death or other serious matters. ...
dd is used to copy a specified number of bytes or blocks, performing on-the-fly byte order conversions, as well as more esoteric EBCDIC to ASCII conversions. dd is commonly used to copy regions of raw device files, e.g. backing up the boot sector of a hard disk, or to read fixed amounts of data from special files like /dev/zero or /dev/random. It also works well reading and writing to block based media like magnetic tape. Because dd with Unix can copy entire partitions or disks, it is used in computer forensics when the contents need to be preserved as a byte-exact copy. Using cp would not be enough, since data from deleted files that may still be present on a disk are not visible through the file system interface. It is jokingly said to stand for "destroy disk" or "delete data", since, being used for low-level operations on hard disks, a small mistake, such as reversing the if and of parameters, may accidentally render the entire disk unusable.[1] For the computer industry magazine, see Byte (magazine). ...
In computing, endianness is the byte (and sometimes bit) ordering in memory used to represent some kind of data. ...
EBCDIC (Extended Binary Coded Decimal Interchange Code) is an 8-bit character encoding (code page) used on IBM mainframe operating systems, like z/OS, OS/390, VM and VSE, as well as IBM minicomputer operating systems like OS/400 and i5/OS. It is also employed on various non-IBM...
Image:ASCII fullsvg There are 95 printable ASCII characters, numbered 32 to 126. ...
A boot sector is a sector of a hard disc, floppy disc, or similar data storage device that contains code for bootstrapping programs (usually, but not necessarily, operating systems) stored in other parts of the disc. ...
Typical hard drives of the mid-1990s. ...
In Unix-like operating systems, /dev/zero is a special file that provides as many null characters (ASCII NULL, 0x00; not ASCII character digit zero, 0, 0x30) as are read from it. ...
In Unix-like operating systems, /dev/random is a special file that serves as a true random number generator or as a pseudorandom number generator. ...
The simple definition of computer forensics - Chris L.T. Brown, Computer Evidence Collection and Preservation, 2006 Thus, it is more than the technological, systematic inspection of the computer system and its contents for evidence or supportive evidence of a civil wrong or a criminal act. ...
For the computer industry magazine, see Byte (magazine). ...
The introduction to this article provides insufficient context for those unfamiliar with the subject matter. ...
For library and office filing systems, see Library classification. ...
The command line syntax of dd is unlike that of any other UNIX program; a violation of the Unix philosophy of using a common syntax for all command line tools. Generally, dd uses an option=value format, whereas most Unix programs use a -option value format. Also, dd's input is specified using the "if" (input file) option, while most programs simply take the name by itself. It is rumored to have been based on IBM's JCL, and though the syntax may have been a joke, there seems never to have been any effort to write a more Unix-like replacement. For other uses, see Syntax (disambiguation). ...
The Unix philosophy is a set of cultural norms and philosophical approaches to developing software based on the experience of leading developers of the Unix operating system. ...
Job Control Language (JCL) is a scripting language used on IBM mainframe operating systems to instruct the Job Entry Subsystem (that is, JES2 or JES3) on how to run a batch program or start a subsystem. ...
Usage
dd [options]
operands - if=file
- Input File: Read from file instead from standard input.
- of=file
- Output File: Write to file instead to standard output. See also the keyword notrunc.
- ibs=bytes
- Input Block Size: Read bytes bytes at once.
- obs=bytes
- Output Block Size: Write bytes bytes at once.
- bs=bytes
- Block Size: A shortcut for ibs=bytes obs=bytes. If the user does not provide a block size, 512 bytes is used.[2] One can determine the block size of a storage medium by assuming a block size, writing one block and checking for an error message. One author wrote in 2005 that for "most modern drives", the optimum value for this operand for maximum read/write performance is 4k (i.e. bs=4k);[3] however, the value of 1024 is far more widely used in practice.
- count=blocks
- Count: copy only this many blocks from the input to the output, then stop.
- skip=blocks
- When starting to read from input, skip blocks number of blocks of size ibs.
- seek=blocks
- When starting to write to output, skip blocks number of blocks of size obs.
- conv=keywords
- Convert the file according to a comma-separated list of keywords.
- cbs=bytes
- Convert Block Size: Convert bytes bytes at once.
The standard streams for input, output, and error The standard streams are preconnected input or output channels between a computer program and its environment (typically a text terminal) when it begins execution. ...
conv When specifying conv as parameter the following keywords may be used: - ascii
- Convert from EBCDIC to ASCII.
- ebcdic
- Convert from ASCII to EBCDIC.
- IBM
- Convert from ASCII to an alternative EBCDIC.
- block
- Fill datasets which are terminated by a newline-character with space-characters to fit size of cbs.
- unblock
- Replace trailing space-characters in datasets of size cbs with newline-characters.
- lcase
- Change uppercase characters to lowercase.
- ucase
- Change lowercase characters to uppercase.
- notrunc
- Do not truncate output file to zero bytes before writing to it. If the existing output file is longer than the amount of data to be written to it, this will cause the written data to overwrite the initial portion, leaving the remainder intact.
- swab
- Swap every pair of input bytes.
- noerror
- Ignore reading errors and continue.
- sync
- Pad every input block with null bytes if it is shorter than the size specified. If used with block or unblock, pad with space characters instead.
EBCDIC (Extended Binary Coded Decimal Interchange Code) is an 8-bit character encoding (code page) used on IBM mainframe operating systems, like z/OS, OS/390, VM and VSE, as well as IBM minicomputer operating systems like OS/400 and i5/OS. It is also employed on various non-IBM...
Image:ASCII fullsvg There are 95 printable ASCII characters, numbered 32 to 126. ...
Notes and units On various systems the option --version is supported. dd will then output its version number and quit. file may be any real file or any block-device file. On certain systems bytes may be specified with multiplicative units. This units may then be[4]: - c
- Character: 1
- w
- Word: 2
- b
- Block: 512
- kB
- Decimal kilobytes: 1,000 bytes
- k
- Binary kilobytes (kibibytes): 1,024 bytes
- MB
- Decimal megabytes: 1,000,000 bytes
- M
- Binary megabytes (mebibytes): 1,048,576 bytes (1,024×1,024)
This may be carried on similarly with G, T, P, E, Z, Y. The standard "IEEE Std 1003.1" only requires that the 'b' and 'k' multipliers be supported, and does not specify the meaning of any other multipliers. Also, multiple numbers may be provided separated by 'x'. These numbers are multiplied together. A kilobyte (derived from the SI prefix kilo-, meaning 1,000) is a unit of information or computer storage equal to either 1,000 bytes or 1,024 bytes (210), depending on context. ...
// In computing, binary prefixes can be used to quantify large numbers where powers of two are more useful than powers of ten (such as computer memory sizes). ...
A kibibyte (a contraction of kilo binary byte) is a unit of information or computer storage, commonly abbreviated KiB (never kiB). 1 kibibyte = 210 bytes = 1,024 bytes The kibibyte is closely related to the kilobyte, which can be used either as a synonym for kibibyte or to refer to...
ReBoot character, see Megabyte (ReBoot). ...
MiB redirects here. ...
This article is about the unit of measurement. ...
This article is about a measurement term for data storage capacity. ...
A petabyte (derived from the SI prefix peta- ) is a unit of information or computer storage equal to one quadrillion bytes. ...
An exabyte (derived from the SI prefix exa-) is a unit of information or computer storage equal to approximately one quintillion bytes. ...
A zettabyte (derived from the SI prefix zetta-) is a unit of information or computer storage equal to one sextillion (one long scale trilliard) bytes. ...
A yottabyte (derived from the SI prefix yotta-) is a unit of information or computer storage equal to one septillion (one long scale quadrillion or 1024) bytes. ...
Examples Note: Read the man page for your dd command before trying examples as your system may be different. These examples are for Linux: on other platforms the device names may be different and have different semantics. You must still adjust the commands to your platform. Make sure the if (source) and of (target) is specified correctly, or you may lose data. Almost all substantial UNIX and Unix-like operating systems have extensive documentation available as an electronic manual, split into multiple sections called man pages (short for manual pages and based on the command used to display them). ...
This article is about operating systems that use the Linux kernel. ...
- To create an ISO image file named image.iso of a CD. Insert the source CD and unmount it first if auto CD mount is enabled, this is to improve performance by preventing random access to the mounted filesystem.
dd if=/dev/cdrom of=image.iso bs=2k - To create an image file named floppy.img of a floppy disk:
dd if=/dev/fd0 of=floppy.img - To copy the image file back to a floppy:
dd if=floppy.img of=/dev/fd0 bs=18k - To create a file of the size 1 GB with the name reallylargefile, filled with random data:
dd if=/dev/random of=reallylargefile count=2M - As above but faster and cryptographicly less secure
dd if=/dev/urandom of=reallylargefile count=2M - As above but faster by increasing block size:
dd if=/dev/urandom of=reallylargefile count=256k obs=4096 - To create a file of the size 10 GB with the name virtualpartition, filled with zeros, and make it available as a ext2 virtual partition:
dd if=/dev/zero of=virtualpartition bs=1M count=10k mke2fs virtualpartition (reply yes when it says it's not a block device) mkdir /mnt/virtual mount -o loop virtualpartition /mnt/virtual/ - To create a 10GB sparse file which doesn't allocate any actual space (if the filesystem supports this feature):
dd if=/dev/zero of=sparsefile.img bs=1 seek=10G count=0 - To copy the first partition of the first hard disk to the file partitionone.
dd if=/dev/hda1 of=partitionone - To copy the first IDE-harddisk (master) to the second IDE-hard disk (slave), i.e. clone the drive including file systems, partition tables and the master boot record.
dd if=/dev/hda of=/dev/hdb For many more examples of the Linux dd command, which is the same as the UNIX version, go here: http://www.linuxquestions.org/questions/showthread.php?t=362506 This article does not cite any references or sources. ...
The ext3 or third extended filesystem is a journalled file system that is commonly used by the Linux operating system. ...
The mkdir command in the Unix operating system is used to make a new directory. ...
A mount point is a term used to describe where the computer puts the files in a file system on Unix-like systems. ...
In computer science, a sparse file is a type of computer file that attempts to use file system space more efficiently. ...
A Master Boot Record (MBR), or partition sector, is the 512-byte boot sector that is the first sector (Sector 0) of a partitioned data storage device such as a hard disk. ...
Under Windows (GNU Unix Utils) dd is available with the GNU Unix Utils. Windows devices are named like .PhysicalDrive0 or .CDROM0. To turn a CD into an ISO image: dd if=.CDROM0 of=cdimage.iso obs=2048 Under Windows (Cygwin) dd is also available within Cygwin (www.cygwin.com) Cygwin (pronounced ) is a collection of free software tools originally developed by Cygnus Solutions to allow various versions of Microsoft Windows to act similar to a Unix system. ...
The CD-Rom is typically available as /dev/scd0 (first SCSI-device). To turn a CD into an ISO image do dd if=/dev/scd0 of=cdimage.iso obs=2048 To turn a 3½" floppy into an image file do Mount the floppy mount -f -b //./a: /dev/fd0 Create the image dd if=/dev/fd0 of=fdimage.img count=1 bs=1440k Unmount the floppy umount /dev/fd0 Anti-examples
 | WARNING: Do NOT try these examples; they will cause data loss! | The following examples are provided to warn about the dangers of dd, if used incorrectly. Trying any of these commands with the proper privileges will almost certainly result in major data loss, and may make the system unusable. In order to prevent accidental copying and pasting, "dd" has been replaced with "[dd]" here. Image File history File links No higher resolution available. ...
This overwrites the complete first hard disk with null bytes, erasing it (though not in a manner that is as secure as overwriting with random data): To meet Wikipedias quality standards, this article or section may require cleanup. ...
[dd] if=/dev/zero of=/dev/hda This overwrites the first few blocks of the first hard disk with the file, resulting in a loss of the partition table: [dd] if=funnysong.mp3 of=/dev/hda This will completely corrupt an entire hard disk (/dev/dsp is the sound player/recorder): The Open Sound System (OSS) is a standard interface for making and capturing sound in Unix operating systems. ...
[dd] if=/dev/dsp of=/dev/hda This will overwrite an entire disk with pseudorandom data, making its initial contents unrecoverable outside a clean room in a hard drive forensics laboratory, and probably unrecoverable there as well. A pseudorandom process is a process that appears random but is not. ...
[dd] if=/dev/urandom of=/dev/hda The examples above presume device names (valid on some Linux systems) that may be different on other platforms. Here are some common variations. Mac OS X: [dd] if=/dev/zero of=/dev/disk0 Minix: [dd] if=/dev/zero of=/dev/c0d0p0 NetBSD/OpenBSD (does not work if securelevel > 1): Securelevel is a security mechanism in *BSD kernels, which can optionally restrict certain capabilities. ...
[dd] if=/dev/zero of=/dev/rwd0 See also This is a list of Unix programs. ...
SpinRite is a software program for scanning magnetic data storage devices such as hard disks, recovering data from them and refreshing their surfaces. ...
External links |