使用 DD 命令制作 USB 启动盘
Windows 下有很多很好用的 USB 启动盘制作工具,比如 Rufus,但是 MacOS 下这个类型的工具就少了很多,这里记录下在 MacOS 中用 DD
命令制作 Linux USB 启动盘的操作步骤。
操作步骤
查看磁盘挂载分区
使用命令diskutil list
查看所在 U 盘的分区,找到 U 盘的挂载点,此处挂载点为/dev/disk2
$ diskutil list
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk\_partition\_scheme \*31.0 GB disk2
1: DOS\_FAT\_32 UNTITLED 31.0 GB disk2s1
卸载 U 盘挂载
使用diskutil unmountDisk
命令,卸载 U 盘的挂载。
$ diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful
如果不卸载挂载点就写入启动盘,则会提示dd: /dev/disk2: Resource busy
。
使用 dd 来来写入 iso
使用 dd 命令来将 CentOS 写入启动盘,
sudo dd if=~/carl\_workSpace/software/os/CentOS-7-x86\_64-DVD-1810.iso of=/dev/rdisk2 bs=1m
注意:
- 此处
~/carl_workSpace/software/os/CentOS-7-x86_64-DVD-1810.iso
是我本地 CentOS 的路径,需要替换成实际的路径 /dev/rdisk2
就是上面diskutil list
列出的 U 盘挂载点, 并且注意,此处磁盘前面多了个 r,是rdisk2
,而不是disk2
,rdisk2
是disk2
的原始盘,目的是可以更快速的写入。
写入需要花费几分钟时间,期间可以使用 CTRL + T 来查看写入进度,显示如下:
109+0 records in
108+0 records out
113246208 bytes transferred in 7.430910 secs (15239884 bytes/sec)
也可以使用iostat
来查看磁盘写入进度
$ iostat -w 5
disk0 disk2 cpu load average
KB/t tps MB/s KB/t tps MB/s us sy id 1m 5m 15m
42.68 14 0.58 849.97 0 0.00 7 4 89 3.84 3.42 2.67
450.16 15 6.50 1024.00 7 7.19 3 3 94 3.70 3.39 2.67
85.34 124 10.33 1024.00 9 8.80 6 4 90 3.64 3.39 2.67
$
最终完成后,dd 命令输出:
4376+0 records in
4376+0 records out
4588568576 bytes transferred in 539.126637 secs (8511115 bytes/sec)
写入完成后,Macos 会有一个提示框,提示 “此电脑不能读取您插入的磁盘。”
USB 启动盘不能被 Macos 正常读取,但是可以用来被当作启动盘安装 CentOS。
使用diskutil list
可以查看到此时 U 盘的分区信息。
$ diskutil list
...
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk\_partition\_scheme \*31.0 GB disk2
1: 0xEF 8.9 MB disk2s2
$
弹出 U 盘
使用 “磁盘工具”APP 或者命令diskutil eject
弹出 U 盘。
diskutil eject /dev/disk2
延伸
Macos 中 / dev/disk 和 / dev/rdisk 的区别
首先查看man hdiutil
的描述:
Since any /dev entry can be treated as a raw disk image, it is worth noting which devices can be accessed when and how. /dev/rdisk nodes are character-special devices, but are “raw” in the BSD sense and force block-aligned I/O. They are closer to the physical disk than the buffer cache. /dev/disk nodes, on the other hand, are buffered block-special devices and are used primarily by the kernel’s filesystem code.
/dev/rdisk
是原始读取模式,没有经过文件系统的文件缓存机制,因此速度比/dev/disk
速度更快。
下面以 918M 大小的CentOS-7-x86_64-Minimal-1810.iso
为例来比较/dev/rdisk
和/dev/disk
的写入速度。两者的命令分别为
# 写入/dev/rdisk的速度
$ sudo dd if=CentOS-7-x86\_64-Minimal-1810.iso of=/dev/rdisk2 bs=1m
918+0 records in
918+0 records out
962592768 bytes transferred in 106.192945 secs (9064564 bytes/sec)
# 写入/dev/disk的速度
sudo dd if=CentOS-7-x86\_64-Minimal-1810.iso of=/dev/disk2 bs=1m
918+0 records in
918+0 records out
962592768 bytes transferred in 3016.605565 secs (319098 bytes/sec)
可以看到写入/dev/rdisk
花费了 106 秒,而写入/dev/disk
花费了 3016 秒, 差别巨大。
Reference
- CREATE CENTOS 7 BOOTABLE USB ON OSX
- Why is “/dev/rdisk” about 20 times faster than “/dev/disk” in Mac OS X
使用 DD 命令制作 USB 启动盘的更多相关文章
- Rufus 制作 USB 启动盘简单教程
制作 Windows 10 启动盘 U盘 / USB 安装盘图文教程 http://rufus.akeo.ie/downloads/rufus-2.2p.exe 1.将U盘连接到电脑,以管理员身份运 ...
- 在Mac OS X苹果lion系统上制作USB启动盘
本文翻译自:http://evan.borgstrom.ca/post/1314205955/osx-bootable-usb-from-iso 我也就不按照原文上一句句的翻译了,只说几个比较重要的步 ...
- ubuntu制作usb启动盘
准备: u盘 iso镜像文件--ubuntu-12.04.2-desktop-amd64.iso 烧盘软件--unetbootin-linux-583 步骤: 格式化u盘 查看u盘信息 #mount/ ...
- [administrative] windows 下制作USB启动盘的工具
arch魔教的文档: https://wiki.archlinux.org/index.php/USB_flash_installation_media windows 下的 dd: https:/ ...
- 【转载】在Linux系统下用dd命令制作ISO镜像U盘启动盘
#### 将U盘插入USB接口 #umount /dev/sdb* #dd if=/iso存放路径/XXX.iso of=/dev/sdb bs=1M ##### [转载]在Linux系统下用dd命令 ...
- dd usb 启动盘制作 成功版本
在linux系统中,使用dd命令制作启动盘成功.方法是在终端中输入命令: dd if=/root/opensuse.iso of=/dev/sdb bs=4M 说明: 1.o ...
- linux/OSX中“DD”命令制作ISO镜像操作系统安装U盘
linux或者OS X系统中,使用“dd”命令可以直接在终端命令行模式下,制作ISO镜像的系统安装盘. 一.linux系统以centOS7为例. sudo dd if=镜像路径 of=USB设备路径 ...
- 制作win10 usb 启动盘
Rufus 是一个开源的USB启动盘制作程序.其特点就是快速,且支持各种系统,包括各种windows系统,linux系统,使用也很简单. Rufus主页: http://rufus.akeo.ie/ ...
- 用U盘与移动硬盘制作WIN7启动盘(亲自实践)
昨晚帮一个娃娃用移动硬盘里面的一个分区帮他制作成一个win7系统盘,为了以后万一换系统的时候方便.我自己有一个U盘坐的启动盘,移动硬盘没有倒腾过,看网上N多都是相互抄,制作都是WINPE系统的,相当蛋 ...
随机推荐
- bzoj4695 最假女选手(势能线段树/吉司机线段树)题解
题意: 已知\(n\)个数字,进行以下操作: \(1.\)给一个区间\([L,R]\) 加上一个数\(x\) \(2.\)把一个区间\([L,R]\) 里小于\(x\) 的数变成\(x\) \(3.\ ...
- sdut3562-求字典序最小的最短路 按顶点排序后spfa的反例
首先我们可以这么搞...倒序建图,算出源点s附近的点距离终点的距离,然后判断一下,终点是否能跑到源点 能跑到的话呢,我们就判断s周围的点是否在最短路上,然后我们选编号最小的点就好了 代码 #inclu ...
- SQLite在C#的使用
SQLite在C#的使用 http://www.cnblogs.com/SharkBin/archive/2012/11/03/2752277.html System.Data.SQLite.DLL的 ...
- TypeScript TSConfig All In One
TypeScript TSConfig All In One tsconfig.json https://www.typescriptlang.org/tsconfig https://www.typ ...
- Web Performance API
Web Performance API 性能监测/性能优化 https://developer.mozilla.org/en-US/docs/Web/API/Performance https://d ...
- user tracker with ETag
user tracker with ETag 用户追踪, without cookies clear cache bug 实现原理 HTTP cache hidden iframe 1px image ...
- WiFi 测速
WiFi 测速 shit 联通 20M => 电信 20M ? https://zhuanlan.zhihu.com/p/86140645 shit 房东 中国电信网络测速 50M http:/ ...
- js destructuring assignment bug
js destructuring assignment bug https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Op ...
- 口罩 & 防毒面具 N95 & P100
口罩 & 防毒面具 N95 & P100 N95 口罩 < 防毒面具 P100 https://www.techritual.com/2020/01/30/210599/
- NGK八大板块:为何郊区市场近来火爆?-VALAITIS, PETER ANTHONY分析
PAUL ADAMS ARCHITECT LTD董事长VALAITIS, PETER ANTHONY称受大环境影响很多纽约人都选择离开纽约市中心,搬往附近郊区,因此附近地区楼市开始不断升温. 根据房地 ...