【Mac】CentOSインストール用のUSBメモリを作成する


用意するもの

USBメモリ(8GB)

isoイメージのダウンロード

Macで理化学研究所のftpサーバにあるISOイメージをダウンロードする(最小構成で約1GB)

http://ftp.riken.jp/Linux/centos/7.7.1908/isos/x86_64/

USBメモリの認識確認

/dev/disk2として認識されている事がわかります

$ diskutil list
/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         251.0 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         250.7 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +250.7 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            134.6 GB   disk1s1
   2:                APFS Volume Preboot                 43.5 MB    disk1s2
   3:                APFS Volume Recovery                510.4 MB   disk1s3
   4:                APFS Volume VM                      4.3 GB     disk1s4

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *7.9 GB     disk2
   1:                       0xEF                         8.9 MB     disk2s2

USBメモリを初期化してフォーマットする

$ diskutil eraseDisk MS-DOS UNTITLED /dev/disk2
Started erase on disk2
Unmounting disk
Creating the partition map
Waiting for partitions to activate
Formatting disk2s2 as MS-DOS (FAT) with name UNTITLED
512 bytes per physical sector
/dev/rdisk2s2: 14990720 sectors in 1873840 FAT32 clusters (4096 bytes/cluster)
bps=512 spc=8 res=32 nft=2 mid=0xf8 spt=32 hds=255 hid=411648 drv=0x80 bsec=15020032 bspf=14640 rdcl=2 infs=1 bkbs=6
Mounting disk
Finished erase on disk2

USBメモリをアンマウントする

isoイメージを焼くにあたりddコマンドを実行するが、マウントしていると実行出来ないのでアンマウントする。

$ diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful

ddコマンドでイメージをUSBメモリに焼く

指定するデバイスがrdiskになっている事に注意

参考ページ: https://www.junk-works.science/disk-and-rdisk/

$ sudo dd if=CentOS-7-x86_64-Minimal-1908.iso of=/dev/rdisk2 bs=1m
942+0 records in
942+0 records out
987758592 bytes transferred in 94.048308 secs (10502673 bytes/sec)

これをサーバに接続してUSBメモリからブートするとインストールウィザードが走る