Monday, November 2, 2009

How to create OpenSolaris Live USB Stick using 'dd' utility

Several months ago, I wrote tiny utility which enable to make OpenSolaris Live USB stick on Windows box. However some of expert user asked how to create Live USB stick with 'dd' utility on one's UNIX-like OS.

OpenSolaris's USB image file ( which often distributed with '.usb' extention ) is just 'dd' image of root partition. But it is not enough to create bootable USB stick since do not contain required data such as MBR, Grub and Partition Tables.

'usbcopy' shell-script on OpenSolaris generate such data using 'grub', 'fdisk' and 'format' command internally. I have to generate using other way on Windows box.

When developing v0.02 of USB Creator, I made some pattern of required data ( I call this 'head image' ) and flash it before USB image. Header images included in OsolLiveUSB002.zip may be useful for 'dd'-command user.

Please try to flash following procedure below;
  1. Download .usb image ( this example is for Ohta-san's b123 image )
  2. $ wget http://kohju.justplayer.com/docs/mirror/OpenSolaris/eeepc-special/osol-1002-b123-x86-WC-EeePC.usb -O osol-1002-b123-x86-WC-EeePC.usb
  3. Download OsolLiveUSB002.zip ( not v0.03 !! ) and extract
  4. $ wget 'http://devzone.sites.pid0.org/OpenSolaris/opensolaris-liveusb-creator/OsolLiveUSB002.zip?attredirects=0' -O OsolLiveUSB002.zip
    ...
    $ unzip OsolLiveUSB002.zip
    Archive: OsolLiveUSB002.zip
    inflating: OsolLiveUSB002/headimg/0.dat
    inflating: OsolLiveUSB002/headimg/1.dat
    inflating: OsolLiveUSB002/headimg/2.dat
    inflating: OsolLiveUSB002/headimg/3.dat
    inflating: OsolLiveUSB002/OsolLiveUSB.exe
  5. De-compress header images
  6. $ gzip -dc OsolLiveUSB002/headimg/0.dat > 1gb_headimg.dat
    $ gzip -dc OsolLiveUSB002/headimg/1.dat > 2gb_headimg.dat
    $ gzip -dc OsolLiveUSB002/headimg/2.dat > 4gb_headimg.dat
    $ gzip -dc OsolLiveUSB002/headimg/3.dat > 8gb_headimg.dat
  7. Flash your USB stick with concatinating header and .usb image
  8. I used 2GB-Stick of head image this time;
    (become superuser)
    # cat 2gb_headimg.dat osol-1002-b123-x86-WC-EeePC.usb | \
    dd of=(USB Device) (Additional Options)

14 コメント:

  1. jholMar 8, 2010 10:55 AM
    Thank you!
    ReplyDelete
  2. RobertMar 29, 2010 05:49 AM
    ah.. so that's why simply dd'ing the image to disk didn't work, thanks :)
    ReplyDelete
  3. casaubonApr 28, 2010 05:54 AM
    thank you very much, i've been looking all over the net for this.

    by the way, i simply can't understand why the folks at genunix don' generate dd'able usb images..
    ReplyDelete
  4. chonanMay 25, 2010 05:35 PM
    Hi jhol, Robert, casaubon,

    Thanks for visiting my blog.
    And I am happy that you got over some difficulty :)
    ReplyDelete
  5. AnonymousAug 1, 2010 03:01 PM
    you're a lifesaver. i finally was able to install opensolaris. unfortunately i found that it is not yet ready for laptop usage. it's at the stage where linux was some five years ago. wpa and bt mouse was a pain to get working. i think i will stick with linux for a few years more until it (hopefully) catches up.
    ReplyDelete
  6. AnonymousSep 29, 2010 01:58 PM
    Greeting from Hungary, nice job...
    ReplyDelete
  7. AnonymousNov 24, 2010 03:04 AM
    And what if we have USB drives with less than 1GB?

    I am trying to do this with a 256MB drive and used the 1GB header. I hope this works.
    ReplyDelete
  8. rabies shotsNov 30, 2010 11:14 PM
    Thanks for posting this blog! Yes i think i will stick with Linux for a few years more until it (hopefully) catches up.
    ReplyDelete
  9. promotional usbJan 14, 2011 01:40 AM
    Thanks so much, I've been struggling with this problem for quite a while now without being able to come up with a solution. Everything's fine now, thanks again.
    ReplyDelete
  10. AnonymousFeb 10, 2011 03:32 PM
    Could u also prepare a head file for 16gb usb sticks?
    ReplyDelete
  11. SprewellFeb 17, 2011 07:10 PM
    Thanks for this nice utility. :) I don't know how Oracle expects someone to install from the USB flash image if Solaris and usbcopy aren't already installed. I was able to use your instructions to install Solaris Express 2010.11 from Windows 7, though it wouldn't work if I used the USB003 utility: I had to use USB002.
    ReplyDelete
  12. анимешникMar 19, 2011 02:34 PM
    done all through this program, but on the flash drive did not appear distribution
    ReplyDelete
  13. floppyJun 12, 2011 01:17 PM
    Interesting. Do you know how to create the files (FAT32) for a boot with syslinux? (on usb).
    Reason: I have an usb with different distros (knoppix, TCL) and would like to add milax to the list.
    It will help in 1 week in order to show to my brothers in law in Ireland the taste of linux (and not paying buggy OSs).
    ReplyDelete
  14. Leon KullOct 25, 2011 05:51 AM
    Thanks!!!
    ReplyDelete