Giving USB the boot - install

A sale on 4 GB USB jumpdrives ended yesterday at Fry's. It wasn't a huge savings, but for $49, there was a USB flash drive from PQI that seemed fairly decent and I bought one. I wasn't sure what I was going to do with it, but I was thinking along the lines of using it to burn Solaris Nevada b55 onto so I could carry it with me always and install other systems that support boot from USB. It's big enough afterall.

There's been lots of news from India about the Belenix folks on the Solaris-runnable Flash archive on the 1GB stick. It's very cool and the person -Anil Gulecha- who did the runnable flash stick image has been getting lots of praise. I thought I'd join in, since I leveraged a lot of things he was doing in his usbdump.sh to create a bootable Solaris Nevada b55 image onto that USB drive (on sale!).

Overview of Steps

Basically, the process is fairly straightforward, except the commands aren't always known or easy to remember.

    1. Format the USB drive and create a UFS filesystem on it.
    2. Copy over the files verbatim from the install DVD
    3. Install GRUB to make it bootable
    4. Boot a System to Install with the USB drive

As I discovered, the contents of the install DVD aren't quite amenable to a straightforward installation. There are definite dependencies for example, the path where the DVD install scripts expect the media to be (i.e. /cdrom). And this doesn't make life easy unless you know the workarounds. But as I discovered, the USB drive installation is about 30% faster than standard DVD install when it all works, and it's a lot quieter than a spinning optical drive. It also works when the system doesn't support PXEboot net-install, or the driver for the network isn't by default in the x86.miniroot for the installation OS. The flash drive, being a disk, makes it easy to include additional software like driver source files, the Studio 11 compiler packages, and optional freeware.

Formatting a USB flash drive for Solaris

This was shamelessly reverse engineered from Anil's usbdump.sh script and it seems to work pretty well. For those that don't want to extract out the relevant shell script lines to make their own script, basically, this is what I did to format my jump drive.

    1. stop volfs on your current Solaris 10 or Nevada box by typing the command: # svcadm disable volfs
    2. plug the USB flash drive in, wait several seconds
    3. run the command # rmformat -l to lists the removable media devices and find the Connected device which says something to the order of a Generic USB flash disk, and note the line which says: Logical Node: /dev/rdsk/c3t0d0p0 or something like that. I'll call the /dev/rdsk/c3t0d0s0 the [usbnode] going forward. You'll need to know yours later.
    4. # fdisk -B [usbnode] (where [usbnode] is from previous step)
    5. # fdisk -W - [usbnode] (need the extra hyphen for stdout - note the output
    6. Now, look at output from previous step and find max MB (MAXSIZE) of usable storage. You do this by multiplying bytes/sector (usually 512 at the top) with num sectors at the bottom of output (in my case, a 4 GB drive had roughly 7.9Million sections or so) divide by (1024\*1024) to yield MB (should be 3900 MB or so for a 4GB flash stick.
    7. setup your partition table file (a text file I'll call slices.txt, just plain white space between words and letters where it appears (remove dashed lines - eval {$MAXSIZE - x} expressions and replace with number with no brackets (e.g. 3897MB)

      slices: 0 = 2MB, {$MAXSIZE-3}MB, "wm", "root" :
               1 = 0, 1MB, "wu", "boot" :
               2 = 0, {$MAXSIZE - 1}MB, "wm", "backup"
      

    8. # rmformat -s ./path/to/slices.txt [usbnode]
    9. now run: # devfsadm; devfsadm -C
    10. Create a UFS on the flash drive by runing: # newfs /dev/rdsk/[usbslice] (slice means replace p0 with s0 in the [usbnode] path)
    11. wait for a minute to write, and now it's done.
    12. You can restart the volfs by running # svcadm enable volfs but you may want to hold if you plan to proceed to the next step immediately.

Loading the Install Media onto Flash drive

For the time it takes to burn a DVD with the Solaris install media, it's almost possible to copy the files onto disk using Solaris' loopback mount filesystem capability. The utility is lofiadm(1M) and is really useful for mounting ISO images already present on the filesystem and saves the hassle of burning media only to insert the finished DVD and remount it. Steps are the following to mount the Solaris install media ISO and copy them to the flash:

    1. # lofiadm -a /absolute/path/to/solarisdvd.iso (this should create a node /dev/lofi/1 which is reported on the command line)
    2. created a directory, e.g. # mkdir /mnt/solmedia and then run # mount -F hsfs -o ro /dev/lofi/1 /mnt/solmedia (you can change directories into /mnt/solmedia and check to see that the media is indeed there.
    3. disable the volfs again by running svcadm disable volfs if you re-enabled it after the prior task of formatting the flash drive.
    4. Insert the USB flash drive then wait a second and run the rmformat -l to list the logical node. You might want to create a directory mount point (e.g. # mkdir /mnt/usbdrive) and then run:
      # mount -o nologging,noatime [usbslice] /mnt/usbdrive
      Remember that the [usbslice] is the same as the logical [usbnode] but we created slice0 on that flash drive so we swat the p0 with s0 (e.g. /dev/dsk/c3t0d0p0 -> /dev/dsk/c3t0d0s0).
    5. now simply change directories to /mnt/solmedia and copy everything over. I've used the command # cd /mnt/solmedia; cp -rP@ .??\* \* /mnt/usbdrive. And once complete, should put all the media onto the USB drive.

Note that with some flash drives, including this PQI, I had data errors. At least if the error occurs, Solaris will usually tell me and then I note the error in the package and try to re-copy it later. What's more insidious is if the drive doesn't report errors initially but then encounters a few errors during the install and fails to install, say some of the Xorg components or fails to run the post-install on the fonts and then your windowing won't be able to come up. More details below.

Booting and Installing with the flash drive

On one IBM/Lenovo laptop we tried, we inserted the jump drive and the system BIOS knew to boot from the USB drive immediately. On an Acer Ferrari 3400, I like others who've reported the same thing, had to go into BIOS and set the boot order to be from a Hard Disk. Not a USB zip, USB floppy, or other USB drive. And on a PCChips V21G system, I pressed F11 to get into the boot menu and then found the Generic USB boot drive under the +Harddisk boot sub-menu.

Once booted, it looks just like the DVD/CDROM install. Only, the install scripts for this media all are expecting the installation content to be mounted under /cdrom. And so the boot will proceed partially, and then exit to a #sh prompt when it can't proceed with the installation. The solution I found was to mount the flash filesystem under /cdrom. But finding the logical [usbslice] to mount is a bit tougher. The rmformat utility isn't in the installers x86.miniroot so that utility isn't available. The next best thing is to look in /dev/usb/ and do a full listing (ls -l mass-storage\*) and observe the path. You should see one or more entries that should point to the physical path in the /devices/ tree. Note the exact path, which can be tedious, but if we back out directories to ../dsk/ and then do a full listing, we should see a similar slice. We want to mount the path for slice0. This usually ends up being /dev/dsk/c1t0d0s0, /dev/dsk/c0t0d0s0 or /dev/dsk/c2t0d0s0. If you aren't sure, just give those 3 entries a try using this command as an example: # mount -o ro /dev/dsk/c1t0d0s0 /cdrom.

To continue with the install, I think folks are recommending /sbin/install-solaris. But since we haven't gotten to the initial questions about hostname, networking, locale, etc., I've been using the /sbin/install-begin script. I hope someone reading this in the install group knows how to kicks this off again, and corrects me if this isn't the preferred way.

Notes

I was able to install on a couple of systems, and they booted, but Xorg failed to come up and I think it had something to do with corruption on a couple of font packages and Xorg drivers. Also, on a triple boot laptop, I was also having some issues getting the installer to go into Upgrade mode. It couldn't see the slice for Solaris, but it worked fine for a double-boot and . There's still bugs I guess, and some may be related to data corruption on these flash drives, which seem buggy. But it's not a bad start to get things to boot and come up. So that's progress. The next step is to look at adding some support into the script for install_media=[a local filesystem path] if someone hasn't done it already, and also to see if I can use a USB portable hard drive to see if this eliminates the data corruption errors.

In addition, the current Solaris install is fragile because it hard codes support (and therefore limits it) to /cdrom and nfs mount paths currently. I guess with access to the x86.miniroot for the installer, anyone might potentially add some support for USB drive mounting and installation off of that media with the right amount of clever scripting. That's probably a project requiring a whole weekend though, unless somebody's already done it.

Gotta run and pickup my new 2007 California fishing license and go fishing. Probably not something to hack this weekend.

Comments:

Post a Comment:
Comments are closed for this entry.
About

PotstickerGuru

Search

Categories
Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today