Pages

Subscribe

Find us on Google Plus

2013年12月28日土曜日

Mac でブート可能な USB メモリの作成

サーバに CentOS をインストールするために、CentOS の ISO イメージをブートできる USB メモリを作成したので、作成方法を書いていきます。今回は、 dd コマンドを使います。

USBメモリのアンマウント

dd コマンドを使用する場合、USBメモリをアンマウントしておく必要があります。普通に Finder で取出しボタンを押すと、デバイスファイルが認識されなくなるので、コマンドでアンマウントします。

まずは、df コマンドでアンマウントするデバイスファイルの確認から。

$ df -h
Filesystem      Size   Used  Avail Capacity  iused    ifree %iused  Mounted on
/dev/disk0s2   112Gi   42Gi   70Gi    38% 11033057 18379311   38%   /
devfs          186Ki  186Ki    0Bi   100%      645        0  100%   /dev
map -hosts       0Bi    0Bi    0Bi   100%        0        0  100%   /net
map auto_home    0Bi    0Bi    0Bi   100%        0        0  100%   /home
/dev/disk1s2   7.2Gi   29Mi  7.2Gi     1%     7476  1876160    0%   /Volumes/COS_6.5_F 

USBメモリは /dev/disk1s2 で認識されているようです。ということで、アンマウントします。

$ sudo umount /dev/disk1s2
umount(/Volumes/COS_6.5_F): Resource busy -- try 'diskutil unmount'

diskutil unmount を使えと言われるので、やってみます。

$ diskutil unmount /dev/disk1s2
Volume COS_6.5_F on disk1s2 unmounted

アンマウントできました。念の為にデバイスファイルを確認。ちゃんとありますね。

$ ls -la /dev/disk1s2
brw-r-----  1 root  operator    1,   5 12 25 22:41 /dev/disk1s2

ddコマンド

USB のアンマウントができたので、dd コマンドで USB に書き込みます。Ctrl + t 途中経過を表示できます。

$ sudo dd if=~/Documents/Software/CentOS-6.5-x86_64-minimal.iso of=/dev/disk1s2 bs=256m
load: 0.89  cmd: dd 3263 uninterruptible 0.00u 1.21s
1+0 records in
0+0 records out
0 bytes transferred in 157.815717 secs (0 bytes/sec)
1+1 records in
1+1 records out
417333248 bytes transferred in 245.783250 secs (1697973 bytes/sec)

おまけ

アンマウントせずに dd すると、Resource busy と怒られます。

$ sudo dd if=~/Downloads/CentOS-6.4-i386-minimal.iso of=/dev/disk4s2 bs=256m
Password:
dd: /dev/disk4s2: Resource busy

0 件のコメント:

コメントを投稿