By user12615793 on Dec 10, 2008
I was disappointed to discover that though the USB image that was generated from the OpenSolaris iso was only 800MB or so in size, the usbcopy script took over the whole USB stick that I was using. That's fine if you only are using 1GB sticks, but since they gave out 4GB sticks at CEC this year (and 2GB sticks last year), you're wasting 3.2GB of space that could be used for something else.
Typically for the Solaris InstallFest we use either the System Rescue CD or a GParted Live image. This becomes a problem since we're either waiting for someone to finish up using the OpenSolaris CD, or the System Rescue CD, or the GParted Live CD instead of actually doing something... or someone accidentally walks off with one CD still in their drive.
While doing this from a USB key may make you think that they'd walk off with our USB keys, I'd like to think that they'd likely not accidentally do it since the USB keys tend to stick out a bit more than a CD in the drive. Plus, we can use their own USB key to put the image on if they wish.
So here's some hacks to be able to create a Dual-Boot USB stick and use the rest of the space on the USB stick for the System Rescue image.
1. Get the usb file for OpenSolaris from http://genunix.org/distributions/indiana/osol-0811.usb and download the ISO for the System Rescue CD from http://www.sysresccd.org/Download
2. Get the usbcopy by installing the OpenSolaris SUNWdistro-const package from IPS.
pfexec pkg install SUNWdistro-const3. Write the USB file to the stick.
pfexec usbcopy osol-0811.usbAt this point, you will have "wasted" most of the space on the USB stick since you just wrote a 860MB image to a 4GB stick. You need to reclaim that space.
4. Repartition the USB stick.
pfexec format -e Select the USB stick fdisk Note the total Cylinders Delete the Solaris Partition Create a new Solaris Partition in the size that will fit the 860MB. Solaris FDISK is braindead so this will be fun. Create a FAT partition (partition type "c") using the rest of the key. Exit and save. Re-Create slice 0 on the Solaris partition to start with cylinder 1 and use the rest of the space. Label it, selecting SMI label5. Verify that you sized things correctly by running fsck against it.
pfexec fsck /dev/rdsk/c6t0d0s0If it isn't size correctly, you'll get a complaint saying it can't seek the last blocks. ie:
pfexec fsck /dev/rdsk/c6t0d0s0 \*\* /dev/rdsk/c6t0d0s0 CANNOT READ: DISK BLOCK 1680032: I/O error CONTINUE? n Program terminatedIf you get that, resize the Solaris fdisk partition larger.
6. Grow out the UFS file system to the rest of the slice if you so desire.
pfexec growfs /dev/rdsk/c6t0d0s07. Create a pcfs (FAT) filesystem on the other USB partition
pfexec mkfs -F pcfs -o b=SYSRESCD,fat=32 /dev/rdsk/c6t0d0p0:c8. At this point, if you yank the USB stick and re-insert it, both file systems should mount up under /media. If not, manually mount them.
9. Mount up the ISO of the System Rescue CD.
pfexec lofiadm -a /somelocation/rescuecd.iso pfexec mount -F hsfs -o ro /dev/lofi/1 /mnt10. Copy contents to USB partition. Don't do this as root though, for some reason it doesn't work as root.
cp -r /mnt/\* /media/SYSRESCD11. Add entries into menu.lst to point to rescueCD stuff.
pfexec vi /media/Flash\\ Disk/boot/grub/menu.lstAppend the following:
title RescueCD root (hd0,1) kernel /isolinux/rescuecd initrd /isolinux/initram.igz title Memtest root (hd0,1) kernel /isolinux/memtest8612. Unmount all of the filesystems and you should be able to boot from the USB stick.
I generally don't like getting multiple boot menus so this utilizes the GRUB in OpenSolaris instead of doing a chainloader to boot the System Rescue CD. The steps outlined above only utilize two of the many options in the System Rescue CD. You could get the SYSLINUX loader to load into the FAT32 parition on the USB stick and then chainload to get the rest of the options or translate other options from the syslinux.cfg into the grub menu file to get the rest.
This seems to work pretty well.
We can probably do a chainload to the SysRescueCD and get all of the other options too, but I need to figure out how to get the bootblock loaded there.