Friday, 10 April 2015

Administrating boot environments in Solaris11 with beadm



          Administrating boot environments in Solaris 11 is almost same as Solaris 10’s Live upgrade. In Solaris 10,we will use lu commands like lucreate,l uactivate, lumount, luumount and lustatus. But in Solaris 11, all the tasks will be carried out using beadm command. 

         Here we will perform simple operations to understand beadm in Solaris11. First thing is to create a new boot environment and add one sample package to that environment. Then activate the new BE and verify whether the sample package is installed or not. After that bring the system back to old boot environment by activating the old BE.


1. List out the current boot environments. In active column, NR stands for active Now(N) and active on Reboot(R). And also you can see there is no snapshot exist on the system

root@netra-t5440:/# date
Thu Apr  9 06:08:10 PDT 2015

root@netra-t5440:/# beadm list
BE      Active Mountpoint Space Policy Created          
--      ------ ---------- ----- ------ -------          
solaris NR     /          2.63G static 2015-01-08 11:58 

root@netra-t5440:/# zfs list |grep @
root@netra-t5440:/# 

2. Clone the current BE to new BE called BE_NEW. Here unlike solaris10, snapshots are kept in the background. So you can see only new BE’s datasets. The datasets name with BE_NEW belongs to new boot environment.

root@netra-t5440:/# beadm create BE_NEW

root@netra-t5440:/# beadm list
BE      Active Mountpoint Space Policy Created          
--      ------ ---------- ----- ------ -------          
BE_NEW  -      -          81.0K static 2015-04-09 06:29 
solaris NR     /          2.63G static 2015-01-08 11:58 

root@netra-t5440:/# beadm list -a BE_NEW
BE/Dataset/Snapshot      Active Mountpoint Space Policy Created          
-------------------      ------ ---------- ----- ------ -------          
BE_NEW
   rpool/ROOT/BE_NEW     -      -          80.0K static 2015-04-09 06:29 
   rpool/ROOT/BE_NEW/var -      -          1.0K  static 2015-04-09 06:29 

3. Mount the new boot environment.

root@netra-t5440:/# mkdir /BE_NEW

root@netra-t5440:/# beadm mount BE_NEW /BE_NEW

root@netra-t5440:/# df -h /BE_NEW
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/ROOT/BE_NEW      134G   2.3G        94G     3%    /BE_NEW

root@netra-t5440:/# beadm list
BE      Active Mountpoint Space Policy Created          
--      ------ ---------- ----- ------ -------          
BE_NEW  -      /BE_NEW    81.0K static 2015-04-09 06:29 
solaris NR     /          2.63G static 2015-01-08 11:58 

4.Now we will install new package on BE_NEW.

root@netra-t5440:/# pkg -R /BE_NEW verify -v samba
pkg verify: no packages matching 'samba' installed

root@netra-t5440:/# pkg -R /BE_NEW install -v samba
           Packages to install:        12
            Services to change:         1
     Estimated space available:  93.96 GB
Estimated space to be consumed: 660.50 MB
          Rebuild boot archive:        No

Changed packages:
solaris
  library/desktop/gobject/gobject-introspection
    None -> 0.9.12,5.11-0.175.2.0.0.41.0:20140609T232030Z
  library/desktop/libglade
    None -> 2.6.4,5.11-0.175.2.0.0.35.0:20140317T124538Z
  .
  .
  .
  .
Services:
  restart_fmri:
    svc:/system/manifest-import:default

Editable files to change:
  Install:
    etc/dbus-1/system.d/avahi-dbus.conf
DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                              12/12     4240/4240  134.9/134.9  3.9M/s

PHASE                                          ITEMS
Installing new actions                     5005/5005
Updating package state database                 Done 
Updating package cache                           0/0 
Updating image state                            Done 
Creating fast lookup database                   Done 
Updating package cache                           2/2 
root@netra-t5440:/# 

Note:You need to configure IPS to install new packages.

5.Verify the package on BE_NEW

root@netra-t5440:/# pkg -R /BE_NEW verify -v samba
PACKAGE                                                                 STATUS
pkg://solaris/service/network/samba                                         OK

root@netra-t5440:/# pkg -R /BE_NEW list -v samba
FMRI                                                                         IFO
pkg://solaris/service/network/samba@3.6.23,5.11-0.175.2.0.0.42.1:20140623T021406Z i-- 

6.Activate the BE_NEW.

root@netra-t5440:/# beadm activate BE_NEW

root@netra-t5440:/# beadm list
BE      Active Mountpoint Space  Policy Created          
--      ------ ---------- -----  ------ -------          
BE_NEW  R      /BE_NEW    3.12G  static 2015-04-09 06:29 
solaris N      /          229.0K static 2015-01-08 11:58 

7.Reboot the system to boot the system from BE_NEW.

root@netra-t5440:/# init 6

8.Verify whether system is boot from BE_NEW.

root@netra-t5440:~# beadm list
BE      Active Mountpoint Space  Policy Created          
--      ------ ---------- -----  ------ -------          
BE_NEW  NR     /          3.36G  static 2015-04-09 06:29 
solaris -      -          87.24M static 2015-01-08 11:58 

Note:Look at the Active column to confirm BE state. N- Active Now; R- Active on Reboot;

9.Verify the installed packages are available in current boot environment.

root@netra-t5440:~# pkg list samba
NAME (PUBLISHER)                                  VERSION                    IFO
service/network/samba                             3.6.23-0.175.2.0.0.42.1    i--

10.You can also do the verification on OLD-BE, whether the package is available there are not.

root@netra-t5440:~# mkdir /Old_BE
root@netra-t5440:~# beadm mount solaris /Old_BE
root@netra-t5440:~# pkg -R /Old_BE list samba
pkg list: No packages matching 'samba' installed


Rollback operation
============
1.Any time you can rollback the Solaris 11 to old boot environment using below command.

root@netra-t5440:~# beadm activate solaris

root@netra-t5440:~# beadm list
BE      Active Mountpoint Space   Policy Created          
--      ------ ---------- -----   ------ -------          
BE_NEW  N      /          678.50M static 2015-04-09 06:29 
solaris R      /Old_BE    2.72G   static 2015-01-08 11:58 

N- Active now
R- Active upon Reboot

2.Reboot the server using “init 6″ .

root@netra-t5440:~# init 6

3.Now you won't see the new package on the system.

root@netra-t5440:~# beadm list
BE      Active Mountpoint Space   Policy Created          
--      ------ ---------- -----   ------ -------          
BE_NEW  -      -          686.82M static 2015-04-09 06:29 
solaris NR     /          2.79G   static 2015-01-08 11:58 

root@netra-t5440:~# pkg list samba
pkg list: No packages matching 'samba' installed


Thus you can manage the boot environments for Solaris 11 for package/patch bundle installation.

No comments:

Post a Comment