简体   繁体   English

dd if=/dev/sdb 的命令是什么?

[英]What is the command dd if=/dev/sdb do?

I have formated my pendrive and it is in /dev/sdb.我已经格式化了我的 Pendrive,它在 /dev/sdb 中。 When I execute the command dd if=/dev/sdb command it keep printing some junk in console.当我执行命令dd if=/dev/sdb命令时,它会继续在控制台中打印一些垃圾。 My doubt is, when I format the pendrive and execute this command, it should not print anything.我的疑问是,当我格式化 pendrive 并执行此命令时,它不应该打印任何内容。 But why it is printing ?但是为什么要打印呢?

Formatting a drive does not (generally) zero out the data;格式化驱动器不会(通常)将数据归零; it simply writes data to certain locations on the drive such that your operating system believes that no space is allocated.它只是将数据写入驱动器上的某些位置,以便您的操作系统认为没有分配空间。

If you really want to zero out the data, you can run:如果你真的想将数据归零,你可以运行:

dd if=/dev/zero of=/dev/sdb bs=4096

This will write zeros to /dev/sdb .这会将零写入/dev/sdb

Formatting a device does not get rid of previous data on the device.格式化设备不会删除设备上的先前数据。 All formatting will do is overwrite the filesystem data to make it marked as empty.所有格式化都会覆盖文件系统数据以将其标记为空。 Any previous data not overwritten will still technically exist.任何以前未被覆盖的数据在技术上仍然存在。 Also, dd will print out bytes of the raw data so even if you overwrite your drive with all 0s, dd would just return a whole bunch of zeros.此外,dd 将打印出原始数据的字节,因此即使您用全 0 覆盖驱动器,dd 也只会返回一大堆零。

dd will print to STDOUT (terminal window) unless you give it an output file. dd 将打印到 STDOUT(终端窗口),除非你给它一个输出文件。

Example:例子:

dd if=dev/sdb of=backup.img

Terminology:术语:

  • dd: disk duplicator dd:磁盘复制器
  • if: input file如果:输入文件
  • of: output file : 输出文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM