Total Pageviews

Friday, 10 October 2014

OS Live Upgrade !!!

Live Upgrade is the concept of upgrading the OS with minimum downtime.Whole concept revolves around boot environments.
Idea is to create a new boot environment and upgrade the new one while OS is still running on old Boot Environment.

So that once we upgrade the OS for new BE, we have to restart the server by activating the newBE.
The whole OS upgrade procedure will be carried out while OS online and running using old BE.So a single reboot is the actual downtime which we require once OS is upgraded.

For this live upgrade procedure we need following "lu" packages :

SUNWlucfg
SUNWluu
SUNWlur

After adding the mentioned packages we have to create a new boot environment and then we need to upgrade the newBE.
Once we upgrade the system , we need to activate the new BE so that whenever we reboot the system,this newBE will be activated.

root@mysrv1 # bash
root@mysrv1 # df -kh
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t0d0s0       30G    25G   4.0G    87%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                    29G   1.7M    29G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap2.so.1
                        30G    25G   4.0G    87%    /platform/sun4u-us3/lib/libc_psr.so.1
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap2.so.1
                        30G    25G   4.0G    87%    /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                    29G    32K    29G     1%    /tmp
swap                    29G    40K    29G     1%    /var/run
swap                    29G     0K    29G     0%    /dev/vx/dmp
swap                    29G     0K    29G     0%    /dev/vx/rdmp
root@mysrv1 #

Check the current OS version :

root@mysrv1 # uname -a
SunOS mysrv1 5.10 Generic_137137-09 sun4u sparc SUNW,Sun-Fire-V490
root@mysrv1 #
root@mysrv1 # cat /etc/release
                      Solaris 10 10/08 s10s_u6wos_07b SPARC
           Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                            Assembled 27 October 2008
root@mysrv1 #

Check whether "lu" packages are installed or not. If not install the packages....

root@mysrv1 # pkginfo -l SUNWlucfg
   PKGINST:  SUNWlucfg
      NAME:  Live Upgrade Configuration
  CATEGORY:  application
      ARCH:  sparc
   VERSION:  11.10,REV=2007.03.09.13.13
   BASEDIR:  /
    VENDOR:  Sun Microsystems, Inc.
      DESC:  Live Upgrade Configuration
    PSTAMP:  on10-adms-patch20080801101319
  INSTDATE:  Jan 04 2014 13:35
   HOTLINE:  Please contact your local service provider
    STATUS:  completely installed
     FILES:        5 installed pathnames
                   3 shared pathnames
                   3 directories
                  35 blocks used (approx)

root@mysrv1 # pkginfo -l SUNWluu
   PKGINST:  SUNWluu
      NAME:  Live Upgrade (usr)
  CATEGORY:  application
      ARCH:  sparc
   VERSION:  11.10,REV=2005.01.10.00.03
   BASEDIR:  /
    VENDOR:  Sun Microsystems, Inc.
      DESC:  Live Upgrade (usr)
    PSTAMP:  on10-adms-patcH20080730164103
  INSTDATE:  Jan 04 2014 13:38
   HOTLINE:  Please contact your local service provider
    STATUS:  completely installed
     FILES:      162 installed pathnames
                   9 shared pathnames
                  11 directories
                  42 executables
                2537 blocks used (approx)

root@mysrv1 # pkginfo -l SUNWlur
   PKGINST:  SUNWlur
      NAME:  Live Upgrade (root)
  CATEGORY:  application
      ARCH:  sparc
   VERSION:  11.10,REV=2005.01.10.00.03
   BASEDIR:  /
    VENDOR:  Sun Microsystems, Inc.
      DESC:  Live Upgrade (root)
    PSTAMP:  on10-adms-patch20080730164055
  INSTDATE:  Jan 04 2014 13:38
   HOTLINE:  Please contact your local service provider
    STATUS:  completely installed
     FILES:       39 installed pathnames
                  11 shared pathnames
                   4 linked files
                  15 directories
                  13 executables
                2596 blocks used (approx)
root@mysrv1 #
root@mysrv1 #

Check the second disk status, so that we can select 2nd disk for creating newBE within it.

root@mysrv1 #
root@mysrv1 # df -kh /
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t0d0s0       30G    25G   4.0G    87%    /
root@mysrv1 #
root@mysrv1 # echo | format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
          /pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000000875c9aa4,0
       1. c1t1d0 <HITACHI-HUS1014FASUN146G-2A08 cyl 14087 alt 2 hd 24 sec 848>
          /pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000000875cbe35,0
Specify disk (enter its number): Specify disk (enter its number):
root@mysrv1 #
root@mysrv1 #
root@mysrv1 # format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
          /pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000000875c9aa4,0
       1. c1t1d0 <HITACHI-HUS1014FASUN146G-2A08 cyl 14087 alt 2 hd 24 sec 848>
          /pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000000875cbe35,0
Specify disk (enter its number): 0
selecting c1t0d0
[disk formatted]
Warning: Current Disk has mounted partitions.
/dev/dsk/c1t0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c1t0d0s1 is currently used by swap. Please see swap(1M).

format> p

partition> p
Current partition table (original):
Total disk cylinders available: 14087 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 -  3091       30.01GB    (3092/0/0)   62928384
  1       swap    wu    3092 -  4740       16.00GB    (1649/0/0)   33560448
  2     backup    wm       0 - 14086      136.71GB    (14087/0/0) 286698624
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0

partition> q

format> disk 1
selecting c1t1d0
[disk formatted]
format> p

partition> p

Current partition table (unnamed):
Total disk cylinders available: 14087 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0 unassigned    wm       0 -  3091       30.01GB    (3092/0/0)   62928384
  1 unassigned    wm    3092 -  4740       16.00GB    (1649/0/0)   33560448
  2     backup    wu       0 - 14086      136.71GB    (14087/0/0) 286698624
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wu       0                0         (0/0/0)             0

partition> q

format> q
root@mysrv1 #

We can use this 2nd disk for creating newBE on it.

CMD :  lucreate -c current_BE -m mountpoint:device:FStype -n new_BE

This takes long time, so while in progress we can check progress in duplicate session :

root@mysrv1 #
root@mysrv1 # lucreate -c oldBE -m /:/dev/dsk/c1t1d0s0:ufs -n newBE-disk1
Discovering physical storage devices
Discovering logical storage devices
Cross referencing storage devices with boot environment configurations
Determining types of file systems supported
Validating file system requests
Preparing logical storage devices
Preparing physical storage devices
Configuring physical storage devices
Configuring logical storage devices
Analyzing system configuration.
No name for current boot environment.
Current boot environment is named <oldBE>.
Creating initial configuration for primary boot environment <oldBE>.
The device </dev/dsk/c1t0d0s0> is not a root device for any boot environment; cannot get BE ID.
PBE configuration successful: PBE name <oldBE> PBE Boot Device </dev/dsk/c1t0d0s0>.
Comparing source boot environment <oldBE> file systems with the file
system(s) you specified for the new boot environment. Determining which
file systems should be in the new boot environment.
Updating boot environment description database on all BEs.
Searching /dev for possible boot environment filesystem devices

Updating system configuration files.
The device </dev/dsk/c1t1d0s0> is not a root device for any boot environment; cannot get BE ID.
Creating configuration for boot environment <newBE-disk1>.
Source boot environment is <oldBE>.
Creating boot environment <newBE-disk1>.
Creating file systems on boot environment <newBE-disk1>.
Creating <ufs> file system for </> in zone <global> on </dev/dsk/c1t1d0s0>.
Mounting file systems for boot environment <newBE-disk1>.
Calculating required sizes of file systems for boot environment <newBE-disk1>.
Populating file systems on boot environment <newBE-disk1>.
Checking selection integrity.
Integrity check OK.
Populating contents of mount point </>.
Copying.
Creating shared file system mount points.
Copying root of zone <zonea>.
zoneadm: zone 'zonea': illegal UUID value specified
Creating compare databases for boot environment <newBE-disk1>.
Creating compare database for file system </>.
Updating compare databases on boot environment <newBE-disk1>.
Making boot environment <newBE-disk1> bootable.
Population of boot environment <newBE-disk1> successful.
Creation of boot environment <newBE-disk1> successful.
root@mysrv1 #

############ $$$$$$$$$$$$$$$$$$$$$ #################

Checking in other session :

root@mysrv1 # date
Tuesday, September  2, 2014  5:43:22 PM IST
root@mysrv1 #
root@mysrv1 # lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
oldBE                      yes      yes    yes       no     -
newBE-disk1                no       no     no        no     ACTIVE

After sometime, around 1hr it will be completed....

root@mysrv1 # date
Tuesday, September  2, 2014  6:50:55 PM IST
root@mysrv1 #
root@mysrv1 # lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
oldBE                      yes      yes    yes       no     -
newBE-disk1                yes      no     no        yes    -

############ $$$$$$$$$$$$$$$$$$$$$ #################

Now let us proceed with live upgrading the OS on this newBE which is created....


First of all copy the source of OS image file .....

root@mysrv1 #
root@mysrv1 # mount 10.20.30.185:/eisdvd /mnt                        ------ MY EISDVD
root@mysrv1 #
root@mysrv1 # df -kh /mnt
Filesystem             size   used  avail capacity  Mounted on
10.20.30.185:/eisdvd    32G    30G   1.4G    96%    /mnt
root@mysrv1 #
root@mysrv1 # cd /mnt
root@mysrv1 #
root@mysrv1 # ls -lrth *ola*
-rw-r--r--   1 root     root        5.4M Mar 31  2012 scli-1.7.1-18.sparc.Solaris.pkg
-rw-r--r--   1 root     root        2.1M Jul 18  2012 scli-1.7.3-20.sparc.Solaris.pkg.z
-rwxr-xr-x   1 root     root        1.3G Dec 12  2013 VRTS_SF_HA_Solutions_6.1_Solaris_SPARC.tar

PP-Solaris11:
total 54768
-rw-r--r--   1 root     root         27M Jun  4  2013 EMCPower.SOLARIS11.5.5.P02.b012.tar.gz

Solaris10U11:
total 4523184
-rw-r--r--   1 root     root        2.2G Mar 27  2013 sol-10-u11-ga-sparc-dvd.iso

Solaris_11:
total 5811648
-rw-r--r--   1 root     root        2.1G Jun 14  2013 p16941261_1100_Solaris86-64.zip
-rw-r--r--   1 root     root        678M May  7 12:19 sol-11_1-text-sparc.iso
root@mysrv1 #
root@mysrv1 #
root@mysrv1 # cd Solaris10U11
root@mysrv1 #
root@mysrv1 # ls -rlth
total 4523184
-rw-r--r--   1 root     root        2.2G Mar 27  2013 sol-10-u11-ga-sparc-dvd.iso
root@mysrv1 #
root@mysrv1 # cp sol-10-u11-ga-sparc-dvd.iso /tmp
root@mysrv1 #
root@mysrv1 #
root@mysrv1 # cd /tmp
root@mysrv1 #
root@mysrv1 # ls -lrth
total 4521040
-rw-r--r--   1 root     root        2.2G Mar 27  2013 sol-10-u11-ga-sparc-dvd.iso
drwxr-xr-x   2 noaccess noaccess     178 Aug 29 03:53 hsperfdata_noaccess
drwxr-xr-x   2 root     root         117 Aug 29 03:53 hsperfdata_root
root@mysrv1 #

Mount the image file to give the path of it for live upgrade.

root@mysrv1 #
root@mysrv1 # lofiadm -a /tmp/sol-10-u11-ga-sparc-dvd.iso
/dev/lofi/1
root@mysrv1 #
root@mysrv1 #
root@mysrv1 # mkdir /sol10
root@mysrv1 #
root@mysrv1 # mount -F hsfs /dev/lofi/1 /sol10
root@mysrv1 #
root@mysrv1 #
root@mysrv1 # df -kh
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t0d0s0       30G    25G   3.9G    87%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                    26G   1.7M    26G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap2.so.1
                        30G    25G   3.9G    87%    /platform/sun4u-us3/lib/libc_psr.so.1
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap2.so.1
                        30G    25G   3.9G    87%    /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                    29G   2.2G    26G     8%    /tmp
swap                    26G    40K    26G     1%    /var/run
swap                    26G     0K    26G     0%    /dev/vx/dmp
swap                    26G     0K    26G     0%    /dev/vx/rdmp
/dev/lofi/1            2.2G   2.2G     0K   100%    /sol10
root@mysrv1 #

So let us start upgrading the OS on this newBE ...
This takes long time, so check the status in other session.

root@mysrv1 # luupgrade -u -n newBE-disk1 -s /sol10

67352 blocks
miniroot filesystem is <lofs>
Mounting miniroot at </sol10/Solaris_10/Tools/Boot>
Validating the contents of the media </sol10>.
The media is a standard Solaris media.
The media contains an operating system upgrade image.
The media contains <Solaris> version <10>.
Constructing upgrade profile to use.
Locating the operating system upgrade program.
Checking for existence of previously scheduled Live Upgrade requests.
Creating upgrade profile for BE <newBE-disk1>.
Determining packages to install or upgrade for BE <newBE-disk1>.
Performing the operating system upgrade of the BE <newBE-disk1>.
CAUTION: Interrupting this process may leave the boot environment unstable
or unbootable.
Upgrading Solaris: 100% completed
Installation of the packages from this media is complete.
Updating package information on boot environment <newBE-disk1>.
Package information successfully updated on boot environment <newBE-disk1>.
Adding operating system patches to the BE <newBE-disk1>.
The operating system patch installation is complete.
INFORMATION: The file </var/sadm/system/logs/upgrade_log> on boot
environment <newBE-disk1> contains a log of the upgrade operation.
INFORMATION: The file </var/sadm/system/data/upgrade_cleanup> on boot
environment <newBE-disk1> contains a log of cleanup operations required.
INFORMATION: Review the files listed above. Remember that all of the files
are located on boot environment <newBE-disk1>. Before you activate boot
environment <newBE-disk1>, determine if any additional system maintenance
is required or if additional media of the software distribution must be
installed.
The Solaris upgrade of the boot environment <newBE-disk1> is complete.
root@mysrv1 #

############# $$$$$$$$$$$$$$$ ##############

To check the status from duplicate session :

root@mysrv1 # date
Tuesday, September  2, 2014  7:31:17 PM IST
root@mysrv1 #
root@mysrv1 # lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
oldBE                      yes      yes    yes       no     -
newBE-disk1                yes      no     no        no     UPDATING
root@mysrv1 #
root@mysrv1 #

After sometime, around 30 -- 45 mins it will be completed...

root@mysrv1 #
root@mysrv1 # lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
oldBE                      yes      yes    yes       no     -
newBE-disk1                yes      no     no        yes    -
root@mysrv1 #

############# $$$$$$$$$$$$$$$ ##############

Now check it with luactivate command :

root@mysrv1 #
root@mysrv1 # luactivate
oldBE
root@mysrv1 #

Currently activated BE is oldBE , now let us activate newBE so, on next reboot this newBE will be activated....

root@mysrv1 # luactivate newBE-disk1
A Live Upgrade Sync operation will be performed on startup of boot environment <newBE-disk1>.

**********************************************************************

The target boot environment has been activated. It will be used when you
reboot. NOTE: You MUST NOT USE the reboot, halt, or uadmin commands. You
MUST USE either the init or the shutdown command when you reboot. If you
do not use either init or shutdown, the system will not boot using the
target BE.

**********************************************************************

In case of a failure while booting to the target BE, the following process
needs to be followed to fallback to the currently working boot environment:

1. Enter the PROM monitor (ok prompt).

2. Change the boot device back to the original boot environment by typing:

     setenv boot-device
/pci@9,600000/SUNW,qlc@2/fp@0,0/disk@w21000000875c9aa4,0:a

3. Boot to the original boot environment by typing:

     boot

**********************************************************************

Modifying boot archive service
Activation of boot environment <newBE-disk1> successful.
root@mysrv1 #

We successfully activated the newBE.....
We can check it , as following :

root@mysrv1 #
root@mysrv1 # luactivate
newBE-disk1
root@mysrv1 #
root@mysrv1 # lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
oldBE                      yes      yes    no        no     -
newBE-disk1                yes      no     yes       no     -
root@mysrv1 #
root@mysrv1 #

On next reboot of system, the newBE will be activated and thus OS will be upgraded...
Till now our server is up and running, so the final reboot will be the only downtime which we require in LIVE UPGRADE.

Take the Console , and reboot the server :

RSC version 2.2.3 (EDMSCON1)

Please login: admin
Please Enter password:

rsc>
rsc>
rsc> console

mysrv1 console login: root
Password:
Last login: Tue Sep  2 18:22:11 from 10.82.19.13
Sep  2 20:34:31 mysrv1 login: ROOT LOGIN /dev/console
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
You have mail.
Sourcing //.profile-EIS.....
root@mysrv1 #
root@mysrv1 #
root@mysrv1 # init 6
root@mysrv1 #
root@mysrv1 #
root@mysrv1 #
root@mysrv1 # Sep  2 20:35:29 mysrv1 syseventd[399]: SIGHUP caught - reloading modules
Sep  2 20:35:30 mysrv1 syseventd[399]: Daemon restarted
svc.startd: The system is coming down.  Please wait.
svc.startd: 105 system services are now being stopped.
Sep  2 20:35:42 mysrv1 syslogd: going down on signal 15
svc.startd: The system is down.
syncing file systems... done
rebooting...

Resetting ...

RSC Alert: Host System has Reset
ChassisSerialNumber 0752AM0784

Sun Fire V490, No Keyboard
Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
OpenBoot 4.30.4.c, 16384 MB memory installed, Serial #72009526.
Ethernet address 0:14:4f:4a:c7:36, Host ID: 844ac736.

Rebooting with command: boot
Boot device: /pci@9,600000/SUNW,qlc@2/fp@0,0/disk@w21000000875cbe35,0:a  File and args:
SunOS Release 5.10 Version Generic_147147-26 64-bit
Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved.
Hostname: mysrv1

Configuring devices.
Loading smf(5) service descriptions: 60/60

mysrv1 console login: root
Password:
Last login: Tue Sep  2 17:43:41 from 10.52.98.13
Sep  2 20:38:10 mysrv1 login: ROOT LOGIN /dev/console
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
You have mail.
Sourcing //.profile-EIS.....
root@mysrv1 #

After successful reboot, we can check OS version :

root@mysrv1 #
root@mysrv1 # uname -a
SunOS mysrv1 5.10 Generic_147147-26 sun4u sparc SUNW,Sun-Fire-V490
root@mysrv1 #
root@mysrv1 #
root@mysrv1 # cat /etc/release
                   Oracle Solaris 10 1/13 s10s_u11wos_24a SPARC
  Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved.
                            Assembled 17 January 2013
root@mysrv1 #
root@mysrv1 # df -kh
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t1d0s0       30G    24G   5.0G    83%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                    29G   1.7M    29G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap2.so.1
                        30G    24G   5.0G    83%    /platform/sun4u-us3/lib/libc_psr.so.1
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap2.so.1
                        30G    24G   5.0G    83%    /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                    29G   112K    29G     1%    /tmp
swap                    29G    48K    29G     1%    /var/run
swap                    29G     0K    29G     0%    /dev/vx/dmp
swap                    29G     0K    29G     0%    /dev/vx/rdmp
/vol/dev/dsk/c0t0d0/sol_10_1008_sparc
                       2.5G   2.5G     0K   100%    /cdrom/sol_10_1008_sparc
root@mysrv1 #

By this we upgrade the OS using live upgrade procedure.....
Now compare the BE's...

root@mysrv1 # lufslist newBE-disk1
               boot environment name: newBE-disk1
               This boot environment is currently active.
               This boot environment will be active on next system boot.

Filesystem              fstype    device size Mounted on          Mount Options
----------------------- -------- ------------ ------------------- --------------
/dev/dsk/c1t0d0s1       swap                ? -                   -
/dev/dsk/c1t1d0s0       ufs       32219332608 /                   -
root@mysrv1 #
root@mysrv1 #
root@mysrv1 # lufslist oldBE
               boot environment name: oldBE

Filesystem              fstype    device size Mounted on          Mount Options
----------------------- -------- ------------ ------------------- --------------
/dev/dsk/c1t0d0s1       swap                ? -                   -
/dev/dsk/c1t0d0s0       ufs       32219332608 /                   -
root@mysrv1 #

For comparing the BE's :

root@mysrv1 # lucompare oldBE
Determining the configuration of oldBE ...

        < newBE-disk1
        > oldBE

Processing Global Zone
Comparing / ...

Compare complete for /.
root@mysrv1 #

############ $$$$$$$$$$$ #############

We can check the status from duplicate session :

root@mysrv1 # lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
oldBE                      yes      no     no        no     COMPARING
newBE-disk1                yes      yes    yes       no     -
root@mysrv1 #

After successful comparison,

root@mysrv1 #
root@mysrv1 # lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
oldBE                      yes      no     no        yes    -
newBE-disk1                yes      yes    yes       no     -
root@mysrv1 #

############ $$$$$$$$$$$ #############

OS live upgrade is helpful to upgrade any system using BE concept with very minimum downtime.

#################################################################################

Friday, 22 August 2014

Veritas Encapsulation !!!

Veritas Encapsulation is the concept of bringing rootdisk under veritas control.We can perform this at any moment, as it preserves the existing data.

Similar to ufs we cannot grow or shrink rootvol and swapvol.We can encapsulate our rootdisk in sliced format and have to leave atleast 2 spare slices for public and private regions.

Now let's go with practical ,

root@mysrv1 #
root@mysrv1 # bash
root@mysrv1 #
root@mysrv1 # df -kh
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t0d0s0       30G    23G   6.3G    79%    /              
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                    29G   1.7M    29G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap2.so.1
                        30G    23G   6.3G    79%    /platform/sun4u-us3/lib/libc_psr.so.1
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap2.so.1
                        30G    23G   6.3G    79%    /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                    29G    32K    29G     1%    /tmp
swap                    29G    40K    29G     1%    /var/run
swap                    29G     0K    29G     0%    /dev/vx/dmp
swap                    29G     0K    29G     0%    /dev/vx/rdmp
root@mysrv1 #

From above output, we know that currently rootdisk is in normal c#t#d# format.
Let's check in /etc/vfstab also.....

root@mysrv1 # cat /etc/vfstab
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c1t0d0s1       -       -       swap    -       no      -
/dev/dsk/c1t0d0s0       /dev/rdsk/c1t0d0s0      /       ufs     1       no      -
/devices        -       /devices        devfs   -       no      -
sharefs -       /etc/dfs/sharetab       sharefs -       no      -
ctfs    -       /system/contract        ctfs    -       no      -
objfs   -       /system/object  objfs   -       no      -
swap    -       /tmp    tmpfs   -       yes     -
#/dev/dsk/c1t0d0s1      -       -       swap    -       no      -
root@mysrv1 #

Now we can proceed with our steps for encapsulation.....

root@mysrv1 # vxdiskadm

Volume Manager Support Operations
Menu: VolumeManager/Disk

 1      Add or initialize one or more disks
 2      Encapsulate one or more disks
 3      Remove a disk
 4      Remove a disk for replacement
 5      Replace a failed or removed disk
 6      Mirror volumes on a disk
 7      Move volumes from a disk
 8      Enable access to (import) a disk group
 9      Remove access to (deport) a disk group
 10     Enable (online) a disk device
 11     Disable (offline) a disk device
 12     Mark a disk as a spare for a disk group
 13     Turn off the spare flag on a disk
 14     Unrelocate subdisks back to a disk
 15     Exclude a disk from hot-relocation use
 16     Make a disk available for hot-relocation use
 17     Prevent multipathing/Suppress devices from VxVM's view
 18     Allow multipathing/Unsuppress devices from VxVM's view
 19     List currently suppressed/non-multipathed devices
 20     Change the disk naming scheme
 21     Get the newly connected/zoned disks in VxVM view
 22     Change/Display the default disk layouts
 23     Mark a disk as allocator-reserved for a disk group
 24     Turn off the allocator-reserved flag on a disk
 list   List disk information

 ?      Display help about menu
 ??     Display help about the menuing system
 q      Exit from menus

Select an operation to perform: 2

Encapsulate one or more disks
Menu: VolumeManager/Disk/Encapsulate
  Use this operation to convert one or more disks to use the Volume Manager.
  This adds the disks to a disk group and replaces existing partitions
  with volumes.  Disk encapsulation requires a reboot for the changes
  to take effect.

  More than one disk or pattern may be entered at the prompt.  Here are
  some disk selection examples:

  all:          all disks
  c3 c4t2:      all disks on both controller 3 and controller 4, target 2
  c3t4d2:       a single disk (in the c#t#d# naming scheme)
  xyz_0 :       a single disk (in the enclosure based naming scheme)
  xyz_ :        all disks on the enclosure whose name is xyz

Select disk devices to encapsulate:
[<pattern-list>,all,list,q,?] list

DEVICE       DISK         GROUP        STATUS
c1t0d0       -            -            online invalid
c1t1d0       -            -            error

Select disk devices to encapsulate:
[<pattern-list>,all,list,q,?] c1t0d0
  Here is the disk selected.  Output format: [Device_Name]

  c1t0d0

Continue operation? [y,n,q,?] (default: y)
  You can choose to add this disk to an existing disk group or to
  a new disk group.  To create a new disk group, select a disk group
  name that does not yet exist.

Which disk group [<group>,list,q,?] rootdg

Create a new group named rootdg? [y,n,q,?] (default: y)

Use a default disk name for the disk? [y,n,q,?] (default: y)
  A new disk group will be created named rootdg and the selected
  disks will be encapsulated and added to this disk group with
  default disk names.

  c1t0d0

Continue with operation? [y,n,q,?] (default: y)
  The following disk has been selected for encapsulation.
  Output format: [Device_Name]

  c1t0d0

Continue with encapsulation? [y,n,q,?] (default: y)
  A new disk group rootdg will be created and the disk device c1t0d0 will
  be encapsulated and added to the disk group with the disk name rootdg01.

Enter desired private region length
[<privlen>,q,?] (default: 65536)
  The c1t0d0 disk has been configured for encapsulation.
  The first stage of encapsulation has completed successfully.  You
  should now reboot your system at the earliest possible opportunity.
  The encapsulation will require two or three reboots which will happen
  automatically after the next reboot.  To reboot execute the command:

shutdown -g0 -y -i6

  This will update the /etc/vfstab file so that volume devices are
  used to mount the file systems on this disk device.  You will need
  to update any other references such as backup scripts, databases,
  or manually created swap devices.

Encapsulate other disks? [y,n,q,?] (default: n)

Volume Manager Support Operations
Menu: VolumeManager/Disk

 1      Add or initialize one or more disks
 2      Encapsulate one or more disks
 3      Remove a disk
 4      Remove a disk for replacement
 5      Replace a failed or removed disk
 6      Mirror volumes on a disk
 7      Move volumes from a disk
 8      Enable access to (import) a disk group
 9      Remove access to (deport) a disk group
 10     Enable (online) a disk device
 11     Disable (offline) a disk device
 12     Mark a disk as a spare for a disk group
 13     Turn off the spare flag on a disk
 14     Unrelocate subdisks back to a disk
 15     Exclude a disk from hot-relocation use
 16     Make a disk available for hot-relocation use
 17     Prevent multipathing/Suppress devices from VxVM's view
 18     Allow multipathing/Unsuppress devices from VxVM's view
 19     List currently suppressed/non-multipathed devices
 20     Change the disk naming scheme
 21     Get the newly connected/zoned disks in VxVM view
 22     Change/Display the default disk layouts
 23     Mark a disk as allocator-reserved for a disk group
 24     Turn off the allocator-reserved flag on a disk
 list   List disk information

 ?      Display help about menu
 ??     Display help about the menuing system
 q      Exit from menus

Select an operation to perform: q

Goodbye.
root@mysrv1 #
root@mysrv1 #

By this we performed veritas encapsulation on our rootdisk....A reboot is needed to reflect these changes.

root@mysrv1 #
root@mysrv1 # reboot -- -v
login as: root
Using keyboard-interactive authentication.
Password:
Access denied
Using keyboard-interactive authentication.
Password:
Last login: Fri Aug 22 11:49:35 2014 from 10.20.10.50
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
You have new mail.
Sourcing //.profile-EIS.....
root@mysrv1 #
root@mysrv1 #

We successfully rebooted after encapsulating the rootdisk, now observe the changes.....

root@mysrv1 #
root@mysrv1 # df -kh
Filesystem             size   used  avail capacity  Mounted on
/dev/vx/dsk/bootdg/rootvol
                        30G    23G   6.3G    79%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                    29G   1.6M    29G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap2.so.1
                        30G    23G   6.3G    79%    /platform/sun4u-us3/lib/libc_psr.so.1
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap2.so.1
                        30G    23G   6.3G    79%    /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                    29G    40K    29G     1%    /tmp
swap                    29G    40K    29G     1%    /var/run
swap                    29G     0K    29G     0%    /dev/vx/dmp
swap                    29G     0K    29G     0%    /dev/vx/rdmp
root@mysrv1 #
root@mysrv1 #
root@mysrv1 # cat /etc/vfstab
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/vx/dsk/bootdg/swapvol      -       -       swap    -       no      -
/dev/vx/dsk/bootdg/rootvol      /dev/vx/rdsk/bootdg/rootvol     /       ufs     1       no      -
/devices        -       /devices        devfs   -       no      -
sharefs -       /etc/dfs/sharetab       sharefs -       no      -
ctfs    -       /system/contract        ctfs    -       no      -
objfs   -       /system/object  objfs   -       no      -
swap    -       /tmp    tmpfs   -       yes     -
#/dev/dsk/c1t0d0s1      -       -       swap    -       no      -
#NOTE: volume rootvol (/) encapsulated partition c1t0d0s0
#NOTE: volume swapvol (swap) encapsulated partition c1t0d0s1
root@mysrv1 #
root@mysrv1 # swap -l
swapfile             dev  swaplo blocks   free
/dev/vx/dsk/bootdg/swapvol 323,26000     16 33560432 33560432
root@mysrv1 #
root@mysrv1 #
root@mysrv1 # vxdg list
NAME         STATE           ID
rootdg       enabled              1408688804.6.mysrv1
root@mysrv1 #
root@mysrv1 #
root@mysrv1 # vxprint -ht
Disk group: rootdg

dg rootdg       default      default  26000    1408688804.6.mysrv1
dm rootdg01     c1t0d0s2     auto     81407    286617216 -

v  rootvol      -            ENABLED  ACTIVE   62928384 ROUND     -        root
pl rootvol-01   rootvol      ENABLED  ACTIVE   62928384 CONCAT    -        RW
sd rootdg01-B0  rootvol-01   rootdg01 286617215 1       0         c1t0d0   ENA
sd rootdg01-02  rootvol-01   rootdg01 0        62928383 1         c1t0d0   ENA

v  swapvol      -            ENABLED  ACTIVE   33560448 ROUND     -        swap
pl swapvol-01   swapvol      ENABLED  ACTIVE   33560448 CONCAT    -        RW
sd rootdg01-01  swapvol-01   rootdg01 62928383 33560448 0         c1t0d0   ENA
root@mysrv1 #

#############################################

Similarly if we want to achieve mirroring for rootvol, simply we need to add the 2nd disk to our diskgroup "rootdg".

# vxdisksetup -i c1t1d0 format=sliced
# vxdg -g rootdg adddisk rootmirror=c1t1d0

# vxdiskadm

...... output truncated ....

-----
-----
 4      Remove a disk for replacement
 5      Replace a failed or removed disk
 6      Mirror volumes on a disk
 7      Move volumes from a disk
-----
-----
Select an operation to perform: 6

Mirror volumes on a disk
Menu: VolumeManager/Disk/Mirror
  This operation can be used to mirror volumes on a disk.  These
  volumes can be be mirrored onto another disk or onto any
  available disk space.  Volumes will not be mirrored if they are
  already mirrored.  Also, volumes that are comprised of more than
  one subdisk will not be mirrored.

  Mirroring volumes from the boot disk will produce a disk that
  can be used as an alternate boot disk.

  At the prompt below, supply the name of the disk containing the
  volumes to be mirrored.

Enter disk name [,list,q,?] list

Enter disk name [,list,q,?] rootdisk

Enter destination disk [,list,q,?]  (default: any) rootmirror

Continue with operation? [y,n,q,?]  (default: y) y
VxVM vxmirror INFO V-5-2-22   Mirror volume swapvol ...
VxVM vxmirror INFO V-5-2-22   Mirror volume rootvol ...

  VxVM  INFO V-5-2-674 Mirroring of disk rootdisk is complete.

Mirror volumes on another disk? [y,n,q,?]  (default: n)n

root@mysrv1 #
root@mysrv1 #

#############################################

Now whenever we want to unencapsulate the disk, it is too simple and can achieved by a single command.

root@mysrv1 #
root@mysrv1 # vxunroot
  VxVM vxunroot NOTICE V-5-2-1564
This operation will convert the following file systems from
  volumes to regular partitions:

        rootvol swapvol
  VxVM vxunroot INFO V-5-2-2011
Replacing volumes in root disk to partitions will require a system
  reboot. If you choose to continue with this operation, system
  configuration will be updated to discontinue use of the volume
  manager for your root and swap devices.

Do you wish to do this now [y,n,q,?] (default: y)
  VxVM vxunroot INFO V-5-2-287 Restoring kernel configuration...
  VxVM vxunroot INFO V-5-2-78
A shutdown is now required to install the new kernel.
  You can choose to shutdown now, or you can shutdown later, at your
  convenience.

Do you wish to shutdown now [y,n,q,?] (default: n)
  VxVM vxunroot INFO V-5-2-258
Please shutdown before you perform any additional volume manager
  or disk reconfiguration.  To shutdown your system cd to / and type

        shutdown -g0 -y -i6

root@mysrv1 #
root@mysrv1 #
root@mysrv1 # reboot -- -v                        --------- Now just a reboot to reflect this....

login as: root
Using keyboard-interactive authentication.
Password:
Last login: Fri Aug 22 12:09:00 2014 from 10.20.10.50
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
You have new mail.
Sourcing //.profile-EIS.....
root@mysrv1 #

We unencapsulated our rootdisk and so we brought our rootdisk back to c#t#d# format.

root@mysrv1 #
root@mysrv1 # df -kh
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t0d0s0       30G    23G   6.2G    79%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                    29G   1.7M    29G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap2.so.1
                        30G    23G   6.2G    79%    /platform/sun4u-us3/lib/libc_psr.so.1
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap2.so.1
                        30G    23G   6.2G    79%    /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                    29G    32K    29G     1%    /tmp
swap                    29G    40K    29G     1%    /var/run
swap                    29G     0K    29G     0%    /dev/vx/dmp
swap                    29G     0K    29G     0%    /dev/vx/rdmp
root@mysrv1 #
root@mysrv1 # vxdg list               -------- DG will be destroyed automatically
NAME         STATE           ID
root@mysrv1 #
root@mysrv1 # swap -l
swapfile             dev  swaplo blocks   free
/dev/dsk/c1t0d0s1   118,9      16 33560432 33560432
root@mysrv1 #

No need edit the entries in vfstab manually...
Changes will be reflected in /etc/vfstab file automatically....

root@mysrv1 # cat /etc/vfstab
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c1t0d0s1       -       -       swap    -       no      -
/dev/dsk/c1t0d0s0       /dev/rdsk/c1t0d0s0      /       ufs     1       no      -
/devices        -       /devices        devfs   -       no      -
sharefs -       /etc/dfs/sharetab       sharefs -       no      -
ctfs    -       /system/contract        ctfs    -       no      -
objfs   -       /system/object  objfs   -       no      -
swap    -       /tmp    tmpfs   -       yes     -
#/dev/dsk/c1t0d0s1      -       -       swap    -       no      -
root@mysrv1 #

################################################################################