In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use the Linux dd command". Friends who are interested might as well take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use the Linux dd command.
One: dd command dd: copy a file with a block of the specified size and perform the specified conversion at the same time.
Note: if the specified number ends with the following characters, it will be multiplied by the corresponding number: bouncy 512
Parameter note: if= file name: input file name, default is standard input. That is, specify the source file.
Of= file name: output file name, default to standard output. That is, specify the destination file.
Ibs=bytes: read bytes bytes at a time, that is, 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.
Cbs=bytes: convert bytes bytes at a time, that is, specify the conversion buffer size.
Skip=blocks: skip blocks blocks from the beginning of the input file before you start copying.
Seek=blocks: skip blocks blocks from the beginning of the output file before you start copying. Note: it is usually only valid when the output file is a disk or tape, that is, when backing up to a disk or tape.
Count=blocks: only blocks blocks are copied, with the block size equal to the number of bytes specified by ibs.
Conv=conversion: converts the file with the specified parameters.
Ascii: converting ebcdic to ascii
Ebcdic: converting ascii to ebcdic
Ibm: converting ascii to alternate ebcdic
Block: convert each line to a length of cbs, and fill in the gaps with blanks
Unblock: make the length of each line cbs, and fill the insufficient parts with blanks
Lcase: convert uppercase characters to lowercase characters
Ucase: convert lowercase characters to uppercase characters
Swab: swap each pair of bytes of input
Noerror: don't stop when something goes wrong
Notrunc: output files are not truncated
Sync: populate each input block into ibs bytes, and fill in the shortfalls with NUL characters.
Dd command application example 1: backup the entire hard disk use the dd command to back up the entire hard disk. In this example, the device name of the source hard disk is / dev/ sda, and the device name of the destination hard disk is / dev/ sdb. Execute the dd command to back up the entire hard drive / dev/sha to another hard drive / dev/sdb on the same system. As follows:
[root@linuxprobe ~] # dd if=/dev/sda of=/dev/sdb-"if" is followed by an input file, and "of" followed by an output file. -any errors in the execution of the above command will fail. However, if you add the parameter "CONV= NOERROR", it will continue to copy even if there is an error in the execution. -input and output files must be checked repeatedly before execution. If the order of the two files is reversed, you may lose all your data. When backing up the entire hard drive, we can also add the sync parameter to synchronize Icano. As follows:
[root@linuxprobe ~] # dd if=/dev/sda of=/dev/sdb conv=noerror,sync example 2: create an image of a hard disk using the dd command to create an image file for the hard disk and save it to another storage device. This backup method has many advantages: one is easy to use, the other is that this backup method is faster than other methods of backup, but also allows you to recover data more quickly. Create an image command for hard disk / dev/sda:
[root@linuxprobe ~] # dd if=/dev/sda of=~/sdadisk.img example 3: restore hard disk image file restore data use the dd command to restore the hard disk image file to another hard disk. As follows:
The [root@linuxprobe ~] # dd if=sdadisk.img of=/dev/sdbSdadisk.img file is the image of / dev/sda, so the above command will restore the image of / dev/had to / dev/sdb
Example 4: create a floppy disk image using the dd command to create an image backup of the floppy disk. The input file fills in the location of the floppy drive device, and the output file writes the name of the floppy disk image file, as shown below.
[root@linuxprobe ~] # dd if=/dev/fd0 of=myfloppy.img example 5: backup partitions use the dd command to back up hard disk partitions. Enter the file to fill in the device name of the partition, and the output file to fill in the target path or image file you specified. An example of the dd command is as follows:
[root@linuxprobe ~] # dd if=/dev/sda1 of=~/partition1.img example 6: the CD backup dd command allows us to create the iso file of the source file, so we can insert CD and enter the dd command to create the iso file content of a CD.
The [root@linuxprobe ~] # dd if=/dev/cdrom of=tgsservice.iso bs=2048dd command reads a block from the input and writes it to the output file. You can specify the block size of the input and output files. The parameter "bs" specifies the block size of the input and output files. The above dd command uses a block size of 2048 bytes. Note: if the disc is mounted automatically, it is best to drop umount before using the dd command to create an iso image to avoid unnecessary access to the CD ROM.
At this point, I believe you have a deeper understanding of "how to use the Linux dd command". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.