星期一, 7月 25, 2011

製作FreeBSD可開機USB

雖然用UNetbootin 在各種平台都可利用開機iso/Disk image做出可開機USB,但因為它獨特的boot loader,FreeBSD或某些Linux Distribution會有問題。

以往FreeBSD的安裝媒體只有出ISO image,現在已經有memstick.img可選擇,例如:FreeBSD-8.2-RELEASE-i386-memstick.img。以前的方法(thinker)真的太麻煩了 :(


按照官方安裝手冊,若用FreeBSD要:
Writing the Image with dd(1)
Set the kern.geom.debugflags sysctl to be able to write a master boot record to the target device.
$ sudo sysctl kern.geom.debugflags=16
The .img file is not a regular file you copy to the memory stick. It is an image of the complete contents of the disk. This means that you cannot simply copy files from one disk to another. Instead, you must use dd(1) to write the image directly to the disk: (這裏假設USB是 /dev/sdc)
$ sudo dd if=FreeBSD-8.2-RELEASE-i386-memstick.img of=/dev/sdc bs=64k
手冊上沒寫,要先umount USB device,e.g.:
$ sudo umount /dev/sdc

Linux原本就可寫入MBR,所以只要:
$ sudo umount /dev/sdc
$ sudo dd if=FreeBSD-8.2-RELEASE-i386-memstick.img of=/dev/sdc bs=64k
Mac稍微麻煩一點,因為磁碟工具程式似乎不支援不認得的File System:
要知道mount到哪兒,可以在Terminal(終端機)看
$ sudo mount
若己經有檔案系統,可先別急著在Finder上按退出,因為會連device都退出 (這裏假設是 /dev/disk1)
$ sudo diskutil umount /dev/disk1
或是
$ sudo diskutil umount [你USB碟的Label名稱]
接下來
$ sudo dd if=FreeBSD-8.2-RELEASE-i386-memstick.img of=/dev/disk1 bs=64k

若是Windows可以利用 Image Writer for Windows

  1. Obtaining Image Writer for Windows
    Image Writer for Windows is a free application that can correctly write an image file to a memory stick. Download it from https://launchpad.net/win32-image-writer/ and extract it into a folder.
  2. Writing The Image with Image Writer
    Double-click the Win32DiskImager icon to start the program. Verify that the drive letter shown underDevice is the drive with the memory stick. Click the folder icon and select the image to be written to the memory stick. Click Save to accept the image file name. Verify that everything is correct, and that no folders on the memory stick are open in other windows. Finally, click Write to write the image file to the drive.

沒有留言: