Batch24 - Azure Rescue Mode-Interview Questions-08-Oct-2021
Batch24 - Azure Rescue Mode-Interview Questions-08-Oct-2021
snow + nagios
7 to 8:30 class
8:30 to 9 AM doubts and practical issues
9 hours workings
2 class + 5 practice = 7
7 thousadnd
30 + 35 + 40 + 42 + 50 + 55 + 70 + 90 + 1 lakh
7 to 8 years
requirements:
laptop or desktop (4 GB RAM + min 200 GB disk + any processor)
1.5 gb data for your mobile
don't:
don't join from mobile
disable notification between 7 to 9 AM
don't miss my class because no backup classes
10 Days demo
Linux administration
cloud administrator
your fit for devops
*
***
What is OS?
what is os?
os is a mediator between end user and hardware.
os is a interpreter between end user and hardware.
redhat
centos ==> No support in case if you face any problem. (free and no support)
rhel ==> you can get support from redhat company in case if your facing any
problem at OS level. (free and no support) and os with support.
os is nothing code. unix and linux code is open for everyone . you can modify
OS if your strong in coding.
windows is not opensource.
AIX is not Open source
develop
administration <===============
redhat linux 7
45 topics
what is server?
difference between desktop(laptop) and server?
critical components of computer:
1. processor
2. RAM
3. HDD
4. Network
Laptop/Desktop server
1. RAM 2 slots 4 *2 =8 8 * 2= 16 GB 1. RAM 27 * 32 GB
can possible 27 * 64 or 27 * 128 =
2. processor 1 2. 2 min
3. HDD max 4 3. min 2 slots max depends
server model
4. Network max 2 4. Min 2 max depends on
server model
5. No remote console 5. remote console board will
exist by default.
6. No HBA card 6. HBA card will be there
7. single power supply 7. min 3 power supplies ( 1
direct power 2 generator 3 battery)
eg: physical server in US but from india i can poweroff and poweron, install
OS, reinstall OS .
can possible with console board.
console board is a extra hardware component which will be installed only for
servers.
by default hardware(dell,HP,LENOVO) will provide console board option only for
servers.
DELL = IDRAC
HP = ILO
Physical = OLD
virtaul = OLD this and cloud
cloud vm = running trend build servers in azure.
tomorrow
1. platforms (PM,vm, cloud vm)
2. DC. what is DC?
Platforms
1. Physical platform (physical server)
2. virtual platform (virtual server)
3. cloud platform (cloud virtual server)
DC = Data center
this is the safe area to maintain servers.
centralized AC system( temp 6 or 7) there will be alarm system in case
room temp cross >7%.
servers will generate so much heat. who will make cool down the
server? AC(temp). below of processor there will be a fan(cooler).
access control to RACK or servers
multiple power supplies for servers
multiple internet connections
Physical platform:
Install operating on physical box.
physical server ==> OS ==> Hand over to applicaton ==> application team will
setup application
250 GB RAM
requirement is 120 machines with 2 GB. is it possible to launch all 120 servers in
1 pm? Yes each machine 2 GB RAM
do you feel is there any resource wastage in virtual platform? no
vmware team : esxi installation , vcentre configuration and virtual creation
OS : install OS and support to application or db team
if your able to spend min 4 hours per day then only continue
topic1 day1
topic 2 day2 (topic 1 and topic 2)
topic 3 day3 (topic 1,topic2 and topic3)
unix is a OS.
plan
develop
release 1969
1. Application Layer (OS)
2. Shell layer (OS)
3. kernel layer (OS)
4. Hardware layer(Hardware)
1. application layer: this is the layer will interact with end user for input.
which is the layer interacts with end user to give input that layer called as
application.
2. shell: is a mediator between application layer and kernel. It contains
predefined programs.
shell will validate application layer input(command). is command is
validate or not.
ls is right command now shell will validate and pass this command to
kernel
llll is wrong command now shell will not pass this task to kernel
prasad is wrong command, shell can't understand what is prasad. shell
will block the task.
ls is nothing but program or code. shell will verify ls command code.
total 500
1. sh (480 programs) one command is working
2. bash (490 programs) same command is working
3. dash (300 programs) same command is working
4. csh (350 programs) not working
5. tcsh (400 programs) not working
6. nologin (50 programs) not working
ksh
4. HW
processor : worker who is going to execute your task or process
harddisk : please play song
speakers : give sound
13 directories
/
pwd
cd /
ls
cd : change directory
ls : list out current folder data
file management
creating file & modify content in side file
1. Cat
2. vi
3. touch
To create file
syn: cat > <filename>
cat > file2
*************
*************
ctrl + d
vi
virtual interface
:w : is save file
:wq : is for save the changes and quit from file
:wq! : is for save the changes and quit forcefully
:q : is for come out from file without save changes
2 note books
1 running notes
2 interview question
*
**
***
cat completed
vi completed
touch
pwd : print working directory . it prints the pathe currently where we are
ls : list out current folder files and directories
cd : change directory eg : cd /etc or cd /var
blue = directories
black = files
touch command is for update current date and time stamp for file
touch command we can use for 2 purposes
1. to update current date and time to existing file
2. in case file is not there touch creates the empty file
in case file not exist then touch creates the empty file.
script will pick and copy to other location what are files newly created
out of 100 files 90 files are yesterday files is script will process
those files?
no
logic in program is pick only recent files with 5 min created files
touch file{1..100}
Folder or directory
create
mkdir testdir
make directory
mkdir testdir1 testdir2 testdir3
mkdir tdir{1..50}
to create 50 empty directories
cp
mv
rm
files
sync : cp <sourcefilename> <destination>
-r
cp -r <source directorypath> <destination>
. = current pwd
.. = previous path
cp /root/file1 /mnt
cp -r /root/file1 /mnt ==> force copy
cp -r /root/dir1 /mnt ==> is for copy directory
rm(remove)
7, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 7.10
8, 8.1, 8.2, 8.3, 8.4,8.5, 8.6............................
8.10
redhat enterprize linux
rhel
cat /proc/meminfo
uname -a
flavaour of Unix
hostname
kernel version
os release date
arch
head <filename>
by default it prints 10 lines of the file from top.
tail <filename?
by default it prints 10 lines of the file from bottom
wc : word count
more and less commands are for print file output page by page.
there are 100 pages in one of the file, if we want to read page by page then we
can go with more / less commands in linux
more filename
less filename
search string can possible in both but less will highlight found string in black
color.
q or ctrl c
h help
ls -l | more
we can see the output in page by page
date
how to know the current date and time
date
date +"%d-%m-%Y"
time
date +"%T"
date
date +"%F"
cal
du -ks *
size in kilo bytes
* how to find out highst usage file or directory in particular location?
du -ks * | sort -r -n | head -1
-r reverse the numbers
0
1
2
3
4
without reverse
4
3
2
1
0
head -1 which one will print 4
ls -l
ls list out current folder files and directories
-a : all files and directories it includes hidden also
-l : long list
files
-rw-r--r-- 2 prasad unix 2049 01 may file22
dir
drwxr-xr-x 2 prasad unix 4096 02 may dir22
-
d field 1
rw-r-xr-x permissions == field 2
2 : hard link count (link count) ==> field 3
prasad = owner ===> filed 4
unix = group ====> field 5
2049 = size in bytes ===> field 6
01 may = file creation or modified date and time ===> field 7
file22 = name of file ====> field 8
field 1 :
- = file
d= directory
l = linked file or dirctory
b = Block device (hard disk, cd, floppy)
c = char device ( /dev/sda is sda is nothing first hard disk)
p = pipe (os related file)
s = socket (os related file)
* what is p at starting of file?
what is d at starting of line when you execute ls -l *
what is s?
r = read
w = wirte
x = executable
sashi, vinod, kishore
ls -l
long list
ls -ltr
l : long
sort with date and time = t
r = reverse output
t = sort with date and time
application appuser1
/apppart appuser1
Grep
grep is for search the string or word inside file or files in one depth of
location.
-w word search
-c count the string
-i ignore case sensitive
-n find string and find line numbers in case string found
-l : list out file names wherever string found (grep -wl prasad *)
-v : exclude particular string from output ( grep -wi prasad file2 | grep -v
PRASAD)
-B = print before some lines once string found
-A = print after some lines once string found
multiple words searching
grep -w "word1\|word2\|word3\|word4" /root/file2
* how to search multiple strings inside file
grep -w "word1\|word2\|word3\|word4" /root/file2
reboot
shutdown -r now
shutdown -r 5
shutdown -r 5 " rebooting server as per maintenance, server will reboot
in 5 min. Please close your things"
-r : reboot
init 6
reboot
inode: each and every file or directory will get one inode number which will
be assigned by kernel
* how to know inode of file? below 3 years
ls -i filename
or
stat filename
disk management
attach new disk
create partitions (c drive , d drive , e drive) in linux we will
call partitions.
disk
disk architecture
how to create partition in disk
100 sectors
file1 - 1 to 20 sectors and sector id will be maintained by journal
file2 - 21 to 40 sectors and sector id will be maintained by journal
journaling is nothing data about data. it maintains data about data. we are
storing data about that journal will maintain.
meta data:(journaling): meta data will store in each and every disk
first sector : MBR
in each and every disk first sector is reserved for meta data.
OS
how to list out connected disks?
lsblk
list block devices
sd = sata/scsi disk
sda
sdb
sdc
sdd
a = first disk
b = second disk
c = 3rd disk
d = 4th disk
sda --> sda1
--> sda2
--> sda3
--> sda4
a64 partitions
in each disk we can create max 64 partitions.
H/w ==> OS ==> collection programs ==> input with help of OS ==> task will be
carried to process with help of RAM ==> processor will execute task
write some data
login to linux box and refresh the channels to reflect new disk
echo " - - - " >> /sys/class/scsi_host/host0/scan
echo " - - - " >> /sys/class/scsi_host/host1/scan
echo " - - - " >> /sys/class/scsi_host/host2/scan
there is one space before and after -
wrong : echo "---"
correct : echo " - - - "
create partition
format partition with file system( diff between ext2, ext3, ext4
and xfs) journaling
mount
sda
sdb
sdz
sdaa
sdab
sdac
8 EB
rw- = owner
rw- = group members
--- = others
in each disk we can create 4 primary partition. in disk we can create 64 i said
starting. that is true 4 primary and 60 logical
primary : both are options which provided by os. primary is for store os file
or bootable files . primary i can use for both the purpose os and normal data
logical : is for store normal data. is logical will support os files or
bootable files ? no
primary (p)
extended(E)
/dev/sdc 100 GB
/dev/sdc1 p 5gb 1
/dev/sdc2 p 5 gb 2
/dev/sdc3 p 5 gb 3
/dev/sdc4 E 85gb extended we can't mount . inside extended
we will create logical partitions
/dev/sdc5 L 5
/dev/sdc6 L 6
/dev/sdc7 L
/dev/sdc8 L
/dev/sdc9 L 60 L + 3 P = 63
.
.
/dev/sdc64 L
xfs = xfs_repair command will arrange sectors properly with help of journaling or
metadata.
100 GB disk
/dev/sdb
sdb1 p 5
sdb2 p 5
sdb3 p 5
sdb4 e 85
60 logical partition
disk managment
1. basic ==>
2. LVM
3. RAID
attached disk ==> entered into disk ==> created partition ==> formated partition
any file system type ==> mounted partition for using purpose ==> permanent mount
echo " - - - " >> /sys/class/scsi_host/host0/scan
echo " - - - " >> /sys/class/scsi_host/host1/scan
echo " - - - " >> /sys/class/scsi_host/host2/scan
echo " - - - " >> /sys/class/scsi_host/host3/scan
/etc/fstab fields
6
1 2 3 4 5
6
<Device name> <mountpoint name> <Filesystemtype> <Defaultpermissions>
<Metadatabkp> <Filesystemcheckup>
partprobe /dev/sdh
mkfs.xfs /dev/sdh1
mkdir /java
mount /dev/sdh1 /java
defaults,ro
along with default permissions want to mount partition in read only
5th field(metadata backup)
1 = do meta data backup
0 = don't backup meta data
6th field
file system checkup(repair) or secotors arrangement
0/1/2
0 = don't do file system checkup(repair) while server coming up
1 = do file system check with first priority
2 = do file system check with second priority
Server administrator
inside server what will be there: app/db
vm ==> OS ==> APP/DB
vm and os installation
production ==> which is the environment generating revenue for company that
evironment we call it as production ( 5000) = US
DR ==> Replica of production = India (2500)
QA ==> US 3000 servers
DEV/LAB ==> 4000
user
group : no of users
properties of user
1. UID ( uniq id)
2. PGID ( primary group id)
3. SGID (Secondary Group id)
4. Home directory of user
5. Shell
1. UID ( uniq id) : for each and every user kernel has to allocate one uid.
0 - 65000
0 = root ( administrator)
1 to 99 = reserved for system accounts (operating system users). os is
running with help these users only(bin,lib,sys,)
100 - 999 = are reserved for applicaton/thirdparty users
1000 - 65000 = are for normal users
group: by default kernel will assign one group for each and every user . the group
name match to your username
uername is prasad
groupname is prasad
how to see the groups information?
cat /etc/group
cat /etc/passwd
shells (6)
/bin/bash
/bin/sh
/bin/dash
/bin/csh
/bin/tcsh
/bin/nologin
how to list out how many shells installed?
cat /etc/shells
by default kernel will allocate /bin/bash shell for all the users.
which is the default shell for users in linux?
/bin/bash
1. username
2. mask password redirecting to /etc/shadow. actually password will be in
/etc/shadow
3. UID
4. Primary group id
5. comment
6. home directory
7. shell
useradd user1
there will be user : user1
group name : user1
for user1 primary group is user1
useradd user2
there will be user : user2
group name : user2
for user2 primary group is user2
going to add user1 into user2 group
here for user1 secondary group is user2
going to add user1 into root group
for user1 secondary groups are root & user2.
--------------------------------- 25-
may-2021
useradd appuser1
passwd appuser1
by uid , gid, home directory and shell all the details considered
automatically.
creating user with specification.
-u : unique id
-G : secondary group
-d : home directory path
-m : make home directory
-c : comment
-s : shell for user
cat /etc/default/useradd
this is file which will feed missing information in useradd command.
passwd username
cat /etc/shadow
prasad:entryptedpassword:18772:0:99999:7:inactivedays:expairy days
1 2 3 4 5
6 7 8
Field 1 : username
Field 2 : entrypted password
Field 3 : Days counting from 1970 jan 1
Field 4 : minimum age of password
Field 5 : max age of password
Field 6 : warning days of password
Field 7 : account inactive days
Field 8 : account expairy days
Max password age = 90 after 90 days password will expaire . days will
count from password set
min password age = 2 user can't set password in 2 days from password
set days
warning password age = 7 83 day onward it start giving notification to
user
chage is a command
passwd using passwd we can change password properties
passwd -x 90 -n 3 -w 10 b24user10
chage -M 90 -m 3 -W 10 b24user10
passwd -S username
chage -l username
* how to change password and make sure user change password in next login
passwd username
chage -d 0 username
group administration
how to create group
how to modify group properties
adding users in group
deleting users from
to create group
groupadd linuxg
how to add user into group
gpasswd -a b24user linuxg
how to get the group information
grep linuxg /etc/group
lid -g linuxg
user information : id username
group information : lid -g groupname
how to modify group properties
groupid
groupmod -g 3000 linuxg
groupname
groupmod -n linuxgrp linuxg
new existing
awk
if $5 is nothing password max age is greater than >= 60 then print username
$1
how to change max password age to 50 days who are having greater than 50 max age?
task 1 : is for identify users which are having >= 50 max password age
awk -F: '{if ($5 >= 51) print $1}' /etc/shadow
task 2 : redirect listed users into one file
awk -F: '{if ($5 >= 51) print $1}' /etc/shadow > /tmp/users
task 3 : using loop we are going to set max password age to 50 for
/tmp/users
variable :
what is variable? variable is nothing but array which can used to store program or
value
in variable we can invoke program or any value
a=10
a is a variable in that value is 10
b=20
b is a variable in b we stored 20 value
p=prasad
p is a variable in that we stored prasad
how to call variable
$
echo $p
echo $a
echo $b
echo is for print something
===================================================28-05-
2021==========================
step 1 : download vmware workstation 12 pro & rhel 7.2 os.
step 2 : install vmware workstation 12 pro
activate vmware workstation using licence key which is there in whats
up group (first key)
reboot laptop
note: make sure vt technology is enabled at bios level
step 3 : vmware workstation short cut will be on desktop or programs files.
Please open it and create vm
step 4 : create vm
step 5 : click dvd/cd and map ISO image which you downloaded (3.8 GB) file .
by default it will in downloads.
step 6 : power on virtual machine
step 7 : start os installation
screenshots are there in what's up group.
/
13 usefull directories inside /
blue = folder(directory)
black = files
disk management
user administration
disk ==> partition ==> format partition (ext4,xfs) ==> mount ==> use
read/write
Useradd <username>
passwd b24u1
id b24u1
cat /etc/passwd
cat /etc/shadow
Permissions (31-may-2021)
chmod
chown
chgrp
1 2 3
rwxr-xr-x
1 2 3
rwx|r-x|r-x
U g o
421 r=4 w=2 x=1 4+2+1= 7 rwxr-xr-x =
755
U =owner rwx
g = group
o= others
there is one more user , that is venu. what permissions venu has on
/b24newdir?
nill or no permissions to others
there is one more user, that is duser1. what permisisons duser1 has
on /b24newdir?
full permissions(rwx) 7 because he is member in root group
num based
chmod 777 /b24newdir
chmod 777 /b24newfile
char based granting and revoking permissions
how to remove permissions only to others?
chmod o-rwx /b24newdir
* what are the default permissions when normal user creates file/dir?
on file 664
on dir 775
* what about root user?
on file 644
on dir 755
umask
*** what is umask? umask is a feature which will control default permissions. i
mean granting or restricting default permissions.
or explain about umask
default permissions
dir file
777 666
- 022 022 (umask)
755 644 root ---------------------
775 664 normal 755 644
prasad
touch file1 777
venu
here venu also will have full permissions on prasad file. there is chance he will
delete.
vi /etc/profile
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
umask 002
else
umask 022
fi
when prasad creates files or directories by default every one should get full
permissions.
temp : umask 000
touch file4
666
000
-----
666
Perm: add following umask value at end of the file
step 1 :vi .bashrc
umask 077
step 2 : source .bashrc
bin = common commands which will work for all the users
cd , pwd, rm, mv,chmod,chgrp
sbin = super user binaries these commands will work only for root user.
userdel,useradd, chown
/test/tdir/somefiles
vi /tmp/users
user1
user2
user3
for i in `cat /tmp/users`
do
chage -M 70 $i
done
stickybit,links
-------------------
0 = no special permissions
1 = sticky bit permissios are applied
2 = SetGID
4 = SetUID
0777 rwxrwxrwx
1777 rwxrwxrwt others has special permissions ( chmod 1777 /dir1 or chmod
+t /dir1)
2775 rwxrwsrwx group has special permissions (chmod 2775 /dir1 or chmod
g+s /dir1)
4700 rwsrwxrwx owner has special permissions (chmod 4700 /script or chmod
u+s /script)
granting super user commands access to normal users using setUID. commands will
executed by root behalf of normal users.
prasad ==> command ==> executed by root
SetGid
Permissions
normal permissions (owner,group and others)
special permissions
sticky bit
Setuid
Setgid
ACL
ACL : Access control list
using acl we can control the access. based on requirement we can provide
access to individual users on file or directory.
can possible to apply permissions users and groups also.
prasad,venu,raja,rohith,siva
unixgrp= prasad & venu
who are others for this directory ? raja,rohith,siva
there is requirement, that is grant read and execution permissions to only siva?
howwe can fulfill this requirement?
here we can to use ACL concept to apply permssions to invidual permisons.
/HRDATA/salarydetails
applied permissions 700 on /HRDATA/salarydetails in this case no one
has any level of access except owner
-m = multiple options
-R = Recursively ( only for directories)
u = user, g= group
-x = exlcude acl permissions
-b =flush the acl permssions on directory or file
LINKS (shortcut)
1. Soft link
2. Hard link
assum there is file inside /etc that file link create into /
ln -s /etc/fstab / ==> soft
ln /etc/fstab / ==> hard
unlink /fstab
HARD Soft
1 Inode Inode will be same for source(original) and destination
(duplicate) different inode will be for source and
destination
2 files/directories "Hard will not support for directories
we can not create links for directory using hard" soft supports links for
files/directories
3 across partitions using hard we can't create link from one partition to
another partition using soft we can create link from any where to any where
4 size source and destination size will be same"
destination size will be calculated based on lengh of file name
FIND
options:
1. name : we know name of file or directory then easy search
2. Permisission : based on permissions we can start searching file or
directory
3. Owner/group : based on file/directory ownership we can search file or
directory.
4. Size : we can search file/dir based on size
5. modified date and time : we can search file/directory based on modified
date and time
useradministration - completed
diskmanagement - not started
software management - not started
booting procedure - not stared
network services(ssh,ftp,nfs,samba,ntp,dns,rsync,http)
-size
find / -size +1000M
========================================================
[root@batch23vm01 /]# find /var/log -type f -size 0 |wc -l
19
[root@batch23vm01 /]# touch /var/log/emptyfilesbyprasad{1..20}
[root@batch23vm01 /]# find /var/log -type f -size 0 |wc -l
39
[root@batch23vm01 /]# find /var/log -type f -size 0 -exec rm -rf {} \;
[root@batch23vm01 /]# find /var/log -type f -size 0 |wc -l
0
==========================================================
jan 1 2021
+145
find / -type f -mtime +145 -mtime -300
Find
name
Perm
size
modification/creation date and time
find <path> <option> <fullfil the option>
Disk management
1. Basic method
2. LVM
3. RAID
disk ==> create partitions ==> format with any of file system
type(ext2,ext3,ext4,xfs) ==>mount the partition ==> use ( read/write)
LVM architecture
-L = Labeling size is 1 GB
-n = name of lv
step 6 : format lv(partition) with any of the file system
type(ext2,ext3,ext4,xfs)
syn : mkfs.xfs /dev/vg/lv
mkfs.xfs /dev/appvg/lv01
step 7 : create directory and mount partition to that directory
mkdir /application
mount /dev/appvg/lv01 /application
df -h
Basic LVM
partitions max 64 29932
scaleup NOT possible can possible (we can
extend partition space in online)
RAID NOT possible Can possible.
cluster Not possible can possible
/application/impfile1
umount /applicaiton
pm = physical machine
vm = virtual machine
step 1(OS) : OS administrator open ticket with storage team for new LUN.
in ticket OS administrator attach storage request form.
OS administrator has to fill storage request form with following
details,
1. HBA card number(wwn) world wide number
2. server name
3. required size
4. Datacentre
5. mode of lun(tem/perm)
step 2 (storage person) : aknowledge the ticket and download the storage
request form which OS admin attached
storage person will create LUN and map that lun number to both
the HBA cards. the HBA card numbers are there in storage req form.
step 3 (OS): scan the channels to get the newly connected disk or lun
eg : we have 4 HBA cards then 4 channels need to refresh
echo " - - - " >> /sys/class/scsi_host/host0/scan
echo " - - - " >> /sys/class/scsi_host/host1/scan
echo " - - - " >> /sys/class/scsi_host/host2/scan
echo " - - - " >> /sys/class/scsi_host/host3/scan
*** while scan for new disk we will specify 3 --- what is that?
- = channel
- = target
- = LUN(disk)
how to know the server is virtual or physical?
dmidecode -s system-product-name
once storage team map single lun to 2 HBA cards at os it shows as 2 disks.
lsblk you can see 2 disks with same size.
eg : if you have 4 HBA cards storage will create 1 lun and map to 4 HBA
cards. in this os person can see 4 disks at os level.
4 disks = 1 lun
Platform
1. Physical platform( server ==> Linux os)
2. Virtual platform ( Server 1 ==> esxi OS ==> vm1 ==> Linux OS)
( Server 1 ==> esxi 0S ==> VM2 ==> Linux OS)
( Server 1 ==> esxi 0S ==> VM3 ==> Windows)
( Server 1 ==> esxi 0S ==> VM4 ==> Windows)
( Server 1 ==> esxi 0S ==> VM5 ==> SuSE)
( Server 1 ==> esxi 0S ==> VM6 ==> Solari)
vm = virtual machine
esxi is a OS which is developed by vmware company. it's a bare metal OS.
using this we can spilt physical components virtuali.
RAM 8 GB
vm1 2 GB running 1 GB only using by machine1
vm2 2GB running
vm3 2 GB powered off
vm4 2 GB running
step 3 (OS): scan the channels to get the newly connected disk or lun
eg : we have 4 HBA cards then 4 channels need to refresh
echo " - - - " >> /sys/class/scsi_host/host0/scan
echo " - - - " >> /sys/class/scsi_host/host1/scan
echo " - - - " >> /sys/class/scsi_host/host2/scan
echo " - - - " >> /sys/class/scsi_host/host3/scan
step1 : we will co-ordinate with vmware team to get new disk , because our
servers are running in virtual platform.
we will open ticket with vmware team to get new disk
physical : we will open case with storage team to get new lun. also we
have fill storage request form
once storage team map lun to server(HBA) cards then we will
referesh channels for new disk
step 2 : once vmware team connect disk to server then we will refresh
channels to get newly connected disk in case disk is not reflected after attach.
echo " - - -" >> /sys/class/scsi_host/host0/scan
echo " - - -" >> /sys/class/scsi_host/host1/scan
echo " - - -" >> /sys/class/scsi_host/host2/scan
echo " - - -" >> /sys/class/scsi_host/host3/scan
echo " - - -" >> /sys/class/scsi_host/host4/scan
echo " - - -" >> /sys/class/scsi_host/host5/scan
step 3 : convert newly connected disk as a pv
pvcreate /dev/sdh
pvs or pvdisplay
step 4 : we will create new vg with new pv
vgcreate orclevg /dev/sd{g,h}
step 5 : then we will create LV in newly created vg
lvcreate -L 10G -n oralv01 oraclevg
step 6 : we will format lv with xfs file system type
mkfs.xfs /dev/oraclevg/oralv01
step 7 : create directory and mount newly created lv to that directory
mkdir /oracledata
mount /dev/oraclevg/oralv01 /oracledata
step 8 : we will update device details in /etc/fstab for permenant mount
/dev/oraclevg/oralv01 /oracledata xfs defaults 1 2
device name mountpoint fstype
permissions meta data backup file system checkup
/dev/sdd 10 GB
/dev/sdd1 5 GB appvg
/dev/sdd2 5 GB appvg
vgreduce appvg /dev/sdd2
vg = collection PV's
appvg = 1 PV = 20 LV's
2nd situation or use when we will migrate data from one disk to another disk
is .
current disk size is 1 TB which is not enough for future. decided
upgrade same disk to 4 TB
vg ==> pv1 , pv2, pv3, pv4
vg ==> 1 pv with 4 TB.
step 1 : Get new disk to transfer data from faulty disk to new disk. the new
disk capacity should equal or greater than faulty disk.
faulty disk is = /dev/sdb = 5 GB
new disk is = /dev/sdi = 7 GB
faulty disk is present in datavg
step 2 : convert new disk as pv
pvcreate /dev/sdi
step 3 : add new pv into existing vg where fault disk is exist.
vgextend datavg /dev/sdi
now how many pvs are in datavg? 2 one faulty one and other one is new one.
step 4 : data lvs from fault disk to new disk
pvmove /dev/sdb /dev/sdi
remove faulty disk from vg and pvlist
vgreduce datavg /dev/sdb
pvremove /dev/sdb
pm ==> LUN id
multipath -ll
logical id
open case with storage team to expand existing lun capacity.
in ticket we have to share existing logical id
where to get the logical id multipath -ll
*** still disk is not released from vg? or pv is not released from vg?
vgreduce --removemissing vgname
RAID
Redundant Array of Inexpensive Disks
RAID Level
=============
RAID 0 Stripping
RAID 1 Mirroring
RAID 2
RAID 3
RAID 4
RAID 5
RAID 6
RAID 1+0
RAID 0+1
RAID 0 : Stripping
we are going to implement these RAID levels using any of below methods
1. LVM ==> we are going to create lv with raid level
2. MDADM(multi disks administration)
/dev/sdc ==> 10 GB
/dev/sdd ==> 13 GB
b24lv01 stripping 10
lvs --segment
lvs -a
-a all with option + devices
raid 5
lvcreate -L 5G -n lv05 --type raid5 oravg
raid 1
lvcreate -L 2G -n lv01 --type raid1 oravg
stripped
lvcreate -L 2G -n lv00 --type raid0 -i 2 oravg
MDADM
create partition with RAID 5
step 1 : create array or device with raid 5
mdadm --create /dev/md5 --level=5 --raid-devices=3 /dev/sdc /dev/sde /dev/sdf
how to check device details
mdadm --detail /dev/md5
step 2 : format the device using xfs file system
mkfs.xfs /dev/md5
step 3 : create directory and mount it
mkdir /mdir
mount /dev/md5 /mdir
LVM questions
1. Please explain step to create lvm partition frm scratch?
2. Extend partition space which is created in lvm method?
if enough space is available in vg then how to extend partition space?
if there is no enough space in vg then how to extend partition space?
3. pvmove
questions for pvmove
1. old disk faulty or read and write speed came down so decided to
remove faulty disk, so how we can do this.
2. existing disk capacity is 20 gb deciced to get new disk with 1 TB
and migrate data from old disk to new disk which we got with 1 TB size.
4. what is pe and le size?
4 MB
PE = physical extends
LE = logical extends
5. how to extend pe size?
while creating vg we can define LE size
vgcreate -s 8M vgname /dev/sdi
6. explain about raid levels?
7. which raid level gives fault tolerance and better performance?
RAID10
8. what is parity?
9. what are the difference between raid 5 and raid 10.
10. Unfortunatly deleted lv, how to recover it.
11. which is current lvm version?
lvm2
lvm version
=================================================================
Installing/uninstalling/upgrading/updating/querying(getting
information)
media player
notepad
winword
java
oracle db
vlc.msi
microsoft installer
vlc.exe executable file
packagename.rpm
softwarename.exe
softwarename.msi
Query options:
qa = list out all installed
qi = query information about installed pkg
qi = get the information about installed pkg
qip = to get the information about which is not installed pkg information
rpm -ivh
rpm -ev
rpm -qi,d,f,c,R
YUM
yellowdog update and modifier
rpm -qa
yum list installed
rpm -qa vsftpd
yum list installed vsftpd
RPM YUM
Repository not possible Repoisitory can possible
advantages of repository:
1. It consider the
dependencies automatically.
2. it will work like
centralized package management server.
yum Server will
have all pkgs
client
1 will connect with yum server and take pkgs
client
2 also can connect with yum server and take pkgs
client
3 also can connect with yum server and take pkgs
3. Easy to perform
patching(upgrade/downgrade)
Steps at server:
step 1 : mount the ISO image
vm settings ==> dvd ==> use iso image file ==> browse the OS
image file
mount /dev/sr0 /media
step 2 : install pre-requisite pkgs
1. createrepo 2. vsftpd
rpm -ivh /media/Packages/createrepo
rpm -ivh /media/Packages/vsftpd
step 3 : create local directory and copy pkgs from DVD to local
directory.
mkdir -p /var/ftp/pub/rhel75
cp -r /media/Packages/* /var/ftp/pub/rhel75
step 4 : create repository
createrepo -v /var/ftp/pub/rhel75
step 5 : configure repository
cd /etc/yum.repos.d
vi local.repo
[rhel75.repo]
name=rhel75.repo
baseurl=file:///var/ftp/pub/rhel75
gpgcheck=0
enabled=1
first 2 lines are displayname of repo
baseurl = path of repodata or pkgs
gpgcheck= 0 disable 1 enable authentication to clients . 0 no authentication
required for client machine. freely they can come to yum server and take pkgs
gpgcheck =1 authentication is required . server will have 1 key same key should be
inside client machines also
enabled =0 disable repository
enabled=1 enable repository
step 6 : refresh repository and enable vsftpd service for connect
client machines.
patching
yum update
client :
vi /etc/yum.repos.d/local.repo
[rhel75]
name=rhel75
baseurl=ftp://192.168.145.162/pub/rhel75
gpgcheck=0
enabled=1
we will ask app/db team to stop the things whaterver running in server =====>
done
perform patching ===> done
yum update
reboot
request app team to validate application functionality in sever where
we done the patching.
7.5 1
7.0 2
how to list out installed kernels and which is top
grep menuentry /boot/grub2/grub.cfg
grub2-set-default 2
grub2-mkconfig -o /boot/grub2/grub.cfg
shutdown -r now
Solution 4 : roll back full patch using yum history
note : make sure we brought machine to rhel 7.0 kernel
in the grub screen we will select 7.0 kernel
Satellite concept
*** How to check is the server is registered with satellite in satellite sever.
in browserver
http://satelliteserverip
username
password
DASHBOARD==> Hosts ==> servername ==> unregister
***** roll back latest patch which is integrated with satellite server.
boot with old kernel
enable old repo using
subscription-manager --enable=old repository id
yum history undo 4
reboot
*** how to enable only particular repo out of many
yum --disablerepo="*" --enablerepo="repoid or reponame" install pkgname
in above command we are installing one pkg from particular repository
*** How to exclude one pkg from yum update
yum update --exclude="pkgname"
zypper update --exclude="pkgname"
yum update ===> full patch (every 3 months once for all servers)
yum update --security =====> it updates only the security related patches.
(every month for all servers)
yum update kernel ======> it updates only kernel
zip not install when you perform yum update zip will not install
zip is installed then when we perform yum updte zip will update to latest.
zypper update
Patching procedure
Linux administration:
==> Operational team (24/7) support , incidents, service requests, change
management
==> patching team ( schedulling, getting approval, patch)
==> Build team ( server provisioning) team : build the servers as per build
sheet.
==> IAM ( Identity access managment) team : user and group related requests.
creating user, deleting user, granting privilages, password reset
Operational team:
User unable login
High cpu usage alert
high memory usage alert
server crash or server hung
extend RAM size
extend cpus
extend partition space
remote machine not able to connect to machine
PMO team : this is the team responsible for schedule window, co-ordinate with
team and complete patching activity successfully.
Make sure CR is in place CR=change request
make sure change execution plan(CEP) is read for upcoming change
Implementation plan has been reviewed
approvals are in place.
scheduling meeting for upcoming change(patching)
order
1. patching procedure
2. satellite related questions
3. Roll back
4. server is not coming up after patching
patching procedure, creating partition from scratch using lvm method, extending
partition space, pvmove , Types of raid levels, satellite related questions, local
repository configuration, roll back procedure.
1. Create partition using lvm method from scratch with below specifications
mount point name = /b24data1
file system type = xfs
size = 12 GB
Booting procedure
***
Booting procedure start from press power on button to until we get login prompt.
Booting procdure helps to understand the boot process, wil help to understand how
the hardware and software is working.
and also it helps to understand bootup issues.
to identify and fix boot up issues.
while server booting up cmos will give critical information back to RAM
eg : you will power off laptop or server on july 12th 2021 and power on it
back on 2022 jan 1 .
that time we can see updated date and tme
how it happening is the cmos program will store the current date and time and
it keeps update with help cmos battery.
for cmos who is supplying power?
cmos battery
Sub task 3 : BIOS
in this task bios will identify bootable disk and hand over control to next
stage.
eg : CD ROM
disk
floppy
usb
Bios will look for OS in connected components as per order like disk, cd, usb..
once it find the OS in any of components then pass control to MBR
post : it does the health checkup of all the components which are connected mother
board.
once post task completed then cmos will give critical information back to RAM.
then bios will identify OS in connected disks and pass control to MBR once it finds
the OS.
Stage 2 : MBR
Master boot recorder
it is a simple program which will be in first sector of OS disk.
512 bytes nothing 1/2 KB.
MBR or 512 bytes maintaince next stage information that is grub information.
is grub is in good condition to take control or not that is what MBR
maintains.
512 bytes
446 bytes are occupied by next stage information(grub) nothing but
primary boot loader information.
64 bytes are occupied to maintain partition table infromation
2 bytes are occupied by validator which will validate is primary
boot loader is in good condition or not(grub)
-----
512
grub is a just boot loader which is providing facility to choose which one has to
boot up during server coming up.
grub is a boot loader which will maintain multiple os's or kernels and it provide
facility to choose which kernel or os has too bootup.
Stage 4 : Kernel
Stage 5 : systemd
systemd program will look for default.target . systemd will execute default
target.
default target programs will execute parlely.
finally we will get login prompt.
cd /usr/lib/systemd/system
ls -l
lrwxrwxrwx. 1 root root 15 Jun 30 21:44 runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 Jun 30 21:44 runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 Jun 30 21:44 runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Jun 30 21:44 runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Jun 30 21:44 runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 Jun 30 21:44 runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 Jun 30 21:44 runlevel6.target -> reboot.target
================================================Networking
==========================================================
what is network?
IP Classes?
how to assign ip address for the linux box?
Nic bonding(network level HA) disk level HA = RAID network level HA is NIC
bonding
services:
1. FTP Imp
2. SSH vimp
3. SFTP vimp
4. NFS vvimp
5. SAMBA imp
6. NTP
7. DNS imp
8. HTTP
9. Rsync imp
what is network?
creating connectivity between more than 2 systems or 2 components for
transfer data or voice.
2 components
one mobile to n number of mobiles
one computer to n number of computers
one server to n number of servers
types of networks
1. Intranet (LAN) Local area ntwork : creating network
within building for all the components.(private)
2. Extranet (MAN) Metropolitan area network : creating
network between branches within one city. eg : one building to other
3. Internet (WAN) wide area network(public)
desktop environment (pc or laptop) = patch panel . patch panel is nothing board all
the network cables connected to one Board(LAN)
server envirnoment (servers) = switches
11111100.00111010.11000011.00010011
8 bits 8 bits 8 bits 8 bits
1 byte 2nd byte 3rd byte 4th byte
1octet 2nd octet 3rd octet 4th octet
1. private IP
2. public IP
1 to 255
1.1.1.1
1.1.1.2
1.1.1.3
1.1.1.4
255*255*255*255
total 255
IP Classes
Class A 0 - 127 (pub & private) network
Class B 128 - 191 network
Class C 192 - 223 network
Class D 224 - 239 multicasting
Class E 240 - 255 R & D
private public
Class A 10.0.0.0 165laksh ips 1.0.0.0,
2.0.0.0,3.0.0.0
Class B 172.16.0.0 - 172.31.0.0
Class C 192.168.0.0
out of 255 only 3 numbers are given for private remaining all for public.
10, 172,192
outside inside
ftp ====> firewall ==> system
block ftp
http ===> firewall ====> web site
allow
1. lo loopback
loopback is default virtual ethernet card. it will exist for all components
use: within the system services will comunicate through loopback.
2. ethernet card
is used for communicate with remote machines.
vi /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO=static
DEVICE=ens33
ONBOOT=yes
IPADDR0=192.168.145.100
IPADDR1=192.168.145.101
IPADDR2=192.168.145.102
PREFIX0=24
BOOTPROTO=dhcp/static/none
ONBOOT=yes
what is onboot? onboot=yes means ethernet card should comeup during server
booting up
onboot=no means ethernet card should be in down state while
server coming up
IPADDR0=192.168.145.100 primary
IPADDR1=192.168.145.101 secondary ip for same ethernet card(ens33)
IPADDR2=192.168.145.102 secondary ip for same ethernet card(ens33)
ping
telnet
nc
traceroute
netstat or ss
ctrl + ]
quit
telnet is a tool for test service status from one machine to other machine.
NC : net cat
traceroute 192.168.145.20
traceroute -p 22 192.168.145.20
netstat or ss
ss or netstat will tell you on service how many connections are there.
eg: ssh is the service
using ssh service how many clients are connected that ss or netstat will
confirm you
netstat -nap
n - network
a - all
p - process id
NIC Bonding
min we will go with 2 ethernet cards . use these 2 ehternet cards we will configure
the HA.
modes
mode0 (rr) round robine = HA and Load balancing . both the ethernet
cards will be in active. both ethernet cards will take the load
mode1 (AB) active- backup = at a time 1 will be in active and other one
will be in backup state. you will not get load balancing.
mode2
mode6
pre-requisite :
make sure 2 ethernet cards are connected to server
FTP
File transfer protocol
1. It is very fast, stable and efficient service to transfer data over the
intranet and internet.
2. It supports only files transfer , using ftp we can't transfer
folders/directories.
3. Data transimitting in binary format.
binary(01010101)
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
to
anonymous_enable=NO
20 = Data transfer
21 = connection
passive active
data port will be decided by server. Data port will be
decided by client.
mkdir /ftp
chmod -R 777 /ftp
systemctl restart vsftpd
SSH
Secure shell
Advantages:
1. very secure: data will travel in encryption format. unauthorized users(hackers)
can't open data.
2. we can transfer files and directories using ssh service
3. remote administration can possible through ssh service.
draw back is : Bit slow because it has to do hand shak,encrypt data and transmit.
what is ssh background functionality or architecture of ssh service
1. Handshak
2. Create tunnel
3. transfer encrypted data
putty is a software which we installed in windows machine. using putty we are able
to connect linux machine from windows.
syn:
scp <filepath in source> username@ipofremotemachine:/path
if we denied root user through ssh service. user will use his own credentials
to login and then switch to root user if he want to do any administrator tasks.
there will be a proper log in /var/log/secure like so and user switched
to root user at so and so time.
rhel = /var/log/secure
suse = /var/log/messages
-----------------------------------------------------------------------------
-------------------------------------------------------------------------------
Jul 23 13:01:37 b24vm01 sshd[5327]: Accepted password for babu from
192.168.145.1 port 53979 ssh2
Jul 23 13:01:37 b24vm01 sshd[5327]: pam_unix(sshd:session): session opened
for user babu by (uid=0)
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------------
--
db team capacity is 10 users. is that oracle user is common user for all db
team? yes
deny the sap user = individual credentials ==> switch to ==> sap user
deny the oracle user = Individual credentials ==> switch to ==> oracle user
deny the root user = Individual credentials ==> switch to ==> root user
vi /etc/ssh/sshd_config
DenyUsers babu,oracle
vi /etc/mybanner
we will get content from security team
SFTP
Secure File transfer protocol
ftp
ssh
SFTP It's part of ssh service only like scp.
pkg : openssh
service : sshd
daemon : sshd
port : 22
configuration : /etc/ssh/sshd_config
ftp remotemachineip
sftp remotemachineip (through ssh)
NFS
Network file system
make sure nfs-utils pkg is installed then export the file system.
vi /etc/exports
/oradata *(rw,sync)
eg:
* means = all the systems in network (world)
/oradata 192.168.145.20(rw,sync)
export options:
/oradata *(rw,sync)
/oradata *(rw,async)
*** what is the difference between sync and async option in nfs?
sync: nfs server will give aknowledgement to client machine once complete
data transfer to server machine.
eg : client initiated transferring 4 gb data to nfs server. here nfs
server will confirm or ack back to client machine once 4 gb data copied to server.
Async : nfs server will give aknowledgement to the client machine as soon as
client start transffering data to server machine.
async will not wait until data transffer to nfs server. starting itself
server will confirm back to client like data is recieved.
*** which option will imporve the nfs server performance sync or async?
async
how async will give better performance at nfs server end is? nfs server will
give ack to nfs client machine as soon as client start transffering data.
async will not compare or check source and target size
100 client machines are using nfs file system, so how many
administrators are there on exported file system?
100 machines root users.
remote root users file
root root
*** wha is the difference between soft mount and hard mount?
192.168.145.200:/oradata on /oradata type nfs4
(rw,relatime,vers=4.1,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,port=0,ti
meo=600,retrans=2,sec=sys,clientaddr=192.168.145.20,local_lock=none,addr=192.168.14
5.200)
vers=nfsversion 4.1
rsize= read size
wsize=write size
hard
timeo=600 timeout
retrans=2 times
soft : the default functionality of soft mount is, client will try to access
server with limitted times after reaching limitted times client will not try to
reach server.
eg : 2 intervals with 600 sec timeout
soft will try first time after 10 min and second time again
after 10 min.
max 2 times with 20 min after 2 time with 20 min client
will not try to reach server.
file system will not mounts back once connection issue is resolved
between nfs client and server
here administrator has to mount nfs file system manually once
connection issue is resolved.
autofs
we will use autofs method to access the nfs file system. advantages of autofs
is,
1. we can save network bandwithd between client machine to nfs server
2. It improves NFS server performance.
file system will mount when user access the file system. automatically it
unmounts incase not using for 5 min.
in client machine file system will get unmounted when we are not using and also
file system will be mounted back as soon as we start using file system.
In client machine
step 1: install autofs pkg incase not installed
yum install autofs
step 2 : add below entry in master file
vi /etc/auto.master
/- auto.misc
step 3 : configure the file system details in /etc/auto.misc file
/oradata -fstype=nfs 192.168.145.200:/oradata
*** df -h output got struck. what is the issue? how we can resolve this issue?
first check the connectivity between nfs client machine to nfs server
telnet 192.168.145.200 2049
if connection is not there then i will check below problems.
problem 1 : may be nfs server is down
identified nfs server is down.
what next?
vmware machine: login to vmware vcenter and power on that particular machine
cloud : login to azure portal and power on that particular machine
later we will identify root cause for server power off
problem 2 : may nfs service is down
identified nfs service is down
we will login to nfs server and check nfs service status "systemctl
status nfs-server"
bring up nfs service if service is down
systemctl start nfs-server
systemctl enable nfs-server service will start when server is coming
up.
problem 4 : May wrong entries in /etc/exports file . nfs service will not start up
incase there are wrong entries in /etc/exports file
identified : some one added wrong entries in /etc/exports file so nfs service
was not started
soultion : correct the wrong entries in /etc/exports file and restart the
service
problem 5 : may firewall is blocking
server is up and nfs service is running but still client couldn't able
to mount the nfs file system.
in this situation may issue with firewall
1. firewall at os level
2. network firewall which is maintaining by network team
we can check firewall service at os level
systemctl stop firewalld
systemctl disable firewalld
open case with network team for allow 2049 port between client machine to nfs
server
source : client machine
destination : nfs server
port : 2049
passive : ftp server will decide random port and map data tranfer from 20 to
random number. random port is opened by server.
active : ftp client will open random port number for data transfer and request ftp
server to map and start transfering.
each and and every time client will comeup with new random port number.
server has to allow that.
20 data 20 ==> random port to transfer data
21 cmd/connection
SAMBA
using samba service we can transfer data across cross platforms, mean unix to
windows and windows to unix servers.
vi /etc/fstab
//192.168.145.1/B24sharedrive /b24sharedrive cifs
defaults,credentials=/root/.smbcredentials 0 0
step 1 : decide which directory or mount point want to export for widnows machine
mkdir /winshare
chmod -R 777 /winshare
step 2 : export /winshare directory
vi /etc/samba/smb.conf
[winsharefromprasad]
path = /winshare
read only = no
valid users = prasad raja
disable selinux
setenforce 0
windows machine
run prompt
\\192.168.145.200
in login prompt
192.168.145.200\prasad
password
permanent:
double click on my computer
add a network location
1. Firewall
firewall will maintain the rules. what is the rule? one policy for
traffic allow or deny.
writing input rule in 200 machine. we are allowing 20 machine through 2049
port
source = 192.168.145.20
destination = 192.168.145.200
port = 2049
protocol = tcp/udp
Input rule
output rule
my machine is = 192.168.145.200
other machine is = 192.168.145.20
20 machine want to connect 200 machine on 2049 port?
tell me which type of rule we have to write for 200 machine? Input
tell me which type of rule we have to write for 20 machine? output
pkg name = firewalld
service = firewalld
daemon = firewalld
configuration file = /etc/firewalld/firewalld.conf
allowing traffic
firewall-cmd --zone=public --add-service=nfs --permanent
firewall-cmd --reload
firewall-cmd --zone=public --add-port=21/tcp --permanent
firewall-cmd --zone=public --add-port=20/tcp --permanent
firewall-cmd --zone=public --add-port=21/udp --permanent
firewall-cmd --zone=public --add-port=20/udp --permanent
firewall-cmd --reload
firewall-cmd --get-default-zone
public
firewall-cmd --set-default-zone=external
how to deny service
firewall-cmd --zone=public --remove-service=nfs --permanent
SELinux
Secured enhanced Linux
he came through ftp service so we should allow only /var/ftp/pub not /etc/.
this kind of rules maintained or managed by selinux.
SELINUX modes
1. enforcing ( strickly follow the rules) recommended is
enforcing ============> by default
2. permissive (waring) it just prints the warning but it allows
the data
3. disable = no rules at all every allowed and have access on
data
TCP / UDP
TCP = Transimission control protocol
UDP = User datagram protocol
ftp = tcp/udp
ssh = tcp
sftp = tcp
nfs = tcp
samba = tcp
dns = udp hostname and ip
ntp = udp date and time
http = tcp
dhcp = udp
rsync = tcp
protocol is nothing but process.
tcp follows some set of policies and udp follows different set of polocies
difference 1 : connection orient
TCP : connection oriented protocol . it establish connection to destion before
start data. it check the destination status and then start transfer data.
UDP : connection less protocol. It will not verify destination status. it trasfer
data without checking the destination person is avaialbe or not.
difference 2 :
security
TCP : very secure to transfer data because it establish connection to destination
and does the hand shak and then start transfer data
udp : not secure . it will not verifydestation status and also doen't do the
handshak.
realible
tcp : is very realible. in case packet failed to deliver to destination the tcp
will re-try to deliver packet.
udp : will not re-try for delivering failed packets.
Header size :
TCP: 20 bytes (source ip, destination, port number, ack number, retries, sequence
number,packate status ......)
UDP : 8 Byes ( source ip, destionation ip, portnumber)
performance(fast)
UDP is very fast
based on which target we set as default those services will start parlely.
finally we gets login prompt once all services are loaded or started.
DNS
Domain Name system
DNS types
1. Local DNS . Maintaining hostnames and IP address in invidual
machines
2. DNS server
GTLD: .gov .com .corp .org .info .edu .trav .nic (21)
CC TLD : .in .us .uk .sl .pk .nl
Resources:
TTL = time to live
server1 IN A 192.168.145.25
server2 IN A 192.168.145.26
till now above 2 entries are there in forward lookup zone file.
$TTL 1d
if i add new record in forward lookupzone file (03-aug-2021).
server3 IN A 192.168.145.27
it will star reflecting or working from 04-aug-2021, because TTL value is 1 Day.
once TTL expaires the new recrods will loaded.
$TTL 1h = the new records will start working or enable after 1 hour
$TTL 2h = the newly added records will reflect after 2 hours from adding
time.
====================================sample forward lookupzone file
content==================================
$TTL 86400
@ IN SOA master.prasad.com. root.prasad.com. (
2017050601 ; serial
3600 ; refresh
1800 ; retry
604800 ; expire
86400 ; minimum
)
@ IN NS master.prasad.com.
@ IN A 192.168.190.144
master IN A 192.168.190.144
===============================================================================
master.prasad.com.
master is my hostname
prasad.com is my domainame like google.com, facebook.com
root.prasad.com. administrator for domain
@ = hostname.domainname.com.
IN = Internet
SOA has bellow resources
1. serial number (2021080301) first change in 3rd aug 2021 2021080302=
second change in 03rd aug 2021
2. refresh = 1h ( updating recrods to slave dns sever)every 1 hours master
server will push the changes to slave dns
3. retry = 30m (refresh is failed in last attempt so retry will trigger
every 30 min incase reshesh failed)
4. expiry = 1d ( master could not able to push changes to slave for 1 day
then master will trea slave is not fit for dns server)
master goes down automatically who will become master? slave
system
when slave doen't have update data then master confirming that
don't become as master incase i fail also.
5. minimum (nx records) actually our domain is prasad.com
some one is trying m1.prasad.con
trying to m2.prasad.com which not there in our
domain.
Master DNS server(primary)
Slave DNS server (secondary)
master DNS server will keep push records to slave.
slave dns server will compare with master dns server using serial number. if
serial number matchine then slave will understand data is synced.
master DNS and Slave DNS serial numbers are matching then slave will be in
sync state
master serial number is 02 and slave serial number is 01. Here slave is not
synced with master.
prasad = added one record . after adding record then prasad will change the
serial number 01
rajesh = next rajesh is adding one more record in file , even rajesh will
change the serial to 02
lakshmikar
somu
siva = end of the day siva made some changes in DNS then finally siva will
update the serial number
2021080307
aug 3rd 7 changes made in dns
$TTL 1h
@ IN SOA b24vm01.b24.com. root.b24.com. (
2021080303 ; serial
3600 ; refresh
1800 ; retry
604800 ; expire
86400 ; minimum
)
@ IN NS b24vm01.b24.com.
@ IN A 192.168.145.200
b24vm01 IN A 192.168.145.200
m1 IN A 192.168.145.21
m2 IN A 192.168.145.22
m3 In A 192.168.145.23
CNAME = alias
facebook IN A 192.168.145.100
fb IN CNAME facebook
fbook IN CNAME facebook
-------------------------------------------------------
options
{
directory "/var/named"; // "Working" directory
dump-file "data/cache_dump.db";
statistics-file "data/named_stats.txt";
memstatistics-file "data/named_mem_stats.txt";
};
zone "b24.com" IN {
type master;
allow-query {any; };
file "forward.b24.com";
};
-------------------------------------------------------
Step 4 : verify syntax of conf file and forward lookup zone file
named-checkconf /etc/named.conf
named-checkzone b24.com /var/named/forward.b24.com
systemctl restart named
systemctl enable named
solution:
take system into emergy or rescue mode
create simple swap file temp
lvcreate
mkswap /dev/vg/swaplv
swapon -a /dev/vg/swaplv
add entry in the fstab
reboot
HTTP(apache)
===========================
ftp = data
ssh = data
sftp = data
nfs = data
samba = data
dns = hostname and ip
http = data
http (Hyper text transfer protocol)
only http supports hyper text publish.
http
nginx
============================
from 192.168.145.20 to 192.168.120.20 145 network 1 120 network2
between these 2 networks there will be firewall
==========================================
HTTP types
1. IP based web site configuration ( single ip and single web
site)
2. Name Based web site configuration ( single Ip and multiple web
sites with different name)
3. Port based web site configuration
httpd codes:
1** or 100 = Information code or information error
2** or 200 = successfull . meaning successfully end user able to access the
web site
3** or 300 = redirection. web site is redirected to different web page
4** or 400 = client or end user site problem to access web site. client
entered wrong credentials to acess web page . web server captures as 400 error code
facebook.com entered wrong credentials: in sever side in logs we
can see 400 error.
correct one is facebook.com
wrong : facebook.com:800000
it's not server problem. client is access wrong name or port number
5** or 500 = server side problem . I mean httpd server side problem.
server could not able to supply data to clients
may httpd service is not running
may web site data is not there
permissions problem on /var/www/html/site3
supported formats:
html
htm
NTP
Network Time protocol
Advantages of NTP : end user and inside servers will have same date and time so
there will not be connection time our issues.
dis advantage if we don't have NTP : end users may will get session time out error
because end user will maintain one time and servers are mainting different date and
time so there a chance connection timeout error will happen.
ntpq -np
=============================== client side===================
recieved alert for time sync issue or time is delay in one of the machine?
step1 : get the NTP server ip and sync up or get the latest date and
time from NTP server.
ntpq -np or chronyc tracking
offset: is the exact value of variaent time or diffence between ntp server
and client machine.
step 2 : if we notice there is much offset value in chronyc tracking
command then fetch the latest date and time.
Rsync
remote sync. used for transfer data between machines and within machine also.
rsync -avz /data username@remotemachineip:/tmp ==> transferring data
from one machine to other machine . equal to scp
rsync -avz /data /opt ==> transferring data with in machine. equal
to cp
adv: compress data while transferring data to remote machine and it transffer only
differencial data.
what is differencial data?
in destination /data folder capacity is 1 GB
in source /data folder capacity is 1.5 GB what is differencial? 0.5 GB
is the difference. Only 0.5 GB data will be transimitted to destionation.
rsync will not overwrite
scp will overwrite
which is fast between scp and rsync? rsync because it does the
sync(differencial) and compress data
sync:
rsync -avz /data/ 192.168.145.20:/data
scp -r /data 192.168.145.20:/data
a = preserve permissions based on source
v= verbose
z= compress
rsync use the ssh port and parameters
what is the port number of rsync = 22
yum install rsync
-c = create
v = verbose
f = force
x= extract
gzip = gunzip
zip and gzip are compression commands
tar = archive methodology command
difference between zip and gzip is ?
zip supports both folders and files
gzip supports only files
zip : source and backup will be available
gzip : we can find only destionation file after compression
sync: gzip file1
gunzip file1.gz
zip = .zip
tar = .tar
gzip = .gz
.tar.gz
data1.tar.gz
tar -xvzf data1.tar.gz
sudo
switch user do
eg : useradd command is will not work for normal users, but using sudo we can allow
particular normal user to execute this command
prasad ALL=(ALL)
/usr/sbin/useradd,/usr/sbin/usermod,/usr/sbin/userdel
prasad,babu,rajesh ALL=NOPASSWD:
/usr/sbin/useradd,/usr/sbin/usermod,/usr/sbin/userdel,/usr/sbin/lvcreate
*** how to know what are the commands access has for particular user
sudo -l
execute the above command as that user
visudo
%unixgrp ALL=NOPASSWD: ALL
User_Alias PRASADUSERALIAS = raja, venu, rayudu, prasad, naresh
PRASADUSERALIAS ALL=NOPASSWD: ALL
Cmnd_Alias PRASADCOMMANDS=
/usr/sbin/lvcreate,/usr/sbin/lvdel,/usr/sbin/userdel
babu ALL=NOPASSWD: PRASADCOMMANDS
OS partitions
other partitions(application/DB)
OS partitions:
1. /
2. /boot
3. /var
4. /tmp
5. /home
other partitions:
DB
/oradata
/oralog
/ora
SQL
/DB2
/DB2applogs
ls -ld /oradata
ls -ld /var
ls -ld /appdata1 here we are able to identify owner of partition.
DL= Distribusion list
[email protected] (os team will be part of this group)
OS partition alerts diverted to [email protected]
[email protected]
[email protected]
we cleared unwanted data from partition and also compress old data but still
partition usage is > threesold value. then finally we can extend parition space
Solution 3: extend partition space
every day at 12 AM TSM backup tool is backing up full data then with help of
yesterday or recent backup we can restore.
Solution 1: clear unwanted data from /var partitions. mainly old logs
will be there in /var so we can delete those old logs
cd /var/log
first thing identify which file or directory consuming more space
du -hs filename
du -hs directory
du -hs *
du -ks * | sort -r -n | head -2
implemented solution 1 but no free space from /var then we will go with
second solution.
solution 2: compress the important data or move imp data to other place where
we have enough space.
cd /var/log
find /var/log -type f -mtime +5 -exec gzip {} \;
we are compressing all the files older than 5 days.
implemented solution 2 but no free space from /var then we will go with third
solution
Solution 3 : extend the partition space
Solution 1: clear unwanted data from /boot partition. mainly old kernel
files from /boot
cd /boot
first thing identify which file or directory consuming more space
du -hs filename
du -hs directory
du -hs *
du -ks * | sort -r -n | head -2
initramfs-3.10.0-123.el7.x86_64.img
initramfs-3.10.0-560.el7.x86_64.img
initramfs-3.10.0-862.el7.x86_64.img
symvers-3.10.0-123.el7.x86_64.gz
symvers-3.10.0-560.el7.x86_64.gz
symvers-3.10.0-862.el7.x86_64.gz
System.map-3.10.0-123.el7.x86_64
System.map-3.10.0-560.el7.x86_64
System.map-3.10.0-862.el7.x86_64
always keep latest 1 kernel data in system. we can use the latest kernel data
incase want roll back the patching.
without any body approval we can delete data from /tmp partition
3 GB /tmp
decided by SME or architech
> 12 years of experience
512 MB
100 MB is free that more enough for /boot partition
/ = 5 GB
/boot = 512 MB
/var = 7 GB
/home = 10 GB
/app1
/db1
ticketing tool ==> ack alert==> working in progress ==> once you brought
partition usage is below threesold then ==> close the ticket
===================================================================================
====================================
to prasad
cc his manager and our team(os team)
subject : / partition is full
Hi Prasad,
Noticed you kept your data in / the folder details are below
[root@b24vm01 ~]# ls -ld /prasadimpdata/
drwxr-xr-x. 2 prasad prasad 6 Aug 10 14:15 /prasadimpdata/
===================================================================================
==========================
Performence Fine-tunning
performance = speed
TOP = using top we can analyze or identify server performance like memory usage,
Cpu load and swap utilization.
eg : 200 tasks(processes) are running that processes memory & cpu
usage we can find in top command.
also we will get individual process(task) cpu,memory and swap
utilization.
task = is nothing but one process whicy triggered by end user.
2000 - 1 zombie
2000 - 100 zombie = 1900 only can run everytime
zombieo processes are not show stoppers but little bit performance will degrade.
instead of run 2000 processes at a time it will allow only
1900 because there are 100 zombie processes.
parent process will give kill signal to childs . please kill your self. I am
leaving process table in some miliseconds.
signal reached to childs they are process of killing them self but
parent left before they confirm i killed myself.
child process didn't respond to parent within time so parent left that dead
process in processor table.
solution : reboot or restart parent process(service)
===============orphan processes=====================
orphan is nothing who doen't have parents, but process is running state.
kill signals
kill -9 pid
***** -9 is inturpt and kill process forcefully.
-15 is refresh process
-18 or SIGSTOP
kill -SIGSTOP <pid> ========> stop the process or pause process
kill -SIGCONT <pid> ========> resuem stopped process
%Cpu(s): 17.4 us, 4.8 sy, 0.0 ni, 77.1 id, 0.0 wa, 0.0 hi, 0.7 si, 0.0 st
us = user processes
application user
db users
<10 % sys
remaining 90 % app or db
** identified sy value is more eg: 50 %. How you can resolve this issue?
solution 1 : get approval from system owner and reboot the system
solution 2 : still utiliztion is high even after reboot then open case with
os vendor with sosreport if it is a redhat system
open case with os vendor with
supportconfig if it is a suse system
redhat = redhat/IBM
suse = novel/suse
solaris = oracle
AIX = IBM
hp ux = HP
alway company will renewval the license with full support from vendor.
L3/sme not able to identify or fix the issue then we can reach out
venor(redhat) for solution.
support.redhat.com ==> open support case ==> fill the details in ticket like
subject
description of issue
criticality
attach screenshots
sosreport
redhat = sosreport (support.redhat.com)
suse = supportconfig (scc.suse.com)
pid = 21915
user = qd1adm the a1_jobserver is the process is started by qd1adm user.
PR = priority value -20 to 20
-20 is the high priority value
20 default
-20 first priority
-19 next prirotity
NI = priority
VIRT = virtual memory utilization by a1_jobserver process
RES = Residential memory usage(RAM usage)A1_jobserver process consumed actual ram
memory
SHR = shared memory not only a1_jobserver consuming 26660 the memory using by some
other processes also
S = status of the process
r = running
s = sleeping
Z = zombie
T = stopped/pause
D = Un-inturaptable process
%CPU = 300% a1_jobserver process consuming 300 % of cpu. how many cpus i have ?
16= what is my total cpu capacity? 1600 % in that 300% is matter? no
***** noticed one of the process consuming 200% cpu, what you will do?
first i will verify how many cpus are there in my system.
if i have 4 cpus that means 400 % is my cpu capacity in that 200% is occupied
by one process. nothing critical.
if i have 1 cpu then situation is critical because 1 process started
consuming 200% .
SAR
system activity report
using sar command we can analyze cpu,memory,disk,network performance .
historical ? 1 hour back cpu utilization, 2 day back cpu utilization, 20 days back
memory utilization can possible in sar command.
but in top only max 15 min Load average can possible to analyze.
sar -r 1 1
-r mem
-u cpu
-b block devices(disk)
-s swap
pkg = sysstat
service = sysstat
daemon = sysstatd
historical data will store in = /var/log/sa
interval is every 10 min
configuration file is /etc/sysstat.conf
historical
sar -r -f /var/log/sa/sa20210814 ====> yesterday memory utilization
sar -u -f /var/log/sa/sa20210814 ====> yesterdays cpu utilization
data
/usr/lib64/sa
sadc = system activity data collector. he is one who collects resources
[cpu,memory(ram),disk] utilization data.
sa1 = sa1 will collect data from sadc for every 10 min.
sa2 = sa2 will coloborate data per data and create overall day file at
11:50 PM. same time sa2 creates file for tomorrow.
========================================
==> we will acknowledge ticket and login to server to check the alert.
ack = assigning ticket with your name and changig ticket status to in-
progress
open(new)
in-progress
resolve(completed)
close
re-open
===> verify which process is consuming more cpu using top command
i will execute top + P to get highest utilization processes
Hi DB Team,
if they say this is normal utilization. we can not kill or clear any
process?
what next?
solution : increase the cpu with change request
Jobs
====================
1.AT
2.Cron
we can schedule any task or script using at job or cron based on requirement.
services of jobs
at service is atd systemctl status atd
cron service is cron systemctl status cron
crontab -e
* * * * * task/script/command
1 2 3 4 5 6
***** explain crontab fields?
req1 : job should execute every min . the script path is /usr/local/bin/s.sh
* * * * * sh /usr/local/bin/s.sh
req2 : job should run every sund between 8 to 9 AM every 5 min
req3: job should execute every day at 2,4,6,8 am at 30 min . 2:30 4:30 6:30 8:30
30 2,4,6,8 * * * sh /usr/local/bin/s2.sh
how to modify other users job as a root. root can modify or verify other users jobs
SWAP
swap is a virtual memory for RAM(main memory). we will allocate swap from
disk space.
actual mediator between end user and processor is RAM but swap is a assistance for
RAM.
when RAM is full or reached to quota then kernel will send some jobs to swap. RAM
is heavily load please stay sometime in swap. once RAM is free
again he will call for execution.
we don't have enough space in vg or we don't have free disk. but we noticed 5
GB available in / decided to create 2 GB swap for emergency case.
eg: medical store. rugularly customers are coming for one of the medicin. the
worker will keep the item near to him or very far?
near to him.
to better performance
RAM is full new jobs are not allowing to execute then we can clear the cache
***** how to clear cach memory?
echo 3 > /proc/sys/vm/drop_caches
step 2 : remove lv
step 3 : again create new lv with new size.
what is kernel?
kernel role is manage the resources like memory management & tasks
management.
even kernel will have the limits and settings.
how to list out kernel parameters or settings?
sysctl -a
===============================
sysctl -a |grep "net.core.rmem_max"
net.core.rmem_max = 212992
temp
sysctl net.core.rmem_max=16777216
net.core.rmem_max = 16777216
Perm
sysctl -w net.core.rmem_max=16777216
net.core.rmem_max = 16777216
configuration file for kernel parameter /etc/sysctl.conf
the below command is for load or reflect kernel parameters which are recently added
in /etc/sysctl.conf
sysctl -p
verify file and apply the new parameters
vm.swappiness = 60
swap will activite once main memory reach to 40% utilization. any of the processes
can use swap once after main memory reach to 40 % utilization.
======================Limits===================
even kernel will have limits. How to list out kernel limits
ulimt -a
==================================================================
ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 127383
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 127383
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
========================================================
what is current max user processes? 127383
eg: file size is 1 GB currently in system in this case if you try to open 2 gb
file. kernel will not allow to open because we set kernel limt to 1 GB.
ulimit -f 1024
SBX11:~ # ulimit -a |grep "file size"
core file size (blocks, -c) unlimited
file size (blocks, -f) 1024
ulimit -f unlimited
SBX11:~ # ulimit -a |grep "file size"
core file size (blocks, -c) unlimited
file size (blocks, -f) unlimited
file size what is the max file size we allow to create or open.
open files what is the max files should allow to open at a time. ulimit -n
2048
max user processes what is the max user processes allowed to open . ulimit -u
187484
permanent
/etc/security/limits.conf
we set limit for prasad user that max you can login how many times? 10
* soft maxlogins 3
* hard maxlogins 10
we set limit for all the users that max individual user can login with how
many sessions? 10
user is try to open very big file but it's not opening what be the problem?
the opening file size is bigger than ulimt value.
solution: change file size limit to high value and try to open same file.
locate command?
what is the difference between locate and find?
find is for find files and directories with many clues(options)
locate is for find files and directories with name based
find (name,size,permissions,modify time, read time)
locate(name)
panel will say i know the name of the file and i want search it. which right
approach?
locate or find? locate
locate filename
why locate is faster than find.
locate will look for file path in system db.
find will imediatly all the locations manually and find out the file.
outlook(mail)
communicator(skype,myteams,slack)
setting up meetings in outlook
how to join in meeting
first login time: power on laptop and enter your company credentials
the credentials will share by your reporting manager. from whom we will
get login credentials? reporting manager.
first day of joining HR will share your reporting manager name,email-id and
mobile number to you to take credentials.
we have to call the reporting manager and ask for credentials.
first time outlook ask username and password to complete configuration for
mail box.
-----------------------------------------------------------------------------
-----------
subject :SG1SBX11 - Not accessible
Hi Iqbal/Akhilesh,
Subjected server is not able to access it. could you please look on it.
-----------------------------------------------------------
subject :create new partition
Hi Iqbal,
ack:
reply all
Hi Prasad,
orders one application =customers can book thair product in online and pay
amount in online
100 servers required to fullfill above requirement
L1 = Below 3
L2 = Between 4 to 6 Years
L3 = Between 6 to 9 Years
SME = subject mater expert between 9 to 15 Years
Arch = between 15 to 20
arch - manager
client or owner of the company will ask new feature or new application.
He will dicuss with application architech and explain he requirement.
application teams = 25
one of the server is not responding to the commands and not able to login to
systems. How you will handle this situation?
send mail to downtime contact email id which is there in inventory management too.
==========> login to inventory management tool ==> search for particular server
==> get downtime contact email address.===================
Hi Team,
RHEL7.2_DB_Ready_Template
RHEL7.5_App_Ready_Template
RHEL7.5_DB_Ready_Template
RHEL7.9_App_Ready_Template
RHEL7.9_DB_Ready_Template
RHEL8.2_App_Ready_Template
RHEL8.2_DB_Ready_Template
SuSE12.SP4_App_Ready_Template
SuSE12.SP4_DB_Ready_Template
SuSE12.SP5_App_Ready_Template
SuSE12.SP5_DB_Ready_Template
SuSE15.SP1_App_Ready_Template
SuSE15.SP1_DB_Ready_Template
Windows2019_App_Ready_Template
Windows2019_MSSQL_Ready_Template
vcentre or vsphear
start post build activities after server deploy. access server through
putty and start post build activities.
S/N Task
1 Verified OS and confirmed its SLES 15.sp2 as per build sheet
2 Creating file systems. Fs-xfs and LVM
3 Setting up swap through waagent.
4 Create application group and users as per SAP basis team
request.
5 Grant full sudo permission to sapbasis user which is local user.
6 "Hardening Machine along with patching and Sap package
installation .
Install packages which are requested by SAP Basis team.
Libatomic1 , numactl, saptune & sensors"
7 Verify Domain integration status.
8 Backup Configuration
10 Adding to maintenance calendar - Separate email sent
11 Hand over server to SAP team.
============decomissioing servers==
co-ordinator will co-ordinate about server decommision.
once we recieve approval for server decommision. we will follow below process
to decomission the server.
1. co-ordinator will create change or tikcet with unix team to decommision.
2. we will acknowledge ticket
3. backup the full machine and poweroff server for 7 days. request backup
team to backup the full machine.
4. delete machine ofter 7 days incase no complaince like who powered off this
server? why you poweroff? if we don't get such question from any body then srtight
away we will delete machine from vcentre.
5. close the change
vsphear = free tool which is providing by vmware company will not much
features compare to vcentre.
vmotion, replication , DR things and not possible in vsphear
vcentre = is third party tool which contails all the features.
it is from vmware.
booting procedure
patching/roll back
lvm (create/extend/reduce)
nfs
fine tuning performance
what is zombio
what is orphan
process states
what is load average
ITIL
=================
6:30 3:00
right process is
L1 engineer accept the p1 ticket and try for 1 hour and not able fix then
escalte to L2 engineer. still how many hours left for further
toubleshoot ? 3 hours
now ticket is with L2 engineer.
L2 engineer will work on P1 issue for 1 hour and escalte to next level in
case he couldn't able to fix issue in 1 hour.
still how many hours left for L3/SME to troubleshoot? 2
ITIL is nothing follow the pre-defined process and check lists which is
defined by our self.
process to follow implement any change in server that is nothing but change
management.
unexpectedly incident(server is down) happened in this case how we will handle?
that is nothing but incident management.
same issue is repeating but we don't have permanent solution for that issue, we
will follow problem management process to handle such issue.
changes
extending partition space
reducing partition space
increasing ram size
increasing cpu's cores
deleting one user
customizing kernel parameters.
patching
incidents
1. server is rebooted
2. server got hung
3. server is not accessible
4. server performance is degraded
5. none of the users not able to login to server
incident SLA
P1 or critical = issue has to resolve with in 4 hours
P2 or high = issue has to resolve with in 8 hours
like this aggrement will be there between service provider and client.
client will write this aggrement and ask service provider to sign on that.
1. change management
for simple yum update or zypper update we are spending 5 days process.
Types of changes
1. Routine change
2. Standard change
3. Emergency change
1. Routine changes: per year or per quoarter some tasks/changes are fixed for
execution those changes called as routine changes
eg: OS patching
software upgradation
2. standard changes: ad-hoc changes
1. provision the server
2. decommision the server
3. customize the kernel parameters
4. customize the kernel ulimits
5. increase the RAM
6. Increase the CPUS
7. extend partition space
8. install/un-install/upgrade any package
9. customizing any service parameters (ssh,vsftpd parameters)
3. some impact will be there incase not implement change imediatly that kind of
changes are emergency changes.
RFC ==> CR or CEP preparation ==> TAB meeting===> CAB meeting ==> go or
no go call ==> implement(patch)
CEP and CR is created now change co-ordinator has to schedule TAB meeting with all
the respective teams.
all the team will join and discuss about change(CEP). co-ordinator will
gothrough one by one CEP task.
CEP is looks good and CR is ready to update in CAB meeting excel sheet.
change coordinator will ask CAB meeting team to add our CR also. CAB meeting
team will ask is TAB is completed? if yes then only they
accept for CAB meeting.
incase CR is not yet ready or CR is not approved in ticketing tool then we should
not put cr into CAB meeting.
CAB meeting team will verify CR is approved and TAB meeting is done
CR is approved on thursday around 7 PM is it eligible for CAB meeting? no
because already CAB meeting started.
we can take this CR for next CAB meeting.we missed for 26th so we can
discuss this CR in 2nd sep
suppose change is approved in CAB meeting then we are good to procced with change
in coming weekend.
2 Incident management
======================
incase any incident happened in project how to handle? that is nothing but incident
management process
P1 = priority 1 = critical
P2 = priority 2 = High
P3 = Priority 3 = medium
P4 = priority 4 = low
======================
SLA - Service level aggreement for Incidents
Priority ack/respond Restore/resolve Close RCA requied
P1/S1 15 min 4 hours 24 hours RCA -24 or 48
P2/S2 15 min 12 hours 48 hours NA
P3/S3 30 min 24 hours NA NA
P4/S4 30 min 48 hours NA NA
ack: assign ticket with your name,change status to in-progress and add comment like
working on issue.
it should happen within 15 min
task 1 : shift engineer will ack the ticket and inform incident management team(via
mail)
task 2 : incident management team will open meeting for incident with required
teams
task 3: join in meeting and start working on issue
task 4: every 30 min incident management team will give update to client on issue.
current status to client
unix team rajesh is working from last 30 min.
incident manager will ask rajesh what is update? rajesh will say still
troubleshooting. then imediatly incident manager will ask rajesh
could you escalate issue to your senior.
siva l2 joined
30 not able to fix then incident manager will ask loop your SME
task 5 : incident manager wil give update to all stack holder about issue status
like issue is resolved
summary
issue :
resolved by =
sla time is 4 hours from ticket start but we breach sla we took 5 hours to resolv
the issue? what is next
=================================================
problem:
issue is re-occuring again and again but we don't have permanent solution
1. open case with vendor and keep work with vendor until we get permanet solution.
to repair os partitions
skip to shell
grub2-mkconfig -o /boot/grub2/grub.cfg
how to install the grub
grub-install /dev/sda
===================================================================================
=============
emergency : machine enter into emergency mode automatically incase any file
system problem
eg : given wrong entries in /etc/fstab in this case system will enter
into emergency mode
we can correct fstab entries in emergency mode without dvd/iso image
help, but we should remember root user password.
===================================================================================
===========
emergency will understand by os automatically.
single user mode : administrator will take machine into single user mode for
repair any file system or anything else
question 2 : what is zombie and what is the impact of zombie process incase it
exist?
Hari Prasad T,Harshananda V, kalpana raju,vignesh vicky,Anand Heggi,Radhika
Etigedda,Aishwarya Konathala,asifali ms,bomma sulakshana,vignesh vicky,N.Lakshmikar
Reddy2,Radhika Etigedda,Dharmendra N,Dinesh U,Vinod Roxx,Swathi UN,mounika
muddapolu,Indu Sweety,Sakthi Vel,Vani J,Rathnakishor Gadikota,JYOTSNA
CHITTE,Prachiti Kulkarni,Revathi Ammu,13KIRUTHIKA S6012,Prem Chand,Harshananda
V,Hari Prasad T,lakshmi chella,Siva Chinnu,amanullah shaik,N. Narasimhulu,kalpana
raju,Sure Vinaykumar,Rathnakishor Gadikota,Ashok M,Madhu S,c.naveen Kumar,sai
tej,Divya Raja,asifali ms,Sireesha p,
booting procedure?
Vani J, Sireesha p, sivakumar reddy,Revathi Ammu,N.Lakshmikar Reddy2,aknagendra
Babu,Dinesh U,Radhika Etigedda,Akula devika,Swathi UN,Prachiti Kulkarni,
13KIRUTHIKA S6012,Aishwarya Konathala,Mohan SurapaRaju,kalpana raju,asifali
ms,mounika muddapolu,Rathnakishor Gadikota,amanullah shaik,bomma sulakshana,
lakshmi chella,D V Pradeep Kumar,N. Narasimhulu,Ashok M,Dharmendra N,pramod
s,vignesh vicky,Rajesh Chitte,Mr. Botla,reddaiah reddy,
Anand Heggi,JYOTSNA CHITTE,jaikumar neelakantan,Sakthi Vel,K Bhagyalakshmi,Hari
Prasad T,Hasini K,Rajitha Bollineni,reddaiah reddy,Divya Raja,
Chandu L,Madhu S,satya krishna
cluster HA
hardening
vulnurabilities
ansible//
shell is a language. using shell we are going to write simple programs to automate
administration.
c,python,perl,c++,core java,yaml(ansible),powershell(windows).
lvcreate
mkfs
mkdir /tdir
mount
add entry in /etc/fstab
sh lv.sh
please enter lv name: tlv
please enter mount point name : /application1
please enter file system type : xfs
please enter size : 10G
please enter vg : vg00
hardening tasks:
permitrootlogin no
banner
timeout
deny users
AWK
SED
awk : we can print particular column data from file or command output
SED
string editor
what is use of sed command is? we can modify file without opening.
eg: we can add content to file using sed command
we can replace word using sed command
we can delete word using sed command
^
===========
[root@b24vm01 ~]# grep "PermitRootLogin" /etc/ssh/sshd_config
PermitRootLogin yes
# the setting of "PermitRootLogin without-password".
[root@b24vm01 ~]# grep "^PermitRootLogin" /etc/ssh/sshd_config
PermitRootLogin yes
===========
$
=============
[root@b24vm01 ~]# grep "administrator" /testfile
Mahesh joined in IBM as linux administrator
working as linux administrator in Accenture
Types of Variables:
1. System variables
2. user variables
1. System variables will be in capital letters
how to print the system variables? env
what is variable?
1. it's a array which can store the value or program
using history command we can list out the recent 1000 commands
what is the functionality of HISTSIZE? it can store the latest 1000 commands which
are executed by user
who defined functionality inside HISTSIZE? OS developer
how to call the variable value? echo $variable
export:
set the variable value for temparary:
export HISTSIZE=2000
not accepted:
5_var
-var
var-var
var_a!
var_a$
var_a&
Topics:
=====
1. SED
2. AWK
3. VARIABLES
4. QUOTES
5. Operators (ARTHEMETIC Operators, Relational operators, Logical operators)
6. start simple program
7. what is shebang
4. QUOTES
1. " " = content can be printed between double quotes but it can
understand the special symbols(\n\t\v $variable $0)
2. ' ' = content can be printed between single quotes but it can not
understand the special symbols.
3. ` ` = is for call or execute sub program or command
a=prasad
echo 'My name is $a'
My name is $a
-----------------------------------------------------------------------------------
--------
[root@cmb24vm02 ~]# a=prasad
[root@cmb24vm02 ~]# echo "My name is $a"
My name is prasad
[root@cmb24vm02 ~]# echo 'My name is $a'
My name is $a
[root@cmb24vm02 ~]# echo "My Hostname is `uname -n`"
My Hostname is cmb24vm02
[root@cmb24vm02 ~]# echo 'My Hostname is `uname -n`'
My Hostname is `uname -n`
[root@cmb24vm02 ~]#
-----------------------------------------------------------------------------------
---------
5. Operators (ARTHEMETIC Operators, Relational operators, Logical
operators)
ARTHEMETIC Operators
+
-
*/
/
expr 5 + 5
expr 5 - 3
expr 5 \* 2
How to exclude empty lines from output
cmd | grep -v ^$
c=`sar -u 1 1 | awk '{print $9}' | grep -v %idle | grep -v "^$" | awk -F.
'{print $1}'`
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
c=`sar -u 1 1 | awk '{print $9}' | grep -v %idle | grep -v "^$" | awk -F.
'{print $1}'`
usage=`expr 100 - $c`
echo " The current CPU usage is : $usage %"
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
mkdir -p /scripts
cd /scripts
vi cpuusage.sh
c=`sar -u 1 1 | awk '{print $9}' | grep -v %idle | grep -v "^$" |
awk -F. '{print $1}'`
usage=`expr 100 - $c`
echo " The current CPU usage is : $usage %"
sh cpuusage.sh
or
./cpuusage.sh
sh cpuusage.sh
sh is the shell which i used to execute file or program.
Relational operators
== -eq equal
> -gt
>= -ge
< -lt
<= -le
!= not equal
eg :
[ 5 -le 4 ];then
do something
if [ 5 <= 7 ];then
echo "value is less then 7"
else
echo " value is greater than 7"
fi
if
else
fi
================
if
fi
========
if
else
elif
elif
elif
fi
=====================================
***** incase shebang is not defined inside script. is the script is going to
execute or fail?
the script will execute if there is no shebang line. it is going to consider
current/default shell as shebang line.
the script is going to take default shell as shebang and execute in that.
hardening script
1. permitrootlogin no
2. password policies max age 70 min age 2 war 10
3. ssh banner
4. disable ftp service
5. un-install telnet
6. allowed groups through ssh is ssh-users ==> in /etc/ssh/sshd_config :
AllowGroups ssh-users
ssh-users is group
only ssh-users group members are allowed to login system.
#! /bin/bash
h=`hostname`
echo "Hardening the following server : $h"
echo "Task 1 : Disabling Root Login through ssh service:"
sed -i "s/^PermitRootLogin/#PermitRootLogin/g" /etc/ssh/sshd_config
sed -i "/^#PermitRootLogin/a PermitRootLogin no" /etc/ssh/sshd_config
current=`grep "^PermitRootLogin no" /etc/ssh/sshd_config |wc -l`
if [ $current -eq 1 ];then
echo "Permit root login has been disabled in `hostname`"
else
echo "root is allowed to login in `hostname`"
fi
echo "Task 2 : Applying password policies:"
sed -i 's/^PASS_MAX_DAYS 99999/PASS_MAX_DAYS 70/g' /etc/login.defs
sed -i 's/^PASS_MIN_DAYS 0/PASS_MIN_DAYS 2/g' /etc/login.defs
sed -i 's/^PASS_WARN_AGE 7/PASS_WARN_AGE 10/g' /etc/login.defs
echo "Task 3: Set the Banner for SSH users"
echo " ###### IT's a PRASAD Server . If your authorized to Login then try to
attempt login" > /etc/bfile
echo " If your not authorized or not working in PRASAD company then don't Login"
>> /etc/bfile
sed -i 's/^Banner/#Banner/g' /etc/ssh/sshd_config
sed -i '/^#Banner/a Banner /etc/bfile' /etc/ssh/sshd_config
echo "Disable FTP service"
systemctl stop vsftpd && systemctl disable vsftpd
echo "Un-install telnet"
echo yes |yum remove telnet
echo "Allow only ssh-group users through ssh"
s=`grep "AllowGroups ssh-users" /etc/ssh/sshd_config|wc -l`
if [ "$s" = "0" ];
then
echo "AllowGroups ssh-users">> /etc/ssh/sshd_config
systemctl restart sshd
fi
echo " Server has been hardened $h"
===================================================================================
======
0 = success
127 = command not found
126 = command triggered but not executed
1 = catchall for general error
130 = command or script is terminated by control-c
128 = passed invalid option to script in that case script will exit with 128 error
code
===================================================
script 4: Process/move file from landing location to destionation location as soon
as file araives into landing location.
statement-of-icici1256-dd-mm-yyyy.pdf
statement-of-hdfc123-dd-mm-yyyy.pdf
mkdir -p /landingfolder
mkdir -p /icici /hdfc /sbi /citi
#! /bin/bash
cd /landingfolder
ls -ld *icici* | awk '{print $9}' > /tmp/icicifiles
ls -ld *hdfc* | awk '{print $9}' > /tmp/hdfcfiles
ls -ld *sbi* | awk '{print $9}' > /tmp/sbifiles
ls -ld *citi* | awk '{print $9}' > /tmp/citifiles
for i in `cat /tmp/icicifiles`
do
mv /landingfolder/$i /icici/
done
for h in `cat /tmp/hdfcfiles`
do
mv /landingfolder/$h /hdfc/
done
for s in `cat /tmp/sbifiles`
do
mv /landingfolder/$s /sbi/
done
for c in `cat /tmp/citifiles`
do
mv /landingfolder/$c /citi/
done
===============================================
passing command line arguments to script
#! /bin/bash
useradd -s $2 -d $3 -m $1
echo "$1:$4" | chpasswd
chage -M $5 $1
vi /scripts/useradd.sh
## add above 3 lines in file
$1 rajesh1
$2 /bin/bash
$3 /home/rajeshhome
$4 test123
-----------------------------------------------------------------------------------
---------------------------------------
===============================================
echo -e
\n new line
\t tab
\vveritical order
echo -e "1.AIX\n2.Redhat\n3.Solaris"
=================================================
Collecting pre-checks from all servers
#! /bin/bash
h=`hostname`
d=`date +"%d-%m-%Y"`
echo -e "host name is \t:\t`hostname`"> /tmp/$h-prechecks-$d.txt
echo -e "Uptime is \t:\t`uptime`">> /tmp/$h-prechecks-$d.txt
echo -e "Mount Points are\n=================================\n`df -hPT`
\n====================================" >> /tmp/$h-prechecks-$d.txt
echo -e "FSTAB output is\n=================================\n`cat /etc/fstab`
\n====================================" >> /tmp/$h-prechecks-$d.txt
echo -e "kernel version is \t:\t `uname -r`" >> /tmp/$h-prechecks-$d.txt
echo -e "OS version is \t:\t `hostnamectl status | grep "Operating System"`" >>
/tmp/$h-prechecks-$d.txt
echo -e "Physical volumes \n `sudo pvs`" >> /tmp/$h-prechecks-$d.txt
echo -e "Volume groups \n `sudo vgs`" >> /tmp/$h-prechecks-$d.txt
echo -e "Logical volumes \n `sudo lvs`" >> /tmp/$h-prechecks-$d.txt
/tmp/hostname-prechecks-29-08-2021.txt
vi /tmp/prechecks.sh
above content
eg: $@
#! /bin/bash
for i in "$@"
do
echo "$i"
done
output
sh arg.sh 1 "2 3" prasad linux solaris 'shell scripting'
1
2 3
prasad
linux
solaris
shell scripting
eg:eg: $*
#! /bin/bash
for i in $*
do
echo "$i"
done
output
[root@cmb24vm02 scripts]# sh arg.sh 1 "2 3" prasad linux solaris 'shell
scripting'
1
2
3
prasad
linux
solaris
shell
scripting
======================================================================
How to monitor file and send mail notification to team about file download status?
serastatement.
icici one statement
hdfc one statement
from bank around 2 AM we will get this file into one of the location.
all the banks statement should arraive at 2 AM or max 4 AM
incase this file is not there then amount will not credit to the shop people.
========================================================schedule===========
crontab -e
01 2-4 * * * sh /scripts/monitorbankstmt.sh
cat t.sh
#! /bin/bash
d=`date +"%d-%m-%Y-%T"`
touch /tmp/tfile-$d.txt
crontab -l
@reboot sleep 10 && sh /scripts/t.sh
===================================================================================
==========
ANSIBLE
1. overview of ansible
2. installation of ansible
3. How to run ad-hoc commands for multiple servers
4. how to write ansible playbook
5. run playbook
4 to 5 playbooks
what is ansible?
ansible is configuration management tool. which is developed by redhat
company.
which node we will call as master node? which is contains ansible tool(pkg).
where will be the ansible modules? master node
in which machine we create inventory? master node
what is inventory? group of remote machines
what is module? predefined program which is developed in python.
user module
this module is for perform user administration in remote machine.
an
inventory:
group of systems/servers
vi /etc/ansible/hosts
[prod]
192.168.145.200
192.168.145.25
[qa]
192.168.145.25
master : 192.168.145.20
clients:192.168.145.25
192.168.145.200
192.168.145.170
- hosts: prod
tasks:
- name: creating file in remote machine
file:
path: /babufile1
owner: prasad
group: root
mode: '1770'
===============================================
verify syntax errors:
ansible-playbook file.yml --syntax-check
dry run in remote machines
ansible-playbook file.yml --check
- hosts: prod
tasks:
- name: creating file in remote machine
file:
path: /babufile2
state: touch
owner: prasad
group: root
mode: '1770'
- hosts: prod
tasks:
- name: Installing packages
yum:
name:
- nano
- zip
state: present
=======================================================
dry run : ansible-playbook installation.yml --check
- hosts: prod
tasks:
- name: disabling selinux in remote machines
lineinfile:
path: /etc/selinux/config
regexp: '^SELINUX='
line: SELINUX=permissive
========================================
dry run : ansible-playbook disableselinux.yml --check
========================================> portal.azure.com
==========================================
how to protect your self in public network? using nsg rules. we can allow
only specified ports.
==================================== 25-SEP-
2021============================================
CLOUD:
step 1 : deallocate the server(stop the virtual machine)
step 2 : change the machine size
step 3 : power on the virtual machine
but we will follow the change process to increase any of resource for
virtual machine.
==================================================================================
server is rebooted at 10 am
we can see which are users logged in at 9 to 10:30 am
go to their users and verify history command
no one rebooted server purposefully and not able to find out clue
for reboot then open case with vendor
vulnurabilities:
1. permitrootlogin yes it is a security vulnurability
how to mitigate or remediate?
change permitrootlogin no in /etc/ssh/sshd_config
2. old samba packge is running
how to mitigate or remediate?
upgrade to latest samba pkg
zypper update samba
yum update samba
3. ftp service is running in db server?
how to mitigate or remediate?
stop or uninstall vsftpd service
4. usb is allowed in so and so servers
remediation : disable usb at kernel level
there are many tool which will identify the vulnurabilities and send report.
download the report
analyze the report
remediate the vulnurabilities as per solution.
===============================================================================
one p1 issue: remote applications were not able to connect to the server on 55022
port
application is running but still other applications could not able to connect
no firewall were blocking but still other applications could not able to
connect
port will start listening whenever application start.
01 * * * 1
conection timeout
no such file or directory
could not able to write : no space, write protection, doen't have permission
to write
===============================
cluster
=============================
pace maker cluster
cluster commands:
crm status = to check the cluster status
crm config show = to show the cluster configuration
crm config edit = to edit the cluster configuration
crm configure property maintenance-mode=true ====> put cluster
in disable/maintenance mode
crm configure property maintenance-mode=false ===> take out
cluster from maintenance mode
steps in node1:
step 1: migrate resource group to node2
crm resource move g-XT1_ASCS node2hostname
step 2 : perform patching node 1
step 3 : reboot the server
step 4 : once node 1server is up then do the post validation
steps in node2
step 5 : login to node2 and migrate both services to node1
crm resource move g-XT1_ASCS node1hostname
step 6 : perform patching in node 2
step 7 : Reboot the server(node 2)
step 8 : once node 2 is up then do the post validation
step 9 : move back resource group to node2 from node1.
bgv =
payroll =
pam_tally2 -u username ===> how many wrong password attempts are there
pam_tally2 -u username -r ===> clear the wrong password attempts.
exit
umount /rescue/proc
umount /rescue/sys
umount /rescue/dev/pts
umount /rescue/dev
cd
umount /rescue/boot
umount /rescue
***** could not able to create new file inside partition? what may be the problem?
1. May inodes are full for partition
2. file system converted into read only mode
noticed many processes are using partition. but we have approval to unmount
the partition. now we can kill the all processes
fuser -vik /dbpart1
or
kill -9 pid
***** how to list all processes in machine?
ps -ef
or
ps -aux
how to filter only particular user processes
ps -aux | grep username
***** /var/log was full we deleted and cleaned up 2 gb space but still that 2 gb is
not reflected to partition. still showing /var is full.
/var/log/messages
how to know which service is putting logs in /var/log/messages
how to find out which process is storing logs in /var/log/secure
lsof /var/log/messages
lsof /var/log/secure
***** rsyslog is the service which is responsible for logs capure and segregate to
respective file
logs are not coming to /var/log/messages how to rectify this problem
systemctl restart rsyslog
azure questions:
*** how many resource groups are allowed in one subscription
980
*** max number of vnets in one subscription
128
*** how many types of load balancers?
standard and basic
inside standar lb
we will have option to create public and internal(private) load
balancer
rescue method