Tag: File system

Sparc Solaris 10 Jumpstart Flar DVD – Part 1

The Solaris Flash installation feature enables you to use a single reference installation of the Solaris OS on a system, which is called the master system. Then, you can replicate that installation on a number of systems, which are called clone systems. You can replicate clone systems with a Solaris Flash initial installation that overwrites all files on the system or with a Solaris Flash update that only includes the differences between two system images. A differential update changes only the files that are specified and is restricted to systems that contain software consistent with the old master image.

By combining Flash installation with Custom Jumpstart, and packaging all that on a re-mastered Solaris installation DVD, you can create very fast and efficient, standalone, and automated installation media.

I ran into several issues trying to create such a DVD when following the standard Google results so I thought I’d summarize my experiences. This is a work in progress- I might hit a brick wall at some point, but I hope not.

First, I built the prototype system. I’m running Solaris 10 11/06 with one non-global zone based entirely on a ZFS file system. This will make things challenging since Solaris Flash Archives are not completely compatible (or even supported) for these kinds of configurations and Jumpstart is not ZFS aware.

Creating the Flash Archive

  1. Make sure you have the right packages installed (SUNWinst, SUNWadmc, SUNWadmfw, SUNWbtool) Theoretically, you should install platform support for all possible hardware- I forget the name of the cluster- but if you will only be installing on the same hardware, this isn’t necessary. NOTE- If you try to install packages from inside single user mode with non-global zones it will give you issues.
  2. Put the prototype system into single user mode
  3. Create a text file, called for example ‘exclude’, with the directories not to include in the flash archive (man flarcreate)
  4. flarcreate -n system -X exclude -c system.flar
    Full Flash
    Checking integrity...
    Integrity OK.
    Running precreation scripts...
    Precreation scripts done.
    Determining the size of the archive...
    cpio: File size of "etc/mnttab" has decreased by 136
    2259925 blocks
    1 error(s)
    The archive will be approximately 764.41MB.
    Creating the archive...
    2259925 blocks
    Archive creation complete.
    Running postcreation scripts...
    Postcreation scripts done.

    Running pre-exit scripts...
    Pre-exit scripts done.
  5. Verify your archive: flar info -l system.flar

More to come…

Howto resize or shrink UFS partitions

A friend of mine asked me the other day if there was such a thing as Partition Magic for Solaris. Apparently, someone had installed a system on a single slice and they’re security team was requiring a separate partition for the DB.

Here are the givens:

  • Sunfire V210
  • Solaris 8 (Otherwise we’d be using zfs)
  • 2 73GB disks
  • 1 slice on disk1
  • Disk 2 is supposed to be a mirror of disk 1 but it isn’t used yet
  • Downtime is allowed
  • Reinstalling is not an option

I personally don’t know of any tool that lets you shrink UFS partitions but that doesn’t mean that we can’t perform some Partition Magic of our own.

NOTE:
I have not tested this procedure. I think it is logical and should work and it should do no harm as the first disk remains fully intact.

  1. Go into single user mode
  2. Partition the second disk as required.
  3. newfs the partitions on the second disk
  4. Mount the second disk’s partitions
  5. Use ufsdump/ufsrestore to copy the filesystem into it’s smaller home

    ufsdump 0f - / | ( cd /mnt/newroot ;ufsrestore xvf - )

  6. When all the partitions are done, use installboot to make the second disk bootable.

    installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t2d0s0

  7. Shutdown the system, physically swap the disks, and do a reconfiguration reboot.

If rebooting goes smoothly, test your new system thoroughly and then build your mirrors.

Cloning zones in Solaris 10 6/06

I’m in the process of setting up a machine to host several SAMP (Solaris-Apache-MySQL-PHP) containers. I decided that it would be very efficient to create a generic zone and clone it over and over again. From reading up on the subject it seemed more than possible, after all, what is a zone besides a config file and a filesystem?

I googled for “Cloning Solaris Zones” and found lots of documentation on the zoneadm clone feature. I started to follow the howtos and hit a brick wall… my zoneadm doesn’t know how to clone. Deeper digging shows that the documentation on Sun’s site was for Solaris Express- Sun’s bleeding edge version of OpenSolaris- Can I say “How useless!”

I continued to google, after all I was very close I have the configuration and the filesystem, I just need to connect the two. I found the zoneadm attach/detach commands. This sounds perfect to me but alas my zoneadm doesn’t support attach/detach. Apparently, this feature is only available from Solaris 11/06- Can someone tell me when Sun started releasing new OS versions every 6 months!

I had no intention of giving up and here is the process which evolved:

  1. Setup the “Gold Master” zone including all the services, users, passwords, etc. (I’m assuming that your zonepath is a ZFS filesystem- this has it’s pluses and minuses so don’t take my word on it.)
  2. Halt the Master zone and export the config file to your zone template file:

    zoneadm -z master halt
    zonecfg -z master export -f /root/template

  3. It should look something like this: (edit with values for new zone)

    create -b
    set zonepath=/zfszones/zoneclone
    set autoboot=true
    set pool=work1-pool
    add inherit-pkg-dir
    set dir=/lib
    end
    add inherit-pkg-dir
    set dir=/platform
    end
    add inherit-pkg-dir
    set dir=/sbin
    end
    add inherit-pkg-dir
    set dir=/usr
    end
    add net
    set address=192.168.0.2
    set physical=bge0
    end
    add rctl
    set name=zone.cpu-shares
    add value (priv=privileged,limit=10,action=none)
    end

  4. Configure a new zone using the new config file:

    zonecfg -z zoneclone -f zoneclone.cfg

  5. Create a ZFS snapshot of the master zone:

    zfs snapshot zfspool/[email protected]

  6. Clone the ZFS snapshot

    zfs clone zfspool/[email protected] zfspool/zoneclone

  7. Mount the new ZFS filesystem at the correct zonepath

    zfs setmountpoint=/zfszones/zoneclone/ zfspool/zoneclone

  8. Change the zone state to “installed” –WARNING: I have no idea if this is a good idea but it seems to work.

    vi /etc/zones/index

    Find a line that looks like:
    zoneclone:configured:/zfszones/zoneclone:0000003c-ffbf-f825-ffbf-f80001000000

    Replace it with:
    zoneclone:installed:/zfszones/zoneclone:0000003c-ffbf-f825-ffbf-f80001000000

  9. Boot the new zone:

    zoneadm -z zoneclone boot