dd 命令是 disk dump 的缩写,用于将数据从一个设备复制到另一个设备。
语法
dd [options] [input_file] [output_file]- if:输入文件,可以是一个文件名、设备名或者一个管道。
- of:输出文件,可以是一个文件名、设备名或者一个管道。
- bs:块大小,表示每次读入或写出的字节数。
- count:块数,表示需要复制的块数。
使用
生成文件
通过 dd 命令生成一个指定大小的文件:
dd if=input_file of=output_file bs=block_size count=blocks# 生成一个 1G 大小的文件dd if=/dev/zero of=largefile bs=1M count=1000