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

注意:

  1. 此处~/carl_workSpace/software/os/CentOS-7-x86_64-DVD-1810.iso是我本地 CentOS 的路径,需要替换成实际的路径
  2. /dev/rdisk2就是上面diskutil list列出的 U 盘挂载点, 并且注意,此处磁盘前面多了个 r,是rdisk2,而不是disk2rdisk2disk2的原始盘,目的是可以更快速的写入。

写入需要花费几分钟时间,期间可以使用 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

使用 DD 命令制作 USB 启动盘的更多相关文章

  1. Rufus 制作 USB 启动盘简单教程

    制作 Windows 10 启动盘 U盘 / USB 安装盘图文教程  http://rufus.akeo.ie/downloads/rufus-2.2p.exe 1.将U盘连接到电脑,以管理员身份运 ...

  2. 在Mac OS X苹果lion系统上制作USB启动盘

    本文翻译自:http://evan.borgstrom.ca/post/1314205955/osx-bootable-usb-from-iso 我也就不按照原文上一句句的翻译了,只说几个比较重要的步 ...

  3. ubuntu制作usb启动盘

    准备: u盘 iso镜像文件--ubuntu-12.04.2-desktop-amd64.iso 烧盘软件--unetbootin-linux-583 步骤: 格式化u盘 查看u盘信息 #mount/ ...

  4. [administrative] windows 下制作USB启动盘的工具

    arch魔教的文档:  https://wiki.archlinux.org/index.php/USB_flash_installation_media windows 下的 dd: https:/ ...

  5. 【转载】在Linux系统下用dd命令制作ISO镜像U盘启动盘

    #### 将U盘插入USB接口 #umount /dev/sdb* #dd if=/iso存放路径/XXX.iso of=/dev/sdb bs=1M ##### [转载]在Linux系统下用dd命令 ...

  6. dd usb 启动盘制作 成功版本

    在linux系统中,使用dd命令制作启动盘成功.方法是在终端中输入命令:     dd if=/root/opensuse.iso of=/dev/sdb bs=4M     说明:      1.o ...

  7. linux/OSX中“DD”命令制作ISO镜像操作系统安装U盘

    linux或者OS X系统中,使用“dd”命令可以直接在终端命令行模式下,制作ISO镜像的系统安装盘. 一.linux系统以centOS7为例. sudo dd if=镜像路径 of=USB设备路径 ...

  8. 制作win10 usb 启动盘

    Rufus 是一个开源的USB启动盘制作程序.其特点就是快速,且支持各种系统,包括各种windows系统,linux系统,使用也很简单. Rufus主页: http://rufus.akeo.ie/ ...

  9. 用U盘与移动硬盘制作WIN7启动盘(亲自实践)

    昨晚帮一个娃娃用移动硬盘里面的一个分区帮他制作成一个win7系统盘,为了以后万一换系统的时候方便.我自己有一个U盘坐的启动盘,移动硬盘没有倒腾过,看网上N多都是相互抄,制作都是WINPE系统的,相当蛋 ...

随机推荐

  1. liunx命令二

    声明:以下资料全部摘自实验楼 常用快捷键 按键 作用 Table 补全命令 Ctrl+c 强制结束 Ctrl+d 键盘输入结束或退出终端 Ctrl+s 暂停当前程序,暂停后按下任意键恢复运行 Ctrl ...

  2. mysql(二)--mysql索引剖析

    1.1. 索引是什么 1.1.1.索引图解 维基百科对数据库索引的定义: 数据库索引,是数据库管理系统(DBMS)中一个排序的数据结构,以协助快速查询.更新数据库表中数据. 怎么理解这个定义呢?  首 ...

  3. SVG path d Attribute

    Scalable Vector Graphics (SVG) 1.1 (Second Edition) W3C Recommendation 16 August 2011 http://www.w3. ...

  4. SCSS 复用 class 样式

    SCSS 复用 class 样式 @mixin & @include 复用的变量名称,不可以是 .class 开头️ css-varibale-name .css-class-name Mix ...

  5. how to using js to realize notes feature on the website

    how to using js to realize notes feature on the website js & notes demos https://medium.com/brow ...

  6. react hooks & props change & pagination current bug

    react hooks & props change & pagination current bug multi tables & pigination bug & ...

  7. 死磕Spring之IoC篇 - 深入了解Spring IoC(面试题)

    该系列文章是本人在学习 Spring 的过程中总结下来的,里面涉及到相关源码,可能对读者不太友好,请结合我的源码注释 Spring 源码分析 GitHub 地址 进行阅读 Spring 版本:5.1. ...

  8. @media屏幕适应

    /** 屏幕特殊处理 我们用min-width时,小的放上面大的在下面,同理如果是用max-width那么就是大的在上面,小的在下面 **/ @media screen and (max-width: ...

  9. 1071 Speech Patterns——PAT甲级真题

    1071 Speech Patterns People often have a preference among synonyms of the same word. For example, so ...

  10. mui调用本地相册调用相机上传照片

    调用mui的常用库和jquery html部分: <header class="mui-bar mui-bar-nav"> <a class="mui- ...