zhangguanzhang's Blog

使用 dd 利用 iso 文件制作 USB 启动盘

字数统计: 375阅读时长: 2 min
2017/07/15

命令

1
2
3
4

# bs ,每个块的填充字节,不足用空(NUL) 字符对齐
# sync 直接写磁盘,不写缓存
dd if=xxx.iso of=/dev/xxx bs=8M

可以利用 watch -n 5 每 5s 发送信号触发 dd 命令打印进度

1
watch -n 5 pkill -USR1 ^dd$

块大小不带的速度对比

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$ dd if=xxxxx.iso of=/dev/sdc oflag=sync
2937+0 records in
2937+0 records out
1503744 bytes (1.5 MB, 1.4 MiB) copied, 6.46976 s, 232 kB/s
4744+0 records in
4744+0 records out
2428928 bytes (2.4 MB, 2.3 MiB) copied, 10.518 s, 231 kB/s
6978+0 records in
6978+0 records out
3572736 bytes (3.6 MB, 3.4 MiB) copied, 15.4321 s, 232 kB/s
^C8593+0 records in
8593+0 records out
4399616 bytes (4.4 MB, 4.2 MiB) copied, 19.018 s, 231 kB/s

$ dd if=xxxxx.iso of=/dev/sdc oflag=sync bs=256k
192+0 records in
192+0 records out
50331648 bytes (50 MB, 48 MiB) copied, 2.34185 s, 21.5 MB/s
387+0 records in
387+0 records out
101449728 bytes (101 MB, 97 MiB) copied, 6.30703 s, 16.1 MB/s
566+0 records in
566+0 records out
148373504 bytes (148 MB, 142 MiB) copied, 11.4534 s, 13.0 MB/s
2034+0 records in
2034+0 records out
533200896 bytes (533 MB, 508 MiB) copied, 51.6781 s, 10.3 MB/s

$ dd if=xxxxx.iso of=/dev/sdc of=/dev/sdc bs=8M
151+0 records in
151+0 records out
1266679808 bytes (1.3 GB, 1.2 GiB) copied, 2.73058 s, 464 MB/s
163+0 records in
163+0 records out
1367343104 bytes (1.4 GB, 1.3 GiB) copied, 6.39844 s, 214 MB/s
169+0 records in
169+0 records out
1417674752 bytes (1.4 GB, 1.3 GiB) copied, 9.4705 s, 150 MB/s
177+0 records in
177+0 records out
1484783616 bytes (1.5 GB, 1.4 GiB) copied, 13.5664 s, 109 MB/s

实际上 dd 写入可以带进度的,例如下面:

1
dd if=test.img of=/dev/sdc  bs=8M status=progress
CATALOG
  1. 1. 命令
  2. 2. 块大小不带的速度对比