Mac 將 iso 轉 usb、dmg 轉 usb、iso 轉 dmg

ISO to USB

列出外部磁碟

1
diskutil list external
1
2
3
4
5
6
7
8
$ diskutil list external
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *62.0 GB disk2
1: Windows_NTFS Ubuntu1804 4.0 GB disk2s1
2: Windows_NTFS Ubuntu1604 4.0 GB disk2s2
3: Windows_NTFS Ubuntu1404 4.0 GB disk2s3
4: Windows_NTFS Data 50.0 GB disk2s5

unmount 磁碟

1
diskutil unmount disk2s1
1
2
$ diskutil unmount disk2s1
Volume Ubuntu1804 on disk2s1 unmounted

將 ISO 寫入磁碟

1
sudo dd if=[imagePath] of=/dev/r[diskID] bs=1m
  • if:Input from,並非 Standard Input
  • of:Output from
1
sudo dd if=~/Desktop/ubuntu-18.04.2-desktop-amd64.iso of=/dev/rdisk2s1 bs=1m

退出磁碟

1
diskutil eject disk2

ISO to DMG

1
hdiutil convert -format UDRW -o /path/to/image.dmg /path/to/image.iso

DMG to USB

跟 ISO to USB 同一條指令

1
sudo dd if=/path/to/image.dmg of=/dev/rdiskN