Linux under DD command detailed "Go"

Source: Internet
Author: User

This article was reproduced from: http://www.cnblogs.com/licheng/articles/1116492.html

Name: DD
Usage rights: All user dd This directive is defined in manual as convert and copy a file

How to use:
DD [option]


If you want to see manual online, you can try:
DD--help

Or
Info DD

If you want to see how this 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
The contents of the if and after are adjusted 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 ...
Function: Copies the specified input file into the specified output file, and can be converted in format during the copy process. You can use this command to implement the diskcopy command under DOS. First use the DD command to write the data on the floppy disk to a storage file, and then the storage file written to the second floppy disk, complete the function of diskcopy. It should be noted that the storage file on the hard disk should be removed with the RM command. The system uses standard input files and standard output files by default.

Syntax: DD [Options]

if = input file (or device name).

of = output file (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 Sets the number of bytes in the read/write buffer (equal to the set 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 file.

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, the temporary files should be deleted:

$ rm/tmp/tmpfile



Example 2: Write the net.i file 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: Copy the file sfile to the file Dfile.

$ dd If=sfile Of=dfile_____________________________________DD is a very useful command under Linux/unix, which is to copy a file with a block of the specified size and make the specified conversion at the same time as the copy.

Main options for DD:
Specify the number of digits at the end of the following character multiplied by the corresponding number:
b=512, C=1, k=1024, w=2, Xm=number m

If=file
Enter a file name, which defaults to standard input.

Of=file
The output file name, which defaults to standard output.

Ibs=bytes
Reads a bytes byte at a time (that is, a block size of bytes bytes).

Obs=bytes
Write bytes bytes at a time (that is, a block size of bytes bytes).

Bs=bytes
The size of the read-write block at the same time is bytes, which can replace IBS and OBS.

Cbs=bytes
Converts bytes bytes at a time, that is, the size of the conversion buffer.

Skip=blocks
Skip blocks blocks from the beginning of the input file before copying begins.

Seek=blocks
Skip blocks blocks from the beginning of the output file before copying begins. (usually only valid if the output file is a disk or tape)

Count=blocks
Copies only blocks blocks, and the block size equals the number of bytes specified by IBS.

Conv=conversion[,conversion ...]
Converts the file with the specified parameters.

Conversion parameters:

The ASCII conversion EBCDIC is ASCII.

EBCDIC convert ASCII to EBCDIC.

IBM converts ASCII to alternate EBCDIC.

Block converts each row to a cbs-length record, and the insufficient portion is padded with spaces.

Unblock
Make each line the length of the CBS, the less part filled with spaces.

LCase converts uppercase characters to lowercase characters.

UCase converts lowercase characters to uppercase characters.

Swab swap each byte of the input. Unlike the
Unix DD, this works when an odd number of
Bytes is read. If the input file contains
An odd number of bytes, the last byte is
Simply copied (since there is nothing to
Swap it with).

NoError
Do not stop when an error occurs.

Notrunc
Does not truncate the output file.

Sync fills each input block into IBS bytes, and the less part is padded with empty (NUL) characters.

Because the DD command allows the binary to read and write, it is particularly suitable for input/output on the original physical device. For example, you can use the following command to create an image file for a floppy disk:
DD if=/dev/fd0 of=disk.img bs=1440k
Interestingly, this image file can be read out by Hd-copy, WinImage and other tool software. If you save the first 512 bytes of a hard disk as a file:
DD If=/dev/hda of=disk.mbr bs=512 count=1

Linux under DD command detailed "Go"

Related Article

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.