Using a USB Flash Drive to Boot and Load the Solaris OS for x86 PlatformsJames Whitlatch, Technologent; September 2007 Abstract: Here are steps to format and copy the Solaris 10 OS for x86 platforms from a boot DVD or ISO image to a USB flash drive. The article also shows which files to modify to make the miniroot mount the flash drive as the CD-ROM for an interactive installation of the Solaris OS. Additional steps show how to fully automate the OS installation. Contents
OverviewThis document covers how to format and copy the Solaris OS for x86 platforms from a boot DVD or ISO image to a USB flash drive. It then shows which files to modify to make the miniroot mount the flash disk as the CD-ROM for an interactive install. Then additional steps to fully automate the OS install are given. In testing with my USB flash drives, I was only able to test on a Sun Java Workstation W2100z and Sun Fire X4100 and X4200 servers. I used only the Solaris 10 11/06 OS (also known as Update 3). I'm sure it will work the same on any x86 system that is supported by the Solaris 10 release, and is capable of booting from an USB flash drive. This procedure requires an x86 system running the Solaris 10 OS to set up the flash drive as described here. The minimum USB flash drive size to hold the complete OS is 4GB. I used an 8GB size for this document.
With this procedure, I don't have to find a MAC address of the client, and it is flexible enough to customize the OS load for many different clients through the
Partitioning and Formatting the Flash Drive
So, to start,
# svcadm disable volfs
# rmformat -l
Looking for devices...
1. Logical Node: /dev/rdsk/c2t0d0p0
Physical Node: /pci@0,0/pci-ide@6/ide@0/sd@0,0
Connected Device: MATSHITA CD-RW CW-8124 DZ13
Device Type: DVD Reader
2. Logical Node: /dev/rdsk/c2t0d0p0
Physical Node: /pci@0,0/pci-ide@6/ide@0/sd@0,0
Connected Device: MATSHITA CD-RW CW-8124 DZ13
Device Type: DVD Reader
3. Logical Node: /dev/rdsk/c5t0d0p0
Physical Node: /pci@0,0/pci108e,cb84@2,1/storage@6/disk@0,0
Connected Device: UDISK PDU01_8G 76C2.0 0.00
Device Type: Removable
My flash drive is number 3. In this case the logical device name is
Now to create the partition, use the
# fdisk /dev/rdsk/c5t0d0p0
Total disk size is 3935 cylinders
Cylinder size is 4096 (512 byte) blocks
Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 Active Solaris2 1 3934 3934 100
SELECT ONE OF THE FOLLOWING:
1. Create a partition
2. Specify the active partition
3. Delete a partition
4. Change between Solaris and Solaris2 Partition IDs
5. Exit (update disk configuration and exit)
6. Cancel (exit without updating disk configuration)
Enter Selection:
Select the proper menu options and create a partition to consume 100 percent of the flash drive.
Create the partition to be of type # fdisk -W - /dev/rdsk/c5t0d0p0 * /dev/rdsk/c5t0d0p0 default fdisk table * Dimensions: * 512 bytes/sector * 32 sectors/track * 128 tracks/cylinder * 3935 cylinders .... * Id Act Bhead Bsect Bcyl Ehead Esect Ecyl Rsect Numsect 191 128 65 2 0 72 29 1003 4096 16113664
This flash drive has 16113664 as
# cat x86slice
slices: 0 = 2MB, 7865MB, "wm", "root" :
2 = 0, 7867MB, "wm", "backup":
8 = 0, 2MB, "wu", "boot"
Load the slices into the flash drive: # rmformat -s x86slice /dev/rdsk/c5t0d0p0
Place a file system on the # newfs /dev/rdsk/c5t0d0s0 newfs: construct a new file system /dev/rdsk/c5t0d0s0: (y/n)? y .... # mount /dev/dsk/c5t0d0s0 /usbdrv
Mount the CD-ROM or if using an ISO image, mount it now. Mounting an ISO is beyond the scope of this document, but doing a # mount -F hsfs /dev/dsk/c2t0d0s0 /cdrom Copying the OS DVD to the Flash Drive
Now to copy the OS files from the DVD media (whether DVD or ISO) to the flash drive. Change the working directory to the OS media base. You should find # cd /cdrom # ls Copyright Solaris_10 installer JDS-THIRDPARTYLICENSEREADME boot # find . -print | cpio -pudm /usbdrv This may take a while, so you have time for a break. Now that the copying is complete, the boot area of the master boot record needs to be loaded. # /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 \ /dev/rdsk/c5t0d0s0 Configuring to Mount the USB Drive as CD-ROM
If we boot off the flash drive now, it will boot the mini-root OS and start to load the new operating system and then stop because it can't mount the CD-ROM. We need to modify an install script so it will not stop.
The file we need to modify is in the /boot/solaris/bin/root_archive unpack archive root
The archive in the command for this example is on the install media ( # /boot/solaris/bin/root_archive unpack /cdrom/boot/x86.miniroot \ /tmp/Boot # vi /tmp/Boot/sbin/install-discovery
In the
trymountcd()
{
echo $Installfs | grep ramdisk > /dev/null
if [ $? = 0 ] && [ ! -d /cdrom/Solaris_* ] ; then
ls -l /dev/dsk | grep storage | grep 's0 -' \
| awk '{print $9}' | while read VAL
do
for Dev in /dev/dsk/${VAL}; do
Typ=`/usr/sbin/fstyp $Dev 2> /dev/null`
if [ "X${Typ}" = "Xufs" ] ; then
### <:-- Note the ufs is bold
mount -o ro $Dev /cdrom
if [ -d /cdrom/Solaris_* ] ; then
echo "Using install cd in $Dev"
# save install cd for wizards
echo $Dev >> ${CDROOT}
break
else
umount /cdrom 2> /dev/null
fi
fi
done
if [ -d /cdrom/Solaris_* ] ; then
break
fi
done ### <:-- don't forget this line too
else
if [ ! -d /cdrom/Solaris_* ] ; then
# "this never happens" :-)
echo "ERROR: The Solaris Distribution, ${Installfs} " \
"does not exist"
echo " Exiting to shell."
/sbin/sh
fi
fi
}
Save the file.
If you do not want to automate the OS load, go to the Finishing Up section below.
Because of the mechanism used to locate the flash drive (which is first locating a USB storage device, and then a UFS partition), it is advised to only have one USB drive (or disk) with a UFS partition connected to the system when booting. With more than one, the system could potentially mount either one as Automating the OS Install
To fully automate the install, the
network_interface=primary { hostname=x86box
ip_address=192.168.2.101
netmask=255.255.255.0
default_route=none
protocol_ipv6=NO}
terminal=vt100
security_policy=NONE
service_profile=open
name_service=NONE
root_password=G97uk8nCahUjk ##crypt password
timeserver=localhost
system_locale=en_US
timezone=US/Central
terminal=vt100
keyboard=US-English
pointer=MS-S
Remove the # rm /tmp/Boot/etc/sysidcfg # cp /sysidcfg /tmp/Boot/etc/sysidcfg
Now we have to modify the # vi /tmp/Boot/usr/sbin/install.d/profind
Find the
cdrom()
{
# Factory JumpStart is only allowed with factory
# stub images, indicated by the file /tmp/.preinstall
#
if [ -f /tmp/.preinstall ]; then
mount -o ro -F lofs ${CD_CONFIG_DIR} ${SI_CONFIG_DIR} >/dev/null 2>&1
if [ $? -eq 0 ]; then
verify_config "CDROM"
fi
fi
gettext " <<< using CD default >>>"; echo
rmdir ${SI_CONFIG_DIR}
ln -s /cdrom/.install_config ${SI_CONFIG_DIR}
}
Save the file.
From the # cp /tmp/Boot/usr/sbin/install.d/install_config/* \ /usbdrv/.install_config # cd /usbdrv/.install_config # ls Makefile install_begin medium_default rules.ok large_default patch_finish small_default
Place a profile similar to the following (or copy the one below) into the file Note that the controller and target numbers for your systems may be different. For more information on the profile file, see the "Creating a Profile" section in Solaris 10 11/06 Installation Guide: Custom JumpStart and Advanced Installations. # cat profile install_type initial_install system_type standalone cluster SUNWCXall partitioning explicit # fdisk c0t0d0 191 delete fdisk c0t0d0 solaris maxfree fdisk c0t2d0 191 delete fdisk c0t2d0 solaris maxfree filesys c0t0d0s0 free / filesys c0t0d0s1 10240 swap filesys c0t0d0s3 10240 /var
Create a rules file by using the # cd /usbdrv/.install_config # cp rules.ok rules # cat rules any - install_begin - patch_finish # version=2 checksum=4407 Edit the rules to be as follows. (Remove the version and checksum line.) any - install_begin profile patch_finish Save the file.
Run check against it (while still in the # /cdrom/Solaris_10/Misc/jumpstart_sample/check Validating rules... Validating profile profile... The custom JumpStart configuration is ok.
The last piece for full automation is setting up the GRUB menu list. We need to add a # cd /usbdrv/boot/grub # cat menu.lst # #pragma ident "@(#)install_menu 1.1 05/09/01 SMI" # default=0 timeout=60 title Solaris kernel /boot/multiboot kernel/unix - install -B \ install_media=cdrom module /boot/x86.miniroot title Solaris Serial Console ttya kernel /boot/multiboot kernel/unix -B \ install_media=cdrom,console=ttya module /boot/x86.miniroot title Solaris Serial Console ttyb (for lx50, v60x and v65x) kernel /boot/multiboot kernel/unix -B \ install_media=cdrom,console=ttyb module /boot/x86.miniroot title Solaris Single User kernel /boot/multiboot kernel/unix -s module /boot/x86.miniroot Saving the
|
| |||||||