作者:焦振清
时间:2018-08-10
Each FLAG symbol may be:
- 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
- nonblock use non-blocking I/O
- noatime do not update access time
- nocache discard cached data
- noctty do not assign controlling terminal from file
- nofollow do not follow symlinks
- seek_bytes treat ‘seek=N’ as a byte count (oflag only)
11GB写入平均速度 | 11GB写入耗时 | |
---|---|---|
oflag=dsync | 23.8 MB/s | 451.175 s |
oflag=sync | 23.9 MB/s | 449.224 s |
oflag=noctty | 205 MB/s | 52.2653 s |
oflag=direct | 228 MB/s | 47.1613 s |
oflag=nocache | 1.8 GB/s | 6.06891 s |
无参数 | 2.0 GB/s | 5.31452 s |
oflag=nonblock | 2.1 GB/s | 5.18157 s |
oflag=noatime | 2.0 GB/s | 5.25155 s |
第一种场景:无参数
- dd if=/dev/zero of=./test.iso bs=1M count=10240
- 10240+0 records in
- 10240+0 records out
- 10737418240 bytes (11 GB) copied, 5.31452 s, 2.0 GB/s
第二种场景:oflag=direct
- dd if=/dev/zero of=./test.iso bs=1M count=10240 oflag=direct
- 10240+0 records in
- 10240+0 records out
- 10737418240 bytes (11 GB) copied, 47.1613 s, 228 MB/s
第三种场景:oflag=dsync
- dd if=/dev/zero of=./test.iso bs=1M count=10240 oflag=dsync
- 10240+0 records in
- 10240+0 records out
- 10737418240 bytes (11 GB) copied, 451.175 s, 23.8 MB/s
第四种场景:oflag=sync
- dd if=/dev/zero of=./test.iso bs=1M count=10240 oflag=sync
- 10240+0 records in
- 10240+0 records out
- 10737418240 bytes (11 GB) copied, 449.224 s, 23.9 MB/s
第五种场景:oflag=nonblock
- dd if=/dev/zero of=./test.iso bs=1M count=10240 oflag=nonblock
- 10240+0 records in
- 10240+0 records out
- 10737418240 bytes (11 GB) copied, 5.18157 s, 2.1 GB/s
第六种场景:oflag=noatime
- dd if=/dev/zero of=./test.iso bs=1M count=10240 oflag=noatime
- 10240+0 records in
- 10240+0 records out
- 10737418240 bytes (11 GB) copied, 5.25155 s, 2.0 GB/s
第七种场景:oflag=nocache
- dd if=/dev/zero of=./test.iso bs=1M count=10240 oflag=nocache
- 10240+0 records in
- 10240+0 records out
- 10737418240 bytes (11 GB) copied, 6.04308 s, 1.8 GB/s
第八种场景:oflag=noctty
- dd if=/dev/zero of=./test.iso bs=1M count=10240 oflag=noctty
- 10240+0 records in
- 10240+0 records out
- 10737418240 bytes (11 GB) copied, 52.3026 s, 205 MB/s
参考文章:
Linux中直接I/O机制的介绍