Play Video
1
Cloning Partition With dd (Unix/Linux)
Cloning Partition With dd (Unix/Linux)
::2014/01/17::
Play Video
2
Linux / Unix: dd Command Clone Hard Disks and Partitions
Linux / Unix: dd Command Clone Hard Disks and Partitions
::2012/08/25::
Play Video
3
Dd Unix   Wiki Article
Dd Unix Wiki Article
::2013/11/02::
Play Video
4
Dd (Unix)
Dd (Unix)
::2014/08/17::
Play Video
5
Programming Tools #1 - Power use of UNIX - Dan North
Programming Tools #1 - Power use of UNIX - Dan North
::2013/11/18::
Play Video
6
CaosCommunity - Nuclear 150sec by unix sguaz
CaosCommunity - Nuclear 150sec by unix sguaz
::2014/06/28::
Play Video
7
Shell Scripting Tutorial 14  Convert & Copy Files With
Shell Scripting Tutorial 14 Convert & Copy Files With 'dd'
::2013/10/13::
Play Video
8
The Concept - D-D-Dance (Official video)
The Concept - D-D-Dance (Official video)
::2012/03/07::
Play Video
9
ISO-Images in Mac OS X und Unix-Derivaten erstellen
ISO-Images in Mac OS X und Unix-Derivaten erstellen
::2011/01/30::
Play Video
10
dd, awk, less を使ってPDFからテキスト抽出 (part 1/4)
dd, awk, less を使ってPDFからテキスト抽出 (part 1/4)
::2010/02/13::
Play Video
11
UNIX-1.8 ps, netstat, kill, pidof, fuser, awk commands (Video Tutorial)
UNIX-1.8 ps, netstat, kill, pidof, fuser, awk commands (Video Tutorial)
::2012/06/10::
Play Video
12
Copy One Drive to Another Using the dd Command in Linux - Ubuntu
Copy One Drive to Another Using the dd Command in Linux - Ubuntu
::2011/02/27::
Play Video
13
Raspberry Pi - Menulis image raspbian wheezy ke SD card
Raspberry Pi - Menulis image raspbian wheezy ke SD card
::2012/11/06::
Play Video
14
dd Demonstration
dd Demonstration
::2012/02/21::
Play Video
15
lynda.com tutorial | Unix for Mac OS X Users—What is Unix?
lynda.com tutorial | Unix for Mac OS X Users—What is Unix?
::2013/03/19::
Play Video
16
The Royal Concept - D-D-Dance (live at Pet Sounds Bar)
The Royal Concept - D-D-Dance (live at Pet Sounds Bar)
::2011/06/19::
Play Video
17
UNIX: Directory Related Commands
UNIX: Directory Related Commands
::2014/06/08::
Play Video
18
The ABC
The ABC's of UNIX
::2010/11/29::
Play Video
19
HowTo: Monitor and Log Network Traffic on Linux / Unix Using vnStat
HowTo: Monitor and Log Network Traffic on Linux / Unix Using vnStat
::2012/11/20::
Play Video
20
Vodge Diper & UNIX (UK) - Down Like Spock (Original Mix) [Big Alliance Records]
Vodge Diper & UNIX (UK) - Down Like Spock (Original Mix) [Big Alliance Records]
::2013/10/03::
Play Video
21
DD The Kid -  With Me (Reposted)
DD The Kid - With Me (Reposted)
::2012/08/28::
Play Video
22
Computer Forensics: fdisk and dd
Computer Forensics: fdisk and dd
::2013/03/22::
Play Video
23
Lesson 1 FreeBSD Unix: Downloading and  Installing 10.x (Arabic Version)
Lesson 1 FreeBSD Unix: Downloading and Installing 10.x (Arabic Version)
::2014/03/03::
Play Video
24
Creating Linux Live USB using dd command
Creating Linux Live USB using dd command
::2011/10/28::
Play Video
25
Linux and Unix: Watch smartctl Command Progress On Screen
Linux and Unix: Watch smartctl Command Progress On Screen
::2014/05/27::
Play Video
26
ls Command In UNIX
ls Command In UNIX
::2013/11/25::
Play Video
27
Linux and Unix Basics : Mounting Part 1
Linux and Unix Basics : Mounting Part 1
::2011/09/20::
Play Video
28
Gentoo in Review - dd command to burn ISO to USB stick
Gentoo in Review - dd command to burn ISO to USB stick
::2014/04/02::
Play Video
29
How to Use Diff Unix Command
How to Use Diff Unix Command
::2013/06/17::
Play Video
30
Lesson 1 FreeBSD Unix: Downloading and Installing 8.x (English Version)
Lesson 1 FreeBSD Unix: Downloading and Installing 8.x (English Version)
::2012/05/05::
Play Video
31
04 Administering the File System - 01 How UNIX File Systems Work
04 Administering the File System - 01 How UNIX File Systems Work
::2011/02/11::
Play Video
32
Wisconsin UNIX BSD 4.3 alot of SunOS source in this one eh! on simh and tera term client
Wisconsin UNIX BSD 4.3 alot of SunOS source in this one eh! on simh and tera term client
::2013/07/30::
Play Video
33
3.(FORENSICS) using DD command to take image and hash values
3.(FORENSICS) using DD command to take image and hash values
::2013/11/17::
Play Video
34
Ubuntu 12.04 Forensics - dd, dcfldd, And dc3dd Overview
Ubuntu 12.04 Forensics - dd, dcfldd, And dc3dd Overview
::2013/01/12::
Play Video
35
Tutorial: Cloning a Disk under Linux/UNIX With partimage Software
Tutorial: Cloning a Disk under Linux/UNIX With partimage Software
::2012/08/25::
Play Video
36
How to mount a volume or qtree via unix linux. Data ONTAP. Netapp
How to mount a volume or qtree via unix linux. Data ONTAP. Netapp
::2013/09/30::
Play Video
37
dd for windows
dd for windows
::2010/03/16::
Play Video
38
Video Demo: Unix Segment Hybrid Snare Drum w/ Bubinga Hoops 8x14
Video Demo: Unix Segment Hybrid Snare Drum w/ Bubinga Hoops 8x14
::2014/03/25::
Play Video
39
Converting Unix Time to Date Stamps in Python
Converting Unix Time to Date Stamps in Python
::2013/05/31::
Play Video
40
10. Unix Shell Scripting Tutorial - Advanced Scripting (Part 2)
10. Unix Shell Scripting Tutorial - Advanced Scripting (Part 2)
::2011/12/10::
Play Video
41
Da Unix Ft Celi-G & LeUnAmE_-_ Realiteti ( Offical Song )...♪♫♪♫
Da Unix Ft Celi-G & LeUnAmE_-_ Realiteti ( Offical Song )...♪♫♪♫
::2011/11/28::
Play Video
42
MD5 CHECKSUM - How to use it in UNIX or Linux
MD5 CHECKSUM - How to use it in UNIX or Linux
::2013/02/02::
Play Video
43
Как удалять, добавлять пользователей в системе Linux/UNIX
Как удалять, добавлять пользователей в системе Linux/UNIX
::2014/03/27::
Play Video
44
Why Do I Suck At This Game So Much Now?. Unix Plays: Super Mario 64
Why Do I Suck At This Game So Much Now?. Unix Plays: Super Mario 64
::2014/03/21::
Play Video
45
Linux / Unix Internet Bandwidth Throttling For A Specific Shell Using Trickle Utility
Linux / Unix Internet Bandwidth Throttling For A Specific Shell Using Trickle Utility
::2012/12/04::
Play Video
46
Uso Comando DD Y Tar en linux Ubuntu
Uso Comando DD Y Tar en linux Ubuntu
::2012/12/19::
Play Video
47
use unix df command
use unix df command
::2009/09/20::
Play Video
48
Usando o comando DD para copiar/clonar HD
Usando o comando DD para copiar/clonar HD'S
::2013/06/17::
Play Video
49
Lesson 7 FreeBSD Unix: Partition and Add a New Disk. (English Version)
Lesson 7 FreeBSD Unix: Partition and Add a New Disk. (English Version)
::2012/06/02::
Play Video
50
UNIX shell script bash scripting tutorial video -1
UNIX shell script bash scripting tutorial video -1
::2010/11/17::
NEXT >>
RESULTS [51 .. 101]
From Wikipedia, the free encyclopedia
Jump to: navigation, search

dd is a command on Unix and Unix-like operating systems whose primary purpose is to convert and copy a file.[1]

On Unix, device drivers for hardware (such as hard disks) and special device files (such as /dev/zero and /dev/random) appear in the file system just like normal files; dd can also read and/or write from/to these files, provided that function is implemented in their respective driver. As a result, dd can be used for tasks such as backing up the boot sector of a hard drive, and obtaining a fixed amount of random data. The dd program can also perform conversions on the data as it is copied, including byte order swapping and conversion to and from the ASCII and EBCDIC text encodings.[2]

The name dd may be an allusion to the DD statement found in IBM's Job Control Language (JCL),[3] where the initials stand for "Data Description."[4] The command's syntax resembles the JCL statement more than it does other Unix commands, so the syntax may have been a joke.[3] Another explanation for the command's name is that "cc" (for "convert and copy", as in the command's description) was already taken by the C compiler.[citation needed] It is also jokingly said that dd stands for "disk destroyer" or "delete data", since when used for low-level operations on hard disks, a small mistake such as reversing the input file and output file parameters could result in the loss of some or all data on a disk.[2]

The dd command is specified by IEEE Std 1003.1-2008, which is part of the Single UNIX Specification.

Usage[edit]

The command line syntax of dd differs from many other Unix programs, in that it uses the syntax option=value for its command line options, rather than the more-standard --option value or -option=value formats. By default, dd reads from STDIN and writes to STDOUT, but these can be changed by using the if (input file) and of (output file) options.

Usage varies across different operating systems. Also, certain features of dd will depend on the computer system capabilities, such as dd's ability to implement an option for direct memory access. Sending a SIGINFO signal (or a USR1 signal on Linux) to a running dd process makes it print I/O statistics to standard error once and then continue copying (note that signals may terminate the process on OS X). dd can read standard input from the keyboard. When end-of-file (EOF) is reached, dd will exit. Signals and EOF are determined by the software. For example, Unix tools ported to Windows vary as to the EOF: Cygwin uses <ctrl-d> (the usual Unix EOF) and MKS Toolkit uses <ctrl-z> (the usual Windows EOF).

Following the Unix philosophy of developing small yet capable software, dd does one thing and contains no logic other than that required to implement the low-level decisions based on user-specified command-line options. Often, the options are changed for each run of dd in a multi-step process to empirically produce desired results.[clarification needed]

Output messages[edit]

The GNU variant of dd as supplied with coreutils on Linux does not describe the format of the messages displayed on standard output on completion. However, these are described by other implementations, e.g. that with BSD.

Each of the "Records in" and "Records out" lines shows the number of complete blocks transferred + the number of partial blocks, e.g. because the physical medium ended before a complete block was read, or a physical error prevented reading the complete block.

Block size[edit]

A block is a unit measuring the number of bytes that are read, written, or converted at one time. Command line options can specify a different block size for input/reading (ibs) compared to output/writing (obs), though the block size (bs) option will override both ibs and obs. The default value for both input and output block sizes is 512 bytes (the traditional block size of disks, and POSIX-mandated size of "a block"). The count option for copying is measured in blocks, as are both the skip count for reading and seek count for writing. Conversion operations are also affected by the "conversion block size" (cbs).

For some uses of the dd command, block size may have an effect on performance. For example, when recovering data from a hard disk, a small block size will generally cause the most bytes to be recovered. Issuing many small reads is an overhead and may be non-beneficial to execution performance. For greater speed during copy operations, a larger block size may be used. However, because the amount of bytes to copy is given by bs×count, it is impossible to copy a prime number of bytes in a single dd command without making one of two bad choices, bs=N count=1 (memory use) or bs=1 count=N (read request overhead). Alternative programs (see below) permit specifying bytes rather than blocks. When dd is used for network transfers, the block size may have also an impact on packet size, depending on the network protocol used.

The value provided for block size options is interpreted as a decimal (base 10) integer and can also include suffixes to indicate multiplication. The suffix w means multiplication by 2, b means 512, k means 1024, M means 1024 × 1024, G means 1024 × 1024 × 1024, and so on. Additionally, some implementations understand the x character as a multiplication operator for both block size and count parameters.

For example, a block size such as bs=2x80x18b is interpreted as 2 × 80 × 18 × 512 = 1474560 bytes, the exact size of a 1440 KiB floppy disk.

Uses[edit]

The dd command can be used for a variety of purposes.

Data transfer[edit]

dd can duplicate data across files, devices, partitions and volumes. The data may be input or output to and from any of these; but there are important differences concerning the output when going to a partition. Also, during the transfer, the data can be modified using the conv options to suit the medium.

An attempt to copy the entire disk using cp may omit the final block if it is of an unexpected length[citation needed]; whereas dd may succeed. The source and destination disks should have the same size.

Data transfer forms of dd
dd if=/dev/sr0 of=myCD.iso bs=2048 conv=noerror,sync
Creates an ISO disk image from a CD-ROM; in some cases the created ISO image may not be the same as the one which was used to burn the CD-ROM.[5]
dd if=/dev/sda2 of=/dev/sdb2 bs=4096 conv=noerror
Clones one partition to another.
dd if=/dev/ad0 of=/dev/ad1 bs=1M conv=noerror
Clones a hard disk "ad0" to "ad1".

The noerror option means to keep going if there is an error, while the sync option causes output blocks to be padded.

Master boot record backup and restore[edit]

It is possible to repair a master boot record. It can be transferred to and from a repair file.

To duplicate the first two sectors of a floppy drive:

dd if=/dev/fd0 of=MBRboot.img bs=512 count=2

To create an image of the entire x86 master boot record (including a MS-DOS partition table and MBR magic bytes):

dd if=/dev/sda of=MBR.img bs=512 count=1

To create an image of only the boot code of the master boot record (without the partition table and without the magic bytes required for booting):

dd if=/dev/sda of=MBR_boot.img bs=446 count=1

Data modification[edit]

dd can modify data in place.

Overwrite the first 512 bytes of a file with null bytes:

dd if=/dev/zero of=path/to/file bs=512 count=1 conv=notrunc

The notrunc conversion option means do not truncate the output file — that is, if the output file already exists, just replace the specified bytes and leave the rest of the output file alone. Without this option, dd would create an output file 512 bytes long.

To duplicate a disk partition as a disk image file on a different partition:

dd if=/dev/sdb2 of=partition.image bs=4096 conv=noerror

Disk wipe[edit]

Main article: Data erasure

For security reasons, it is sometimes necessary to have a disk wipe of a discarded device.

To wipe a disk by writing zeros to it, dd can be used this way:

dd if=/dev/zero of=/dev/sda bs=4k

Another approach could be to wipe a disk by writing random data to it:

dd if=/dev/urandom of=/dev/sda bs=4k

When compared to the data modification example above, notrunc conversion option is not required as it has no effect when the dd's output file is a block device.[6]

The bs=4k option makes dd read and write 4 kilobytes at a time. For modern systems, an even greater block size may be beneficial due to the transport capacity (think RAID systems). Note that filling the drive with random data will always take a lot longer than zeroing the drive, because the random data must be rendered by the CPU and/or HWRNG first, and different designs have different performance characteristics. (The PRNG behind /dev/urandom may be slower than libc's.) On most relatively modern drives, zeroing the drive will render any data it contains permanently irrecoverable.[7]

Zeroing the drive will render any data it contains irrecoverable by software; however it still may be recoverable by special laboratory techniques.

The shred program provides an alternate method for the same task, and finally, the wipe[8] program present in many Linux distributions provides an elaborate tool (the one that does it "well", going back to the Unix philosophy mentioned before) with many ways of clearing.

Data recovery[edit]

The history of open-source software (OSS) for data recovery and restoration of files, drives, and partitions started with GNU dd in 1984, with one block size per dd process, and no recovery algorithm other than the user's interactive session running one form of dd after another. Then, a C program was authored October 1999 called dd_rescue. It has two block sizes in its algorithm. But the author of the 2003 shell script dd_rhelp that enhances dd_rescue's data recovery algorithm, now recommends GNU ddrescue,[9] a C++ program that was initially released in 2004 and is now in most Linux distributions. GNU ddrescue has the most sophisticated block-size-changing algorithm available in OSS.[10] To help distinguish the newer GNU program from the older script, alternate names are sometimes used for GNU's ddrescue, including addrescue (the name on freecode.com and freshmeat.net), gddrescue (Debian package name), and gnu_ddrescue (openSUSE package name).

GNU ddrescue is stable and safe.[11]

Another open source program called savehd7 uses a sophisticated algorithm, but it also requires the installation of its own programming-language interpreter.

Benchmarking drive performance[edit]

To make drive benchmark test and analyze the sequential (and usually single-threaded) system read and write performance for 1024-byte blocks :

dd if=/dev/zero bs=1024 count=1000000 of=file_1GB
dd if=file_1GB of=/dev/null bs=1024

Generating a file with random data[edit]

To make a file of 100 random bytes using the kernel random driver:

dd if=/dev/urandom of=myrandom bs=100 count=1

Converting a file to upper case[edit]

To convert a file to uppercase:

dd if=filename of=filename1 conv=ucase

Creating empty files of arbitrary size[edit]

Create a 1 GiB sparse file, or resize an existing file to 1 GiB without overwriting:

dd if=/dev/zero of=mytestfile.out bs=1 count=0 seek=1G

(A more modern tool for this is fallocate or truncate, both shipped with GNU coreutils.)

Limitations[edit]

Seagate documentation warns, "Certain disc utilities, such as DD, which depend on low-level disc access may not support 48-bit LBAs until they are updated".[12][citation needed] Using ATA harddrives over 128 GiB requires 48-bit LBA. However, in Linux, dd uses the kernel to read or write to raw device files.[a] Support for 48-bit LBA has been present since version 2.4.23 of the kernel, released in 2003.[13][14]

Dcfldd[edit]

dcfldd is a fork of dd that is an enhanced version developed by Nick Harbour, who at the time was working for the United States' Department of Defense Computer Forensics Lab.[15][16][17] Compared to dd, dcfldd allows for more than one output file, supports simultaneous multiple checksum calculations, provides a verification mode for file matching, and can display of the percentage progress of an operation.

See also[edit]

Notes[edit]

  1. ^ This is verifiable with strace.

References[edit]

  1. ^ Bell Laboratories. "dd man page". Retrieved 2009-02-25. 
  2. ^ a b Sam Chessman. "How and when to use the dd command?". CodeCoffee. Retrieved 2008-02-19. 
  3. ^ a b Eric S. Raymond. "dd". Retrieved 2008-02-19. 
  4. ^ See this old discussion "The Unix "dd" command". alt.folklore.computers. Retrieved 2011-07-05. 
  5. ^ William E. Shotts, Jr. (2012). "15. Storage Media". "The Linux Command Line, A Complete Introduction". No Starch Press. p. 174. Retrieved 2014-08-24. 
  6. ^ "linux - Why using conv=notrunc when cloning a disk with dd?". Stack Overflow. 2013-12-11. Retrieved 2014-03-24. 
  7. ^ Wright, Craig; Kleiman, Dave; Sundhar R.S., Shyaam (2008). "Overwriting Hard Drive Data: The Great Wiping Controversy". Lecture Notes in Computer Science. Information Systems Security 5352: 243–257. doi:10.1007/978-3-540-89862-7_21. Retrieved 7 March 2012. 
  8. ^ "Wipe: Secure File Deletion". Wipe.sf.net. Retrieved 2014-03-24. 
  9. ^ LAB Valentin (19 September 2011). "dd_rhelp author's repository". "Important note : For some times, dd_rhelp was the only tool (AFAIK) that did this type of job, but since a few years, it is not true anymore: Antonio Diaz did write a ideal replacement for my tool: GNU 'ddrescue'." 
  10. ^ "Damaged Hard Disk". www.cgsecurity.org. Retrieved 2008-05-20. 
  11. ^ "Interview with GNU ddrescue's Antonio Diaz Diaz". Blue-GNU. Archived from the original on 2008-04-15. Retrieved 2008-12-06. 
  12. ^ Windows 137GB (128 GiB) Capacity Barrier - Seagate Technology (March 2003)
  13. ^ "ChangeLog-2.4.23". www.kernel.org. Retrieved 2009-12-07. 
  14. ^ Linux-2.4.23 released Linux kernel mailing list, 2003.
  15. ^ "DCFLDD at Source Forge". Source Forge. Retrieved 2013-08-17. 
  16. ^ Jeremy Faircloth, Chris Hurley (2007). Penetration Tester's Open Source Toolkit. Syngress. pp. 470–472. ISBN 9780080556079. 
  17. ^ Jack Wiles, Anthony Reyes (2011). The Best Damn Cybercrime and Digital Forensics Book Period. Syngress. pp. 408–411. ISBN 9780080556086. 

External links[edit]

Wikipedia content is licensed under the GFDL License
Powered by YouTube
LEGAL
  • Mashpedia © 2014