Sunday, 13 January 2013

Lesson - 5 Device Management

Device Terminology
    No of hardware and software devices must interact correctly for the device to function properly.
  1. Physical devices
  2. Ports
  3. Device Drivers
  4. To put a defined device to available
  5. Logical devices (/dev)
Note: Some of the logical devices are accessed only ODM cannot accessed by users

Types of devices
         1.  Primary Devices (RAM,CPU and Motherboard)
         2. Secondary Devices
             Hard disk, floppy disk, tape drive, printers , physical adapters, error special files, null special files etc.,
             a) Block devices: This is the structured random device. Buffering is used to provide a block-at-a-time method of access. This is usually a disk file systems
             b) Character devices: This is the sequential, stream oriented device which does not use buffering
        3. Base devices : Keyboard, Mouse
Examples of block devices
Following are examples of block devices:
cd0                        CD-ROM
fd0, fd0l, fd0h       Diskette
hd1, lv00               Logical volume
hdisk0                   Physical volume
Examples of character (raw) devices
       Following are examples of character (raw) devices:
console, lft, tty0       Terminal
lp0                            Printer
rmt0                         Tape drive
tok0, ent0                 Adapter
kmem, mem, null      Memory
rfd0, rfd0l, rfd0h       Diskette
rhd1, rlv00                Logical volume
rhdisk0                      Physical volume

Note: Most of the block devices have equivalent character device , For ex, /dev/hd1 provides buffered access to a logical volume whereas /dev/rhd1 provides raw access to the same logical volume. (The raw devices are ususally accessed by the kernel)

Major and Minor Number
maj,min dev nums
brw------- 1 root system 32,8192 Nov 03 14:19 hdisk3
brw------- 1 root system 32,8194 Nov 03 14:19 hdisk4
brw------- 1 root system 32,8195 Nov 07 07:08 hdisk5

Major no is 32 and minor no is 8192,8194 ...
Major no refers to the s/w section of code in the kernel which handles that type of device(hard disk). and minor no to the particular device of that type.

Device Configuration Database
     The predefined and customized databases store information of all the logical devices in the system and their attributes. It is managed by ODM.

Predefined Database (PdDv) List all the Supported Devices
  • Contains all the possible devices supported by the system.s
  • Devices in Undefined state
  • Output contains column like
Class - what the device does
Type - what model
subclass – Where it is attached
 Using “lsdev -P” command can list the devices supported by the system
Customized Database (CuDv) – List Defined Devices
  • List the actual devices used (configured) by the system.
  • Displays name,status, Location and description.
  • lsdev -CH” provides information about the Customized devices.
    The status column contain 2 states
            Available – Device ready to use
            Defined -- Device is unavailable

     Note: Devices may appear in the Defined state after restart the server, the reason is either the corresponding device is powered off or removed from the server.
    • Devices with location code are physical devices. Devices without location codes are logical devices. Location codes depend on type of device and the adapter to which the device is connected.
    • lsattr -E -l <resource-name> command provides detailed effective attributes of currently configured devices.
    • lscfg -v” - important Customized database command in which displays complete information about the device in ODM. display vital product data (VPD) such as part no, serial nos, Model architecutre, FRU, part number etc., for all the devices present on the system                            

    Device Status
           The most common devices states are as follows.
           1. Undefined
           The device is supported device but not configured. Devices reside in the Predefined Database not customized database.
          2. Defined
          The device is configured but unavailable to use. Devices reside in Customized databases
    are in defined state.
         3. Available
         The device is available and ready to use.
    Configuring Devices
         1. “cfgmgr” configure all self-configuring devices.
         2. While configuring the devices, cfgmgr checks whether the device is support on your AIX system by checking the PdDv.
        3. Once the information is found in PD DB, it uses complete information to complete entries into the customized devices database CuDv.
         4. It also loads the appropriate device driver into the AIX kernel and makes the logical devices under /dev directory.
         5. Finally makes the device to available state (ODM).

    The above 3 &4 steps are performed by mkdev command

    Changing Device State
    i. To put a defined device to available
            #mkdev -l <dev>
     ex.,#mkdev -l hdisk1
    ii. To put a available device to defined
            #rmdev -l <device>
     ex.,#rmdev -l hdisk1
    iii. To permanently remove from ODM. 
            #rmdev -dl <device>
      ex.,#rmdev -dl hdisk1
                                                                                                                
    Device Addressing
    • Location codes are used for device addressing
    • Where exactly the device is connected to your m/c.
    • Location code is made up of 4 fields of information. Useful in troubleshooting scenarios, referred on LED hardware troubleshooting.
    • Devices which are having location code are physical deviecs, not having location code are called logical devices.
    • Location codes depend on the type of the device and adapter to which it connects.
    • Location code is another way of identifying Physical device.
    Format for ex;
    AB-CD-EF-GH for non SCSI/PCI devices
    AB-CD-EF-G,H for SCSI devices

    Commands for displaying Location codes are as follows
             #lsdev -Cc adapter
             #lscfg -vl <name of device>
              “lscfg” list the vital product data including h/w serial no.type, model and part numbers.
    Important Commands
    1. lsdev --> List all the devices (Predefined and Customized)
    2. lsattr --> List attributes of the devices
    3. lscfg --> List the VPD information of the configured (customized) devices
    Options  for Device Commands
    LSDEV
    -P --> Predefined devices
    -C --> Customized devices
    -c --> Class type
    -H --> Header information
    -l --> Specify logical device name
    -p --> child devices of parent deviecs
    -F --> parent device of particular child device (use “lsparent -Cl hdisk0)


    LSATTR
    -E --> Effective attributes of the devices
    -l --> Specify the logical device name

    RMDEV
    -l --> logical device name
    -d --> completely removes from ODM.
    -SR --> removes all child devices from the parent device.

    LSCFG
    #lscfg -vp --> all h/w information
    #lscfg -vl --> for particular logical device


    Friday, 7 December 2012

    Solaris Live Upgrade Procedure for Patching

          Normally  CPU cluster patching for Solaris OS have taken an hour to complete, it increase the maintenance downtime window. In order to overcome that Solaris having the feature called  "LIVE UPGRADE" .
             The main advantages of Live upgrade is minimizing the downtime and providing the system admin to revert the original OS in case of any patching failure.
           In general, the Live Upgrade is briefly categorized as follows
    • Create a new boot environment if you haven't already.
    • Patch the new boot environment.
    • Boot from the new boot environment.
    • Check your results for the changes and see if they are acceptable 

    Following are the steps to perform Solaris Live Upgrade for Patching

    Step 1: Verify Live Upgrade packages are installed
               #pkgchk -v SUNWlucfg SUNWlur SUNWluu

    Step 2: Create a current & new boot environment within the same root pool (rpool)
                    #lucreate -c BE_APP01  -n new new_BE_APP01

    Step 3: Verify step 2
               #zfs list 
              #lustatus

    Step 4: Apply CPU onto the new boot environment 
               #cd 10_Recommend
               #./installpatchset -B new_BE_APP01 --s10patchset

    Step 5: Activate the new boot environment
               #luactivate -s new_BE_APP01

    Step 6: Reboot the server to boot to the new boot environment
               #shutdown -i 6 -g 0 -y

       Note: Do NOT use any other commands to reboot the server. you must use the above-mentioned command. Be patient, wait at least 5-10mins. if it still does not reboot, kindly type the command "reboot"

    Step 7: Verify the status
               #lustatus 

    Post Live Upgrade Procedures
    • If there are no problems, you can delete the former boot environment to  save disk space by issuing the comman
              #ludelete BE_APP01  
    • For furture patching, you only need to create a new boot environment within the same root pool (rpool), by issuing the command.
             #lucreate -n BE_APP01_yyyymmdd  

    Netbackup Important Terminologies -- Part 2

    Major Daemons Running in Master/Media/Client

    Master - 4 Daemons
               i) bprd       --  request daemon started during the system.
              ii) bpsched  -- schedule daemon
             iii) bpdbm    -- database manager started by bpsched
             iv) bpjobd    -- Job monitor daemon started by bpdbm
                       
                   bprd --> bpsched --> bpdbm --> bpjobd

     Media - 9 Daemons 
              i) bpcd   -- Backup Client (Since media itself is a client)
             ii) bpbrm -- Backup and restore daemon
            iii) bpdm  -- Backup disk manager
            iv) bptm   -- Backup tape manager
             v) ltid     -- Media manager daemon started during the system boot
            vi) avrd    -- Automatic Volume Recognition daemon
           vii) vmd    -- Volume Manager daemon 
          viii) tldd     -- robotic tape library daemon
            ix) tldcd   -- robotic tape library controller daemon

    Client - 2 daemons  
            i) bpcd -- NB client daemon
           ii) bpbkar -- Daemon used to take backup images.

    How Netbackup process works?
            There are 7 steps involve in NB
        
         In Master Server 

                 bprd --> bpsched --> bpdbm --> bpjobd
     
            Step 1:
                 *  When the daemon starts "bprd" on the master server start "bpsched" 
           Step 2:
                 *  "bpsched"  calls bpdbm to check the policy for auto backup schedules 
                      "bpsched"  calls the child process to handle the backup
                   "bpdbm"  calls the bpjobd to communicate with job catalog. 
             Step 3:
               "bpsched" child contacts the media server to start the bpcd
         
         In Media Server
           
                 bpcd --> bpbrm --> bptm 
          
          Step 4: 
               * “bpcd” invokes  bpbrm
               * “bpbrm”  starts “bptm”  which requests a tape mount and spans a child process to communicate  with client. 
               * Vmd (Volume Manager Daemon) - manages the Volume catalog and handles media requests through out the course of the backup job.
               * “bpbrm”  contacts the client to start the “bpcd” in client. 
                
        In Client 
            Step 5:  "bpcd"  in the client starts the "bpbkar"
            Step 6:  "bpbkar" reads data from client
                 * Communicates directly with "bpbrm" to send catalog meta data which is ultimately written to images catalog. 
                 * Send the backup data stream to the "child bptm" process
           Step 7: 
                 * The child bptm processes passes the data to the "parent bptm"
    process which writes the data directly to the destination data.
                    
    What is Volume Group and Volume Pool?

    Volume Pool
    • Is nothing but the “grouping of tape”. 
    • Meant  Volume/media/catridge/tape.
    • It is a Logical Set of Tape media/Volume.
    • If we want to use the newly introduced tape and to write to the data, it should be under one of the “volume pool” 
        We can we the Volume pools by the following ways. 
             In GUI,  Media and Device Management --> Media --> Volume Pools
             In CLI, #vmpool -list_all -bx
     
      root@MasterServer# vmpool -list_all -bx
      pool                    index   max partially full   description
      ----------------------------------------------------------------------------------
      None                     0         0                the None pool
      NetBackup              1         0                the NetBackup pool
      DataStore               2         0                the DataStore pool
      CatalogBackup        3         0                NetBackup Catalog Backup pool
      SCRATCH_pool        4         0                for scratch media
      APPSERVER_LOGS    5         1                APP server logs
      DATABASE_LOGS     6         3                Database full
      WEBSERVER_FULL    7         1                Web server full

    Volume Group
    • Is a Physical location  for a media. 
    • Manages a group of tape for purpose of admin actions that allows movement of tapes from slots to drive and vice versa.
    • All volumes in the VG should be the same media type. (HCART,DLT)
    • All volumes in a robotic library must belong to a volume group. You cannot add volumes to a robotic library without specifying a group.
    • We can view the Volume groups in 2 ways.
          i) In GUI, Media and Device management --> Media --> Volume Groups
          ii)In CLI, #vmquery -a |grep "media ID:"
       root@SS73VPBK01 # vmquery -a |grep "media ID:"
       media ID:              CLNU01
       media ID:              PL5001
       media ID:              PL5002
       media ID:              PL5003
       media ID:              PL5004
      
    What are the Default Volume Pools?
         There are 4 volume pools created by default
           i) Netbackup --> new tapes are go to this pool after inventory
          ii) None (for cleaning tapes)
          iii) Datastore
          iv) Catalog backup

    What is Scratch Pool ?
         Scratch pool is the manually created volume pool and following are the procedures of scratch pool 
         i) Expired Tapes (volumes) are automatically moved to scratch pool by netbackup.
        ii) If some other pools used for taking backup doesn't have any tapes available, it will take empty tapes from here.

    What is Multistreaming and Multiplexing?

    Multistreaming 
            i) Sends data from single client to multiple data drives. Normally used in high bandwidth environment.
          ii) Backups can be divided into streams. Different jobs in different tape.
         iii) Taken place in software level. 

    Multiplexing
          i) Send different  jobs/data into a single tape. Schedule level backup
         ii) It is very fast especially for small environment. 
        iii) Taken place in hardware level.