A detailed and applied example of the Linux DD command

Source: Internet
Author: User

Name: DD
Usage rights: Any user dd this directive is defined in manual as convert and copy a file
How to use:
DD [option]
View Help Notes
DD--help
Or
Info DD

View version:
DD--version
Input or output
DD If=[stdin] Of=[stdout]
The size of the forced input or output is how many bytes
Bs:dd-ibs=[byte]-obs=[size]
Forcing only a few Bytes at a time.
Cbs=bytes
Skipping over a period before outputting
Seek=blocks
Skip a paragraph before entering
Skip=blocks
Of course you can use this to facilitate the copy of the disc (note that your CD-ROM is the standard iso9660 format to do so yo!) )
DD If=/dev/cdrom Of=cdrom.iso
Where the If is followed by the content after you adjust according to your needs.
Then give the system this command to burn:
Cdrecord-v Cdrom.iso
This is not about Cdrecord, so the instructions above are the simplest but not necessarily compatible with your hardware environment ...
Work
Can: copies the specified input document to the specified output document, and can be converted in format during the copy process. This command can be used to achieve the role of DOS under the diskcopy command. Use the DD command first
Write the data on the floppy disk as a storage document for the hard drive, and then put the file on the second floppy disk to complete the diskcopy function. It is important to note that the storage documents on the hard disk should be
command is removed. The system uses standard input documents and standard output documents by default.
Syntax: DD [Options]
if = Enter the document (or device name).
of = output document (or device name).
IBS = Bytes Reads bytes bytes At a time, that is, the number of bytes read into the buffer.
Skip = Blocks skips the ibs*blocks block that reads into the beginning of the buffer.
Obs = bytes Writes bytes bytes At a time, that is, the number of bytes written to the buffer.
BS = bytes Simultaneously configures the number of bytes in the read/write buffer (equal to the configuration of IBS and OBS).
CBS = Byte converts bytes bytes at a time.
The count=blocks only copies the input blocks blocks.
CONV = ASCII Converts the EBCDIC code to Ascil code.
Conv = EBCDIC converts ascil code to EBCDIC code.
CONV = IBM converts ascil code to alternate EBCDIC code.
CONV = Block Converts the change bit to a fixed character.
CONV = Ublock Converts the fixed bit into a change bit.
CONV = UCase Converts the letter from lowercase to uppercase.
CONV = LCase converts letters from uppercase to lowercase.
CONV = Notrunc does not truncate the output document.
CONV = swab swaps each pair of input bytes.
CONV = NoError does not stop processing when an error occurs.
Conv = sync puts the size of each input record to the size of the IBS (filled with nul).
 
Example 1: To copy the contents of one floppy disk to another floppy disk, use/TMP as the temporary storage area. Insert the source disk into the drive and enter the following command:
$ dd if =/dev/fd0 of =/tmp/tmpfile
After the copy is complete, remove the source disk from the drive, insert the target disk, and enter the command:
$ dd if =/tmp/tmpfile of =/dev/fd0
After the floppy copy is complete, you should delete the temporary document:
$ rm/tmp/tmpfile
 
Example 2: Write net.i This document to a floppy disk and set the number of read/write buffers.
(Note: The contents of the floppy disk will be completely overwritten)
$ dd if = net.i of =/dev/fd0 bs = 16384

Example 3: Business Data Destruction

DD If=/dev/zero OF=/DEV/SDA Conv=notrunc

Example 4: Making a mirror

DD if=/dev/hda1 of=hdimage.img Conv=noerror,notrunc

Example 5: Cloning a hard disk

(Here is an example of cloning fedora from the virtual machine SDA (2G size) to a USB disk SDB (2G size).)

DD IF=/DEV/SDA Of=/dev/sdb Notrunc,noerror

Note: If a 80G hard disk (assuming only one partition) is cloned to a 250G partition, the 250G partition becomes 80G, causing the remaining space to be unallocated. In this case, you can use the partition Magic or Acronis disk Director to divide the larger hard disk into a good area

Example 6: Network cloning
Target machine running netcat-l-P 1234 | DD OF=/DEV/HDC bs=16065b
Run DD If=/dev/hda bs=16065b on the source machine | Netcat targethost-192.168.3.33 1234

Note: Netcat is a Swiss Army knife for network commissioning, please refer to below for details.

Reference article:

Http://www.idcnews.net/html/edu/20070101/291368.html

Http://www.linuxdiyf.com/bbs/thread-106225-1-1.html

A detailed and applied example of the Linux DD command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.