post:增加在macOS下制作Ubuntu启动U盘的文章。
This commit is contained in:
parent
3752eaa788
commit
934405dcfc
52
source/_posts/make-ubuntu-boot-macos.md
Normal file
52
source/_posts/make-ubuntu-boot-macos.md
Normal file
|
@ -0,0 +1,52 @@
|
|||
---
|
||||
title: 在macOS下制作Ubuntu启动U盘
|
||||
tags:
|
||||
- Linux
|
||||
- Ubuntu
|
||||
- macOS
|
||||
- Boot
|
||||
categories:
|
||||
- - DevOps
|
||||
- 系统管理
|
||||
keywords: 'Ubuntu,启动U盘,macOS'
|
||||
date: 2021-08-23 11:29:14
|
||||
---
|
||||
|
||||
Ubuntu的启动U盘在Windows系统下可以借助UltraISO工具来制作,但是在macOS下,就需要使用一系列的命令来制作了。这里对macOS中制作Ubuntu启动U盘的过程进行一个简要的记录。<!-- more -->
|
||||
|
||||
## 转换Ubuntu镜像
|
||||
|
||||
首先需要使用`hdiutil`工具将已经下载的Ubuntu镜像(.iso)转换成macOS上常用的DMG镜像(.dmg)。
|
||||
|
||||
```bash
|
||||
hdiutil convert -format UDRW -o ubuntu.iso ubuntu-20.04.2.0-desktop-amd64.iso
|
||||
```
|
||||
|
||||
其中格式`UDRW`表示转换成一个拥有读写权限的镜像。
|
||||
|
||||
## 弹出已经挂载的U盘
|
||||
|
||||
当U盘插入到计算机上的时候,会自动挂载,这时首先需要使用`diskutil`工具卸载。
|
||||
|
||||
```bash
|
||||
# 首先查询一下U盘所使用的设备号
|
||||
diskutil list
|
||||
# 假设U盘使用的设备号是/dev/disk2
|
||||
diskutil unountDisk /dev/disk2
|
||||
```
|
||||
|
||||
> 卸载U盘以后还需要保持U盘在计算机上插入的状态,不要拔下来。
|
||||
|
||||
## 复制镜像到U盘
|
||||
|
||||
复制Ubuntu镜像到U盘所需要的命令是`dd`。这个命令需要使用`if`参数指定输入源,`of`参数指定输出目标。`bs`是缓冲区块大小,一般选择`1m`足以。
|
||||
|
||||
```bash
|
||||
sudo dd if=./ubuntu.iso.dmg of=/dev/disk2 bs=1m
|
||||
```
|
||||
|
||||
当镜像写入完毕的时候,U盘会自动弹出。
|
||||
|
||||
## U盘格式化
|
||||
|
||||
格式化U盘同样使用`diskutil`工具,需要使用其中的`eraseDisk`子命令。这个子命令可以完成磁盘的重新分区。如果只是需要格式化一个分区,可以使用`eraseVolume`子命令。
|
Loading…
Reference in New Issue
Block a user