The DD command is a very useful command under Linux/unix to copy a file with a block of a specified size and to make a specified conversion at the same time as a copy. Most users only know the DD command for this use, but the DD command to do USB boot disk is also very convenient, let us look at the DD command is how to use to burn the start U disk.
DD command to do USB boot disk is very convenient, only: sudo
DD If=xxx.iso Of=/dev/sdb bs=1m
You must uninstall the U disk before using the above command, SDB is your u disk, bs=1m is the size of the block, the value behind the large, write the speed relative to a bit, but is not infinite, I generally choose 2M, note that the implementation of the command after a lot of completion, but U disk still flashing, and so do not flash, safe removal.
Note: Your mirroring needs to support the DD command.
Parameters for the DD command:
1. if= FileName: Enter filename, default to standard input. The source file is specified. < If=input file >
2. of= filename: output filename, default to standard output. The destination file is specified. < Of=output file >
3. Ibs=bytes: Read bytes Byte at a time, that is to specify a block size of bytes bytes.
Obs=bytes: Output bytes bytes at a time, specifying a block size of bytes bytes.
Bs=bytes: Set the read/output block size to bytes bytes at the same time.
4. Cbs=bytes: Converts bytes bytes at a time, specifying the size of the conversion buffer.
5. Skip=blocks: Blocks blocks are skipped from the beginning of the input file before replication begins.
6. Seek=blocks: Skips blocks blocks from the beginning of the output file before copying.
Note: It is usually only effective when the output file is disk or tape, that is, it is backed up to disk or tape.
7. Count=blocks: Copies only blocks blocks, the block size equals the number of bytes specified by IBS.
8. Conv=conversion: Converts the file with the specified parameters.
ASCII: convert EBCDIC to ASCII
EBCDIC: convert ASCII to EBCDIC
IBM: Convert ASCII to alternate EBCDIC
Block: Converts each line to a length of CBS, with less than a space filled
Unblock: The length of each row is CBS, and the less part is filled with spaces
LCase: Converts uppercase characters to lowercase characters
UCase: Converts lowercase characters to uppercase characters
Swab: Swap input for each pair of bytes
NoError: Do not stop when an error occurs
Notrunc: Do not truncate output file
Sync: Fills each input block to IBS bytes, and the insufficient part is padded with empty (NUL) characters.
DD Application Example:
1. Backup local/dev/hdb whole disk to/DEV/HDD
DD If=/dev/hdb OF=/DEV/HDD
2./dev/hdb The overall data back to the specified path image file
DD If=/dev/hdb Of=/root/image
3. Restore the backup file to the specified disk
DD If=/root/image OF=/DEV/HDB
4. Backup/DEV/HDB overall data, and use the Gzip tool to compress, save to the specified path
DD If=/dev/hdb | gzip >/root/image.gz
5. Restore the compressed backup file to the specified disk
gzip-dc/root/image.gz | DD Of=/dev/hdb
6.512-byte MBR information from the beginning of the backup disk to the specified file
DD If=/dev/hda of=/root/image count=1 bs=512
Count=1 refers to copying only one block, and the bs=512 block size is 512 bytes.
Recovery: DD If=/root/image Of=/dev/hda
7. Backup floppy disk
DD if=/dev/fd0 of=disk.img count=1 bs=1440k (i.e. block size 1.44M)
8. Copy the contents of the memory to the hard disk
DD If=/dev/mem Of=/root/mem.bin bs=1024 (Specify block size of 1k)
9. Copy the contents of the CD to the specified folder and save it as a Cd.iso file
DD If=/dev/cdrom (HDC) Of=/root/cd.iso
10. Increase the size of the swap partition file
First step: Create a file size of 256M:
DD If=/dev/zero of=/swapfile bs=1024 count=262144
Step Two: Turn this file into a swap file:
Mkswap/swapfile
Step three: Enable this swap file:
Swapon/swapfile
Fourth step: Edit the/etc/fstab file so that the swap file is automatically loaded at each boot:
/swapfile Swap default 0 0
11. Destroying disk data
DD If=/dev/urandom OF=/DEV/HDA1
Note: Using random data to populate a hard disk can be used to destroy data on some necessary occasions.
12. Test hard disk read and write speed
DD If=/dev/zero bs=1024 count=1000000 of=/root/1gb.file
DD If=/root/1gb.file bs=64k | DD Of=/dev/null
The read and write speed of the hard drive can be computed by the command execution time of the above two commands.
13. Determine the best block size of the hard disk
DD If=/dev/zero bs=1024 count=1000000 of=/root/1gb.file
DD If=/dev/zero bs=2048 count=500000 of=/root/1gb.file
DD If=/dev/zero bs=4096 count=250000 of=/root/1gb.file
DD If=/dev/zero bs=8192 count=125000 of=/root/1gb.file
By comparing the command execution times shown in the above command output, you can determine the optimal block size for the system.
14. Repair the hard drive or U disk
DD IF=/DEV/SDA OF=/DEV/SDA
When the hard disk is not used for a long time (for example, 1, 2 years), a magnetic fluxpoint is generated on the disk. When the head is read to these areas, it encounters difficulties and can cause I/O errors. When this condition affects the first sector of the hard disk, it may cause the hard drive to scrap. The commands above may bring the data back to the dead. And the process is safe and efficient.
Using the Linux DD command to burn the boot U disk is still relatively difficult for the average user, if you are interested in learning this knowledge, see a few more times you will find that it is not so complicated, we do not need to memorize these DD commands, as long as you burn the process to start a USB drive to know what you want to do next, Then the corresponding query dd command, input into the OK.