Sometimes data arrives from sources in unusual formats. For example, every time I read a tape made on an SGI machine, the bytes are swapped. The dd command takes this in stride, swapping the bytes as required. The ability to use dd in a pipe with rsh means that the tape device on any *nix system is accessible, given the proper rlogin setup.
Example 3: Byte Swapping with Remote Access of Magnet Tape:rsh sgi.with.tape dd bs=256b if=/dev/rmt0 conv=swab | tar xvf -
The dd runs on the SGI and swaps the bytes before writing to the tar command running on the local host.
Murphy's Law was postulated long before digital computers, but it seems it was specifically targeted for them. When you need to read a floppy or tape, it is the only copy in the universe and you have a deadline past due, that is when you will have a bad spot on the magnetic media, and your data will be unreadable. To the rescue comes dd, which can read all the good data around the bad spot and continue after the error is encountered. Sometimes this is all that is needed to recover the important data.
Example 4: Error Handlingi:dd bs=265b conv=noerror if=/dev/st0 of=/tmp/bad.tape.image
The Linux kernel Makefiles use dd to build the boot image. In the Alpha Makefile /usr/src/linux/arch/alpha/boot/Makefile, the srmboot target issues the command:
Example 5. Kernel Image Makefile:dd if=bootimage of=$(BOOTDEV) bs=512 seek=1 skip=1
This skips the first 512 bytes of the input bootimage file (skip=1) and writes starting at the second sector of the $(BOOTDEV) device (seek=1). A typical use of dd is to skip executable headers and begin writing in the middle of a device, skipping volume and partition data. As this can cause your disk to lose file system data, please test and use these applications with care.
The dd command has been around since the 1970s, ported to many systems, rewritten many times, and tested by time as a useful tool. The current Linux version is GNU dd GNU fileutils 3.12, written by Paul Rubin, David MacKenzie, and Stuart Kemp, Copyright © 1985, 1990, 1991 Free Software Foundation, Inc.
GNU dd is found in the fileutils collection, with the current version at the URL ftp://prep.ai.mit.edu/pub/gnu/fileutils-3.12.tar.gz or a mirror near you.
Other major versions include SYSV and BSD, with the BSD source version 5.16 4/28/93 derived from software contributed to Berkeley by Keith Muller of the University of California, San Diego and Lance Visser of Convex Computer Corporation, Copyright © 1991 The Regents of the University of California.
Sam Chessman (SSC3) (email@example.com)
- Readers' Choice Awards 2013
- IBM Will Minimize Impact of Future Disasters
- Mars Needs Women
- December 2013 Issue of Linux Journal: Readers' Choice
- Sublime Text: One Editor to Rule Them All?
- RSS Feeds
- Raspberry Pi: the Perfect Home Server
- Tech Tip: Really Simple HTTP Server with Python
- Linux Systems Administrator
- Senior Perl Developer
- Mixtapes Community
1 hour 5 min ago
- KDE is one true DE
1 hour 39 min ago
- Command Line Shells (Bash, Zsh, etc.) are 2nd place
2 hours 8 min ago
4 hours 3 min ago
- yes it's Jupiter Broadcasting
5 hours 22 min ago
- nice to see PClinuxOS finally
7 hours 56 min ago
- Personally, I am no longer a
8 hours 53 min ago
- It's Jupiter
23 hours 17 min ago
- GIMP is certainly a graphic
1 day 19 min ago
- Thanks For Your Sharing
1 day 5 hours ago