1.8 KiB
1.8 KiB
DD 命令的使用
1.一般使用
# 不固定长度,读到文件结尾自动停止
dd if=\<in file name\> of=/dev/\<out file name\> bs=4M status=progress
# 指定长度(4Mx1024=4G)
dd if=\<in file name\> of=/dev/\<out file name\> bs=4M count=1024 status=progress
2.指定 Flag
# iflag 指定 input flag
# iflag 指定 output flag
dd iflag=direct,nonblock if=\<in file name\> oflag=direct,nonblock of=/dev/\<out file name\> bs=4M status=progress
多个 Flag 之间可以用逗号分割,含义如下表。
Flag | Description |
---|---|
append | append mode (makes sense only for output; conv=notrunc suggested) |
direct | use direct I/O for data |
directory | fail unless a directory |
dsync | use synchronized I/O for data |
sync | likewise, but also for metadata |
fullblock | accumulate full blocks of input (iflag only) |
nonblock | use non-blocking I/O |
noatime | do not update access time |
nocache | Request to drop cache. See also oflag=sync |
noctty | do not assign controlling terminal from file |
nofollow | do not follow symlinks |
count_bytes | treat 'count=N' as a byte count (iflag only) |
skip_bytes | treat 'skip=N' as a byte count (iflag only) |
seek_bytes | treat 'seek=N' as a byte count (oflag only) |