Saturday, 30 July 2011

6. Swap Management ( Real Time)


6. Swap management

Issue 1: the server went down or hangs.
A: go to console, check the error messages, and reboot

Issue 2: why the server slower down?
A:
  1. # vmstat
It checks the page in & page out size.
Page in should be more size than page out.
If page out size is more, then it means page out didn’t release memory to swap.
Then
# ps –ef | grep 1255
If root
# kill -9 1255
# kill –HUP 1255 (HUP for refresh)
Note: In root mostly java or oracle process runs, so kill that.

Note : if other applications inform them

# top (or) # prstat –a
It shows max memory occupied application. Then submit/inform report to the desired applications. Mostly /oracle, /java applications
If it is ‘root’ issue then delete the old files & compress the unuse files

To display volume table of content (vtoc)
# prtvtoc /dev/rdsk/c0d0s2

To display only CPU utilization:
# prstat –s CPU –n 10

5. CPU Management (Real Time)


5. CPU management

Show process of CPU, memory, and swap utilization
#top
Or
#prstat -a

Note: only ‘root’ issues we take care & other applications issues we will transfer /inform to them only.
(# ftp <file name>: sending to oracle/other applications)

To display volume table of content (vtoc)
# prtvtoc /dev/rdsk/c0d0s2

To display only CPU utilization:
# prstat –s CPU –n 10

4. User Management ( Real Time)


4. User Management

# id      (find out the user id information)
# dispuid        
# dispgid
# logins
# cat /etc/default/fs
Local = ufs
#listusers         (show no.of users)

Note: for user, there should be ‘home directory’.



Issues in user management:
ü  User permission
ü  User home directory missing
ü  Change the ownership (chown)
ü  Assign the permission (chmod)
ü  User missing in shadow file (pwconv)

User environment variable:
  1. local.cshrc
  2. local.login
  3. local.profile
All file exists in /etc/skel file

# logins –l raj

How to assign groupid to user?
# groupadd unix
#usermod –g unix raj  (-g : primary group name)
# logins –l raj
#id –a raj
# usermod –G dba,dwh raj

Note: if not specifying anything to create user, it means it stored in /home

To find defadduser:
# find / -name defadduser  -print

# login –xl pra

$ ls –ltr
raj
$exit

Changing the owner ship: before it was raj, now I am changing as root
#chown root:other /sai/raj/aa

# ls –l /sai/raj/aa
#chown root:dba /sai/raj/aa
# groups
# dispgid
# cat /etc/group
Sol:143:-----     (3rd one,if secondary group (-G) only it shows)

‘#userdel’ is a command to del the user but it cant delete the user home directories
#userdel –r:     command delete the home directory

To change the user name;
#usermod –l  roja raj




To change the group name:
#groupmod –n java sol

# man groupadd
# groupadd  ---

Above two, it show the options

#lf –F
#useradd –D (if it fire then only defadduser updates)
#cat /usr/sadm/defadduser

Issue1:
User entry missing in shadow
A: sync from passwd to shadow (pwconv)
# pwconv

Note: we can not sync from shadow to password.

Issue 2:
Password break
A: go to filesafe mode
# cd /a
#vi etc/shadow
    root/x/                 (remove 2nd part i.e  x)

in system1:
# dtrace           /it trace all the system calls

In system2:
# rm     // rm commands not working
Now in system 1 it shows error message, it trace why ‘rm’ not working

#passwd –n 2 –w 3 –x 10 raj

User id creation: LDAP – secure – advance of NIS+
Configuration: implementation team take care

Note :
  1. Once ticket comes for production server till 5 days no need to do anything.
  2. Application & DBA both should be shutdown for rebooting the server

Issue 3: home directory missing

# useradd –u 144 –g dba –d /sai/ram –m ram
# usermod –d /opt/ram –m ram           (b4 ram was in sai)
# cd /opt
# ls
ram (now in /opt from /sai, in /sai not there)



issue 4: chage the ownership

# ls –ld /opt/ram
I want to change the owner ship from ram to raj
#ls –ltr
Ram dba
I want raj to access ram
#chown raj:dba /opt/ram/aa

#ls –ld /opt/ram/aa

Issue 5: only one user not loging in
ü  Check the permissions
ü  Check out the password, user
ü  Check password status, grep | username

Issue 6: one user not accessing other file
ü  Check user permissions
ü  File level permissions
Note: its not day to day activity depends on requirement

Issue 7:not a single user login to server
Then it is a server problem


Issue 8: if shadow file missing
A: sync
#pwconv

Issue 9: if passwd/opasswd file missing
A: Reconstruct

3. SMF (Service Managment Facility) - Real Time


3. SMF (Service Management Facility)

SMF:
ü  It is a advanced feature in Solaris10
ü  Which will control services under SMF
ü  We can start and stop the services

-          All the services stored in ‘/etc/init.d’
-          We can’t  stop services dependency/ dependent
#svcs               (display online & offline and legacy)
#svcs –a           (display online, offline, and disable)
#svcs |more

How to find out dependency?
#svcs –d svc:/network/nfs/server:default

How to find out dependent?
#svcs –D svc:/network/nfs/server:default

Note: if any one of these services in disable then NFS will not get into online



Issue 1: service (NFS) is in disable, but it is not getting ‘online’ why?
A: check out the dependency & dependent and make it online. Then make the service online. If it is in maintenance mode means configuration problem.  Configuration problem means implementation team take care.

Issue 2: why the service group not running? What is the reason?
#svcs –xv svc:/network/rpc/keyserv: default
Same above reason find out dependency and dependent, if any in disable mode make it online.

Issue 3: If service group lost
# cd /etc/svc
Repository.db

Service ‘repository.db’ file store in /etc/svc

Restoring ‘repository.db’
# cd /lib/svc/bin
# ./restore_repository              (execute)

To see execute or text
# file restore_repository
# cd /var/svc/profile

All SMF scripts are store under /var/svc/profile

Service categories:

#cd manifest
#ls
  1. Application
  2. milestone –runlevel information
  3. platform
  4. system
  5. device
  6. network
  7. site

2. Booting Procedure (Real Time)


2. Boot Procedure

1. Boot prom:
ü  Prom runs the POST
ü  Search for the bootable devices
ü  Read the boot block
ü  Load the boot block

2. Boot program:
ü  Load the ufs boot block
ü  Try to load the secondary boot block
ü  If boot block corrupted
 # cd /usr/platform/’uname –i ‘/lib/fs/ufs

3. Kernel :
ü  Read the etc/system file, where etc/sytem has total kernel information
ü  It initializes all the modules itself

4. Init :
ü  Read  the etc/init file
ü  Total run level information]
ü  Svcstatd deamons runs

Issue 1: If boot block corrupted what you do?
A: run the following command and restore boot
 # cd /usr/platform/’uname –i ‘/lib/fs/ufs

1. File System Management (Real Time)


1. File System Management

File System issues are not a regular task.
Basic commands:

# uname –a                              To display the OS name, version, kernel version
# isainfo –b                             Display the kernel bit
# format                                  To find the available disk
# newfs –N                             Display the super block & primary block
Last + found                           consist of inode, data block information
# ls –s *                                   List all the details of files & directories
                                                (for touch 0Mb, for cat 2 blocks)

Q: How to check which file occupying more memory in File system?
A:
# cd /sai                       /sai is the mount point
# du –sh * | sort –nr                // displays the files occupying more memory

Q: Can we increase the file system in Solaris?
A: Generally we cannot increase the File System, but we can increase the File system if continuous cylinders available.

# growfs –M /sai /dev/rdsk/c0d0s6
# df –h /sai

Q: Can we decrease the File System?
A: No way, not possible

Note: to over come this problem SVM (Solaris Volume Manager) use.

How many are using the File System?
# cd /sai
# fuser –u /sai                          // to display how many users using File System

To check the minfree:
#fstyp –v /dev/rdsk/c0d0s0 | grep –i minfree

We can write the script for repeated loop of status:

# while true
> do
> fstyp –v /dev/rdsk/c0d0s0 |grep –i  minfree
> done


To increase the minfree:
# tunefs –m 20 /dev/rdsk/c0d0s0
To decrease the minfree:
# tunefs –m 10 /dev/rdsk/c0d0s0



Issue 1:
If file system exceeds the threshold value then ticket will generate automatically.

A:To resolve this
Check out more size files in File System
Compress the files or delete the old files, if it is so important consult the clients then delete.


Copy /keep the data:
# cp –r /usr/* .

To see old files;
# ls –ltr

To gip:
# gzip aa

To unzip:
# gunzip aa.gz

*** To find top 10 files occupied more size:
# find . –xdev –type f –ls | sort –nr +6|head -10

*** To find top 20 files occupied more size:
# find . –xdev –type f –ls | sort –nr +6|head -20

To move the data:
# mv /etc/aa /opt               move /aa to /opt

Issue 2:
If inodes are corrupted (some times file system also will not work)
A: To resolve:
I will ask the backup team to take backup of file system, & restore it freshly.

Issue 3:
Suppose my File System is 2 GB, its usage is 1GB, but it is showing 100%. Actually it has to show 50%.
A:To resolve:
Simply I unmount & mount the filesystem
Or
If it is not release the space, I will reboot. Then it will show 50%.

Issue 4:
User can not accessing the file system
A: To resolve:
Check out the file permissions, and give the proper permissions to that file.

# mount: mount file system from mnttab
# mountall: mount all file system from vfstab