Showing posts with label Live Upgrade. Show all posts
Showing posts with label Live Upgrade. Show all posts

Thursday, September 6, 2012

Custom JumpStart flash install

Assume that the setup is according to Custom JumpStart framework setup.
Consider 192.168.0.12 as the IP address of the js-01 X86 Custom JumpStart server.
 
Solaris have always addressed the enterprise needs.
Automated installation is just another example of that.
All that's needed is already included built-in.
 
Solaris is continuously evolving and since Solaris 10 U9, support for Flash Archives have been incorporated to ZFS-root-based Custom JumpStart installations.
 
Compared to the conventional process, the flash install option is simpler.
The main benefit is that a fully updated system can be deployed in one step.
The conventional process requires a time-consuming post-installation update.
Since Solaris has many updates, currently U10 for Solaris 10, the catch-up is long.
Nonetheless, the conventional process is still invaluable to get to consistent images.
 
Another benefit is that it can be part of a disaster recovery procedure for a global zone (GZ).
This assumes, of course, that the non-global zones are backed up by other means.
My preferred NGZ backup option is through ZFS snapshots and streams.

The initial step is, of course, to create a Flash Archive base installation image.
As mentioned, the conventional Custom JumpStart can be used as a starting point.
In fact, I'd say that, for consistency, it's the preferred way to start creating an image.
  
Don't create NGZs for applications yet as they'll be carried out on a later phase.
  
Next, fully update the system.
Begin by applying the most recent patchset for the bulk part.
Wrap up by taking advantage of smpatch for a more fine grained control. 
Use no alternate BEs (ABE) as they aren't supported in the image.
   
Perform some clean-up before creating the image. 
Verify /var/tmp and possibly delete /var/run and inactive BEs (boot environments).
  
Finally, archive the image to where it can be used by Custom JumpStart.
 
js-01:~ # zfs create
            -o mountpoint=/images
            -o sharenfs='rw=base-01,ro=...' ...
js-01:~ # chmod 1777 /images 
 
base-01:~ # mount -F lofs -o nosub / /mnt
base-01:~ # [ -d /mnt/var/run ] && rm -r /mnt/var/run
base-01:~ # ls -la /mnt/var
base-01:~ # umount /mnt
base-01:~ # rm -r /var/tmp/...
base-01:~ # ludelete -R
 
base-01:~ # flarcreate
              -S -n base-01 /net/js-01/images/base-01.flar
 
js-01:~ # chown root:root /images/base-01.flar
  
If not going to use a Flash Archive file anytime soon, consider compressing it.
To achieve the highest compression ratio 7za is the answer.
 
# 7za a base-01{,.flar}
# [ -f base-01.7z ] && rm base-01.flar
  
A few adjustments to the Custom JumpStart profile and rules are needed as follows:
  
# cat rules

# keyword value   begin-script  profile          finish-script
# ------- ------- ------------- ---------------- ---------------
  karch   i86pc   -             profile_x86_flar finish_x86_flar

# cat profile_x86_flar
#
# keyword               value
# --------------------  -------------------------------------
  install_type          flash_install
  archive_location      nfs 192.168.0.12:/images/base-01.flar
  partitioning          explicit
  pool                  rpool auto auto auto mirror any any


# cat finish_x86_flar
#!/bin/sh
  
BASE=/a
BIN=$BASE/usr/bin
SBIN=$BASE/usr/sbin

#................................................................
# X86 fix - The boot device isn't where Solaris was installed
  
$BIN/sync
$SBIN/reboot
   
There's still one important problem: patching the boot miniroot.
Due to the natural evolution of ZFS, the miniroot must be updated accordingly.
The original booting miniroot can't handle the recent ZFS updates on a fully updated image.
   

Sunday, April 29, 2012

Live Upgrade together with smpatch

Integration of smpatch and liveupgrade is a powerful and great combination.
It eliminates risks and reduces downtime inherent to the patching activity.
Together with ZFS, smpatch and liveupgrade turn it all peace-of-cake.
Going straight, while the system is fully operational:

  • Make sure you have the latest LU patch (121430 for SPARC, 121431 for x86);
     
    # smpatch download -t -f -i 121430 | head
     

    Note the latest level (81 in this example) printed on the first line and use it next:
     
    # smpatch download -i 121430-81
    # smpatch add -i 121430-81

      
  •  Prepare /etc/lu/synclist accordingly; see synclist(4).
     
  • Create a new alternate boot environment (ABE);
    (if only the initial unamed BE exists, add the -c option to give it a name)
     
    # lucreate -n be-2012-may-u1
    # lustatus

     
      
      
  • Perform off-line patching operations to this new ABE;
    (the undocumented -C option works around a bug: operation not fully off-line)
     
    # smpatch analyze > /tmp/be-2012-may-u1.analyze
    # smpatch update -b be-2012-may-u1
        -C patchpro.install.types=
           rebootimmediate:rebootafter:
           reconfigimmediate:reconfigafter:
           standard:interactive:singleuser

      
  • Wait until the next reboot window to the activated and updated ABE.
     
    # init 6
      
  • In case of any problems with the new BE, go back to the previous one:
     
    # luactivate -n be-2012-april-u1
      
Keep out of the way with sub-datasets related to /var.
Don't create sub-datasets of zones' datasets or liveupgrade will fail.