You are on page 1of 64

Mount -o rw,remount

SWAP CONFIGURATION
Swap memory is nothing but virtual memory. When the physical memory
[RAM].is full the virtual memory (hard disk) is converted into a swap.
The inactive pages are moved from RAM to swap.
Swap space can be created in two ways.
1. One is using free partition
2. Second one is using a sized file from an existing disk.
When we have these types of requests. We have to check whether there
is any change or not.
If there is any change we have to check whether it is preapproval or not.
After the approval, we have checked the present swap size by using the
free -m & Swapon -s commands.
After checking the present swap we get to know how much swap needs
to be added. Then we have to check. If there is any free disk available.
By using #lsblk & fdisk -l commands.
If available we are provided to create a swap file system.
If not, we have to contact the storage team to add a free disk after
getting confirmation from the storage team. We have to scan the disk in
os level by using
#echo “- - -” >/sys/class/scsi_host/host0/scan
Then, we have to check whether the disk is added in os level is not.
#fdisk -l & lsblk
After , finding free disk using #fdisk <device name>
After labelling the disk we have to create a swap file system using command.
#mkswap <device name>
Then we have to mount the create swap to the existing swap.
#swapon <device name>
BONDING & TEAMING
In linux bonding is a combination of two (or) more multiple nic cards
called bonding as well as teaming.
It is a method of combining two (or) more network interfaces together
into a single interface.
Bonding can only configure physical servers.
Mainly we are using the bonding concept for increased bandwidth and
high availability & redundancy.
If we want to configure the bonding minimum 2 nic cards are required.
If there are no nic cards is attached to the “os” level after that we will
check the nic cards by using
#Ifconfig -a
We have multiple mode policies available but mostly we are using
mode=0,mode=1.
My environment is using only mode=0. It is a round-robin [active- active]
mechanism.
I am aware of mode=0 & mode=1
mode = 0 [active - active] round-robin
mode =1 active - backup
If you want to create a bonding you have to create one configure file
under.
/etc/sysconfig/network-scripts/
#vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=10.10.6.222
NETMASK=255.0.0.0
GATEWAY=10.10.0.1
ONBOOT=yes
BOOTPROTO=none
BONDING_OPTS=”mode=0 (or) mode=1 miimon=100”
#vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
#vi /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes

When we configured the bonding with mode=0 if any nic card fails then
the entire load goes to another nic card.
As well as the bonding with nic mode=1 if an active nic card fails then
the backup nic card becomes active automatically.
To check the bonding status by using command.
#cat /proc/net/bonding/bond0
"Bonding and Teaming in Linux" Bonding is a method in Linux where two or more network
interfaces are combined into one, either called bonding or teaming. It's used to merge
interfaces for higher bandwidth, availability, and redundancy, usually on physical servers.

To set up bonding:

You need at least 2 NIC cards.


Check NIC cards using ifconfig -a.

Common modes are mode=0 (round-robin) and mode=1 (active-backup).

To configure bonding:

Create a config file at /etc/sysconfig/network-scripts/ifcfg-bond0.


Example config:
makefile
Copy code

DEVICE=bond0
IPADDR=10.10.6.222
NETMASK=255.0.0.0
GATEWAY=10.10.0.1
ONBOOT=yes
BOOTPROTO=none
BONDING_OPTS="mode=0 (or) mode=1 miimon=100"
For NIC cards:
● Create /etc/sysconfig/network-scripts/ifcfg-eth1:

● makefile
● Copy c

DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes


● Create /etc/sysconfig/network-scripts/ifcfg-eth2:

● makefile
● Copy code

DEVICE=eth2
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes

Bonding with mode=0 shares load; if a NIC card fails, traffic shifts to another card. Bonding
with mode=1 has a backup; if an active NIC fails, the backup NIC takes over.

Check bonding status with: cat /proc/net/bonding/bond0.

Understanding NIC Properties in Linux"

In Linux, NIC (Network Interface Card) is a hardware component that

connects a computer to a network. NIC properties in Linux refer to its


configuration settings, which can be managed using tools like 'ifconfig' or

'ipaddr'.

Most NICs default to auto-negotiation, with modes like 10, 100, or 1000

Mbps. There are two data transmission modes:

Half Duplex: Quick two-way communication, like a walky-talky, for


prompt responses.
Full Duplex: Slower but uninterrupted two-way communication, like
online meetings.

Usually, full duplex is preferred, and half duplex might be used for

backup or restoration.

NIC properties include:

NIC Status (on/off)


Speed
Duplex (half/full)

For physical servers, NIC status can be changed using:

to turn on

to turn off

To check NIC properties, use:

● ethtool <nic card name> (e.g., ethtool eth0)

To temporarily change speed and duplex:

● ethtool -s eth0 speed 10 duplex half autoneg off

For permanent changes, modify NIC configuration:


Edit /etc/sysconfig/network-scripts/ifcfg-eth0
Add: ETHTOOL_OPTS="speed 100 duplex half autoneg off"
Regenerate

WHAT IS SWAP ? HOW TO CONFIGURE THE SWAP?


Swap memory is nothing but “virtual memory”. When the physical
memory[RAM] is full virtual memory is converted to swap.
The inactive pages are moved to RAM to SWAP.
There are two ways to create a swap.
1 is using a free partition.
2 is using the sized file from the existing usable disk.
When I receive these types of requests or change in the request. I need
to check whether it is pre-approved by the concerned team.
If it is approved by the team. I will check in the server, whether there is
any free disk or lun available.
If not i will revert the request there is no free lun.

SYS INFO

/etc/issue

/etc/redhat-release

Both are used to check the kernel versions

LINUX FILE SYSTEM HIERARCHY


For any person, who does not have knowledge on Linux operating system and Linux File System.
Mostly; it means dealing with the files and their location. It’s usage were very horrible. So, I been
updating the tree structure of the Linux.
This LINUX DIRECTORY STRUCTURE DIAGRAM can provide the information about the Linux File
System.
 A standard Linux distributed follows the directory structure as provided below with the
diagram and explained.

Each of the directory contains important information, where required for the booting the
device drivers, configuration files & etc.
Let me describe shortly about the each directory.
1. /bin: all executable primary programs required for booting. It contains basic
commands which can run in the single-user-mode.
Ex: du, df, tar, rpm, wc, history & etc.
2. /boot: it holds files during the boot-up process, including Linux-Kernel.
3. /dev: Contains device files for all the hardware devices on the machine.
Ex: Cdrom, cpu, & etc.
4. /etc: contains the configuration files for every individual program.
5. /home: default user home directory.
6. /lib: the Lib directory contains the KERNEL MODULES and SHARED LIBRARY
these images required to boot the system and run commands in the root file system.
7. /lost+found: this Directory is installed during installation of Linux. It is useful for
recovering the files that may be broken due to unexpected shut-down.
8. /media: temporary mount directory is created for removable devices.
9. /mnt: Temporary mount directory for mounting the file system.
10. /opt: It contains third party application softwares.
11. /proc: A virtual and pseudo-file-system which contains information about the running
process with a particular process-id and PID.
12. /root: the root is the home directory for the root user and should never be confused
with “/”.
13. /run: the directory is the only clean solution for the early-runtime-dir problem.
14. /sbin: it contains binary executable programs, required by the System
Administrator, for Maintanance.
Ex: iptables, fdisk, ifconfig, swapon, reboot & etc.
15. /srv: Service is abbreviated as “srv”. This directory contains server-specific and
service-related files.
16. /sys: Modern Linux distributions includes a /sys a directory as a virtual file system.
17. /tmp: Its means a Temporary File system.
18. /usr: contains executable binaries, documentation, source code, libraries for the
second-level program.
19. /var: Stands for the variable. The contents of the files are expected to grow. This
directory contains log, lock, spool, mail, and temp files.

LINUX HAVING CONFIGRATION FILES: let us discuss about their location and their usage.

Linux is an operating system which having well-defined configuration files {binaries, man
pages, info files & etc for every process.

CONFIGRATION FILES FOR DISK MANAGEMENT


/etc/fstab:--- To permanent the file system.
Device namemount pointfstype mountoption dumpdevice fsckoptions
/etc/mtab:--- To check the mounted file system information
/proc/mount:--- Mounted File system Information.
/proc/stat:--- Detailed Statistics of the current system.
CONFIGRATION FILES FOR SWAP MANAGEMENT
/proc/swap - this is user to check the swap -- Swaps File Information.
CONFIGRATION FILES FOR USER MANAGEMENT
/etc/group:--- It stores the information about the group containing
groupname passwd gid secondary user information
/etc/passwd:--- this file stores the user information like
Username passwd uid gid comment homedirectory shell
/etc/shadow:--- this file stores the information encrypted passwd having the fields
Username passwd lastchange mindays maxdays warndays inactive days expiry days
reserved future
/etc/login.defs:--- it stores the default information of the user.
/etc/skell:--- it stores user all environmental variables files and these are copied from this
directory to the users all environmental variables files and these are copied from this
directory to the user’s home directory.
.bash_logout:--- is a user's logout ending program file. It will execute first whenever the
user is logged out.
.bash_profile:--- is the user's login start up program file. It will execute first whenever the
user is logged in. It consists of the user's environment variables.
.bashrc:--- This file is used to create the user's custom commands and to specify the
unmask values for that user's only.
.bash_history:--- It stores the logging information about the user.
/var/log/lastlog:--- log of last boot process.
/var/log/messages:--- log of messages produced by Syslog daemon at boot.
/var/log/wtmp:--- list login time and duration of each user on the system currently.
it stores all user login data. When using the last command it reads /var/log/wtmp and gives
us the out fields.
CONFIGRATION FILES FOR HARDWARE INFORMATION
/proc/meminfo:--- Memory Usages Information.
/proc/cpuinfo:--- CPU Information.
/proc/modules:--- Currently using the Kernel module.
/version:--- Linux Version Information.
/boot/vmlinuz:--- The Linux Kernel file.
/var/log/lastlog: log of last boot process.
/var/log/messages: log of messages produced by Syslog daemon at boot.
/dev/hda:--- Device file for the first IDE HDD (Hard Disk Drive).
/dev/hdc:--- Device file for the IDE CDROM, commonly.
/dev/null:--- A pseudo-device that doesn’t exist. Sometimes garbage output is redirected to
/dev/null:--- so that it gets lost, forever.
/etc/printcap:--- Printer Information.

CONFIGRATION FILES FOR JOB MANAGEMENT


/var/spool/cron:--- it is a cron tab file location.
/var/spool/at:--- it is at job location.
/var/log/cron:--- it is the log file location of cron at jobs.
/etc/cron.allow:--- To allow the cron jobs for specified users.
/etc/cron.deny:--- to allow the cron jobs for specified users.
/etc/crontab:--- to see the cron job list.
A shell script to run specific commands on a predefined time Interval. 7. /etc/exports:
Information on the file system available on the network.
CONFIGRATION FILES FOR SERVICE MANAGEMENT
/etc/ssh/sshd_config:--- it is secure shell configuration file (ssh).
CONFIGRATION FILES FOR NETWORK MANAGEMENT
/etc/host:--- to assign to a ip address.
/etc/hosts.allow:--- List of hosts allowed to access services on the local machine.
/etc/host.deny:--- List of hosts denied to access services on the local machine.
/var/www/html: It contains the web application coding file(index.html).
/etc/sysconfig/network-scripts/ :- It contains the network configuration file of a nic cards.
/proc/net/bonding/bond :- to check the bonding information active state or not.
CONFIGRATION FILES FOR DOMAIN NAME SERVER
/etc/yp.conf:---
/etc/named.conf:--- the main configuration file of the dns.
/etc/resolv.conf :- Detail information of name server information
(DNS server). Or Domain Name Servers (DNS) being used by the system.
CONFIGRATION FILES FOR BOOTING
/etc/grub.conf: grub bootloader configuration file.
/etc/init.d: Service startup Script.
/etc/lilo.conf: lilo bootloader configuration file.
/etc/rc.d: Information about run level specific script.

/etc/rc.d/init.d: Run level Initialization Script.


/etc/inittab: INIT process and their interaction at the various run levels.

/etc/issue: Allows editing the pre-login messages.

/etc/modules.conf: Configuration files for system modules.

/etc/motd: motd stands for Message Of The Day, The Message users get upon login.

/etc/profile:--- Bash shell defaults.

/etc/profile.d:--- Application script, executed after login.

/etc/securetty: Terminal list, where root login is possible.

/etc/termcap: An ASCII file that defines the behaviour of Terminal, console and printers.
/etc/X11: Configuration files of X-Windows system.

CONFIGRATION FILES UNDER /usr


/usr/bin: Normal user executable commands.
/usr/bin/X11: Binaries of X-Windows System.
/usr/include: Contains include files used by ‘c’ program.
/usr/share: Shared directories of man files, info files, etc.
/usr/lib: Library files that are required during program compilation.
/usr/sbin: Commands for Super User, for System Administration.

INTRODUCTION
BASIC Commands
#df –h It is showing file system, size, used, available, use%,
mounted

#df –h .{which file we want see To know the exact location of the file system.
we need to be in that path and
then execute this command.

#df –T Display the type of the file system

#df –t ext4 It will display only ext4 file system.

#cd Change of directory

#cd / Go to root

#dmesg Hardware information

#uptime Display load average, server login time

#pwd Present working directory.

#whoami Current user.

#who am I (#tty) Actual user or current terminal with user

#who It display how many user’s logged in

#who -b Last reboot time

#who –r (or) runlevel It display’s the runlevel

#ls -l To find out the list of directories and files.

“d” ----- this letter indicates directory.

“-“ ----- this symbol indicates file.

1.BASIC COMMANDS TO CHECK FILES OR DIRECTORIES


These are the basic commands of file management.
These commands are used to view the files in it.
COMMAND EXAMPLE / COMMENTS FOR MORE
SYNTAX DETAILS

#ls List of files Man the page of


ls ls

#ls -l Long list of files

#ls -la Long list of files along with hidden


files

#ls -ld To check for a particular file or


directory.to see the attributes of a
particular file or directory

#ls -i* Too see a list of all files or


directories starting with a
particular letter.

#ls -lR To see the tree structure of the


nested directories

#ls -a To see only hidden files

Long list files and sort by the


#ls -ltr modification time. Oldest placed
first.

TO VIEW THE SYSTEM DATE AND TIME


#date — To check server time and date.
Ex;-
[root@NANI-SYS-06-27-A ~]# date
Mon May 1 05:19:39 IST 2023
[root@NANI-SYS-06-27-A ~]#
#uptime —uptime of the machine or It is used to check server login time.
Ex:-
[root@NANI-SYS-06-27-A ~]# uptime
05:20:15 up 52 min, 3 users, load average: 0.00, 0.00, 0.00
[root@NANI-SYS-06-27-A ~]#
#hostname — to check host name.
Ex:-
[root@NANI-SYS-06-27-A ~]# hostname
NANI-SYS-06-27-A
[root@NANI-SYS-06-27-A ~]#
#uname -a — to check the host name.
[root@NANI-SYS-06-27-A ~]# uname -a
Linux NANI-SYS-06-27-A 2.6.32-696.el6.x86_64 #1 SMP Tue Feb 21 00:53:17 EST
2017 x86_64 x86_64 x86_64 GNU/Linux
[root@NANI-SYS-06-27-A ~]#
#who — To check user logs (or) user logged.
Ex:-
[root@NANI-SYS-06-27-A ~]# who
root tty1 2023-05-01 04:31 (:0)
root pts/0 2023-05-01 04:31 (:0.0)
root pts/1 2023-05-01 05:19 (10.10.0.66)
[root@NANI-SYS-06-27-A ~]#
#whoami — User Information.
Ex:-
[root@NANI-SYS-06-27-A ~]# whoami
root
[root@NANI-SYS-06-27-A ~]#
#uname - r — Kernel information.
#arch — check the architecture (x86__ 64/32 bit)

COMMAND USED TO SCAN THE NEWLY ADDED DISKS.


#echo “- - -” > /sys/class/scsi_host/host0/scan
COMMAND USED TO CHANGE THE HOSTNAME
#vi /etc/sysconfig/network
#hostname <newname> don’t use.
COMMAND USED TO CHANGE IP ADDRESS

#vi /etc/sysconfig/network-scripts/ifcfg-eth0/
#ifconfig -a —network interface to check ip address.
Service network restart :- to reset the ip address

FIND COMMAND
#find /var -xdev -type f -ls|sort -rn --key=7|head -20

BASIC COMMANDS IN FILE MANAGEMENT


CREATING FILES AND ADDING DATA USING CAT COMMAND man
#cat > <filename> — to create a file along with some data .(don’t use it, it will
over right previous data and it will create an empty file.)
— ex:-
[root@vara-sys-1-6-A Desktop]# cat > hari
I am hari vasanth
{now press ctrl+d to save}
[root@vara-sys-1-6-A Desktop]#
#cat >> <filename> — to add/append the data to the past file.
— ex:-
[root@vara-sys-1-6-A Desktop]# cat >> hari
I am hari vasanth
I want to go to lucknow.--- this is the line that appended the data.
{now press ctrl+d to save}
[root@vara-sys-1-6-A Desktop]#
— to check total data
[root@vara-sys-1-6-A Desktop]# cat hari
I am hari vasanth
I want to go to lucknow.
[root@vara-sys-1-6-A Desktop]#
—To merge the contents of two into a third file.
#cat hari chandu >> vicky – hari and chandu merged into vicky.
Ex:--
[root@vara-sys-1-6-A Desktop]# cat > hari
I am hari vasanth
{now press ctrl+d to save}
[root@vara-sys-1-6-A Desktop]#cat >chandu
I am chandu
{now press ctrl+d to save}
[root@vara-sys-1-6-A Desktop]# cat > vicky
I am vicky
{now press ctrl+d to save}
[root@vara-sys-1-6-A Desktop]# cat hari chandu >> vicky
[root@vara-sys-1-6-A Desktop]# cat vicky
I am vicky
I am hari vasanth
I am chandu
[root@vara-sys-1-6-A Desktop]#
VIEW COMMANDS
#cat <filename> — to view the file or read the contents of a file.---man page for cat
— ex:-
[root@vara-sys-1-6-A Desktop]# cat hari
I am hari vasanth
[root@vara-sys-1-6-A Desktop]#

# cat FILENAME Print the content of the provided file on the terminal

#head <filename> — view data from the top up to 10 lines. — man page for head
– if we use this command #head -n <filename> we have to keep a number in the
place of n. Then we view that number of lines.

# head -n 5 FILENAME This example displays the top 5 lines of provided file

By default the head utility displays the first ten lines of a file.

#tail <filename> — view data from the end up to 10 lines. — man page for tail
– if we use this command #tail -n <filename> we have to keep a number in the
place of n. Then we view that number of lines.
# tail -n 5 FILENAME This example will display the last 5 lines of the provided file

By default tail will show the last 10 lines of the file


# tail -f To continuously monitor the incoming log messages into
/var/log/messages /var/log/messages file in runtime

#less — command is used to check the file data.--manpage for less

# less When you want to view a file that is longer than one screen, you can use either the
FILENAME less utility or the more utility.

It will pause after displaying a screen of text

You can use keyboard arrow to navigate around the file to read the text

Press q to return to the shell

#more — command is used to check the file data.manpage for more


— by pressing the ENTER — we can check line by line.
— by pressing the SPACEBAR — we can check page by page.l
# more more command is also similar to less but has few restrictions
FILENAME
We cannot use navigation arrow from the keyboard while reading with
more

You must use SPACE bar to scroll through the file

Press q to return to console

COPYING FILES AND DIRECTORIES


#cp <source> <destination/target> — It is used in 3 stages. Man page for cp
— step-1 – #cp messages /tmp/nareshins/ @If, I’m at the source location.
— step-2 – #cp /var/log/messages . — @If, I’m at the target / destination.
— step-3 – #cp /var/log/messages /tmp/nareshins/ — @If, I’m at the other
location.
c # cp SOURCE-FILE The cp (copy) utility makes a copy of a file. man page
p DESTINATION-FILE for cp
The SOURCE-FILE is the name of the file that cp
will copy.

The DESTINATION-FILE is the name cp assigns to


the resulting (new) copy of the file.

If the DESTINATION-FILE exists before you give a


cp command, cp overwrites it.

# cp This command copied myfile from /root to


/root/myfile /tmp/dir1 directory
/tmp/dir1/

RENAME COMMAND

#mv <old-name> <new-name> – This command used to change the name of the
file.
m # mv Changes the Name of a File man
v EXISTING- page
FILENAME for mv
NEW-FILENAME The mv (move) utility can rename a file without making a
copy of it. The mv command line specifies an existing file
and a new filename using the same syntax as cp

# mv In this example we rename the name of debug.log file to


/root/debug. new_debug.log and also changed the location of the file
log from /root/ to /tmp
/tmp/new_deb
ug.log

FILTERS

#grep “keyword” <filename>— grep is used to search the line (or ) sentence in a
huge amount of data.
— -i — case sensitive ( if we enter -i will get output either lower case & upper case
also )
— -iw — case sensitive , exact word. (if we enter -we will get the exact output word
in a file).
— -iv — if we don’t want the line (or) word in a particular file we use -v.
— -n — it is used to show the number in format.
The filters are used to sort the data in a file if data is very huge in amount. | pipe is
used for the filters.
Ex:-
#ls -l | grep -i “o” ifcfg-eth0
#ls -l |more.
re # grep The grep utility searches through one or more files to see man page
p STRING whether any contain a specified string of characters. for grep
FILENAME

This utility does not change the file it searches but simply
displays each line that contains the string.

# grep In this example we search for all the lines containing


ssh "ssh" in /etc/services file
/etc/servic
es

#df -h — To check file systems — how to check file systems or no of file systems
and mounted file systems.
du -l

Du -lrth
Du -lh

#pwd — to check the present working directory.

pwd # pwd present working directory man page for pwd

#init 6 — reboot.
#init 0 — shutdown
Ctrl +b — start up
Ctrl +e — shutdown
ctrl +j — suspend
Ctrl +r — restart

CREATE A DIRECTORY or FOLDER


#mkdir directory name>— Create a directory — It used to create a directory.
—m — it used to give owner permissions directly when we created a directory.
Ex:--
[root@vara-sys-1-6-A Desktop]# mkdir -m 777 hari
[root@vara-sys-1-6-A Desktop]#ls -ld
drwxrwxrwx 2 root root 4096 march 08:38 hari
—p — It will give path help to create path directory creation.
#mkdir -p varains/dir1/dir2/dir3/dir4/dir5…..continous how much we need.
—v
—Z
— Creating a multiple directories –
#mkdir dir1 dir2 dir3 dir4

— To Create nested directories (sub directories inside directories) –

mkdir # mkdir DIR Create directories man page for mkdir

CREATING 0 byte (empty) FILES USING TOUCH COMMAND


#touch <filename>— It is used to create an empty file. Man page for touch
— Creating multiple 0 byte (empty) files using touch command —
#touch file1 file2 file3 …. Infinite number files depend on the space.
— To change the time stamp ( date & time of modification) of a file or directory —
#touch -t YYYYMMDDhhmm <filename >

touch # touch FILE Create empty file man page for touch

Navigation or cd commands:
#cd — To go into a directory or change directory —(move to users home
directory) if we enter cd it goes to the home directory.
#cd .. — It is used one step back for the directory.
#cd ../.. — It is two steps back from the directory.
#cd - — it helps to go the previous path.(swap)

COMMANDS TO CHECK FILE OR DIRECTORY SIZE


#du -sh — used to check only output data.(it shows in human readable)
#ls -lh — use to check occupied data(it not only for occupied data, and also file or dir
, and etc)
#wc -l — to check the number of files in the directory.
l - it is for no. of lines.
c - no of characters.
w - no words.

TO DELETE AN EMPTY DIRECTORY


#rmdir <filename> — It is used to delete an EMPTY directory.
TO DELETE AN EMPTY FILE
#rm <filename> — It is used to delete files.
— ex:
[root@vara-sys-1-6-A Desktop]#rm file1
rm: remove regular file ‘file1’?y
[root@vara-sys-1-6-A Desktop]#
TO DELETE A FILE OR A DIRECTORY
#rm -rf <FILE OR DIRECTORY>— delete command. If u given “ * ” it will erase
entire data
OPTIONS:-
r— recursive
f — forcefully

Vi editor

#vi <filename> — By using this command we can create a file , view the
data, append the data, modify the data.
INSERT MODE:

i — Goes to insert mode.


a — Goes to insert /append mode.
o — Create a new line under the Cursor.
O — Create a new line top of the Cursor.

EXECUTE MODE:

w — Save.
wq — save & quit.
wq! — save & quit forcefully.
q — quit without save.
q! — quit without saving forcefully.
set nu — Display number of lines.

COMMAND MODE:

yw – Copy word.
yy – Copy line.
3yy – Copy 3 lines.
p — Paste.
cc — Remove the content of the line and create an empty line.
dd – Delete line.
dw – Delete word.
cw – change word.
x – Delete character.
r — Replace character.
R – Replace line.
u – Undo last change.
U — undo last change line.
^ — Position cursor at start line.
$ — Position cursor at end line.
gg — move to the top of the screen.
M - middle of the screen
G — move to the end of the screen.

HOW TO CREATE A PERMANENT FILE SYSTEM

STAGE -1 — LUN ADDING — HARD DRIVE.


First we have to check for the hard drive created. If it is not created we have to
create a hard disk by right clicking on the top of the name (vara.sys) .Then we have
open settings then we have to add the disk.

CLICK ON THE SETTINGS


CLICK ON THE ADD

1. Add the hard disk .

2. Select the disk type.


3. Create a new virtual disk

4. Specify the disk size

5. Specify the disk file location

STAGE –2:---LUNSCAN — scan the hard drive.


The lun (hard drive) has to be scanned by the command.

After the scanning the lun the logical name will be created.
STAGE –3 — FIND THE DISK —Check the disk created or not.
By using #fdisk -l we check whether the disk is created in the required order or not.

STAGE –4 — DISK PARTITION


By using #fdisk <disk name> (/dev/sdb)we have to create a partition.
P - print the partition
n – new partition.
P,e - primary and extended partitions
d – delete partition.
w — save partition.
STAGE –5 — CREATING A FILE SYSTEM
By using this command #mkfs -t ext4 <disk name>(/dev/sdb)

STAGE –6 — CREATING A MOUNT POINT


By using this command #mkdir /mount point name (/sbi1)

STAGE –7 — MOUNTING THE MOUNT POINT TO THE FILE SYSTEM


By using this command #mount -t ext4 <disk name>(/dev/sdb) /<mount point
name> (/sbi1) we have to mount the partition file to the directory that we create.

STAGE –8— CHECK THE MOUNTED THE MOUNT POINT WHETHER


IT MOUNTED CORRECTLY OR NOT
By using this command #df -h we can check the mount point whether it is mounted
correctly or not.
STAGE –9— PERMANENT THE MOUNT POINT TO THE FILE
SYSTEM
By using the command #vi /etc/fstab we have to open the fstab entries and we keep
the data. Then, it will not disappear when we shutdown/reboot the server.

The disk partitions defined and/or created during the installation are
configured to be automatically mounted whenever the system boots.
However, what happens when additional disk drives are added to a system
after the installation is done? The answer is "nothing" because the system
was not configured to mount them automatically. However, this is easily
changed.

The answer lies in the /etc/fstab file. This file is used to control what file
systems are mounted when the system boots, as well as to supply default
values for other file systems that may be mounted manually from time to
time.
STAGE –10— umount /mount point /sbi1///
The #umount -a read from mtab entries details info
STAGE –11— mount /mountpoint /sbi1
The #mount - a reads fstab entries details info
STAGE –12— df -h /mountpoint /sbi1
The #df -h reads mtab entries
STAGE –13— ACCESSING THE PARTITION DISK
By using this command #cd /MOUNT POINT(sbi1)
*****

How to find a free disk / partition system.

#mount -t ext4 /disk /mnt – if we want to check whether any mount file created disk
or not - we have to check with a temporary mount point- the /mnt is used for
temporarily if we mount also there will be no problem.
How to find whether the file system was created for a disk or not.
By using the command #blkid we check if the file system was created to a disk or
not.
How to check file system type(fs type) .
By using the command #df -Th we can check file system type, which type it is
created on disk.
How to change owners?
By using the command #chown <new owner name> :<gid> <path> we can
change the ownership of the particular file or directory.
● We can give the one user in one group but we can change the group with
another group.
Ex:
[root@NANI-SYS-26-13-B ~]# chown bhanu:9000 /home/bhanu
[root@NANI-SYS-26-13-B ~]# ls -ld /home/bhanu
drwx------ 4 bhanu chch 4096 Apr 25 14:21 /home/bhanu
[root@NANI-SYS-26-13-B ~]#
How to give owner permissions?
#chmod 644 file
By using this command we can give the owner permission. And also we tell the file to
who can access this particular file.

How to create a user?76


Stage –1 First we have to create the group, by using the command#groupadd -g
<groupid> <groupname>
Ex:-- #groupadd -g 2300 23a
Stage –2 Second we have to create user #useradd -u <userid> -g <groupid> -d
<user home directory> -s <shell> <username>

–USER ADMINISTRATION–
#useradd <username> or useradd <option> <argument> <username>
OPTIONS:
- u —UID - c —Comment - g —Primary Group Name or GID
- c —Comment - o —Override -s —Shell
- G — Secondary group - M — without home directory.
Ex :-- #useradd -u 2301 -g [2300 or 23a] -d /home/bobby -s /bin/bash bobby
#useradd -u 2301 -g [2300 or 23a] -M -d /home/bobby -s /bin/bash bobby
—/etc/passwd -every user information will be stored in this file.
Ex:- [root@NANI-SYS-1-6-A ~]#cat /etc/passwd
[root@NANI-SYS-1-6-A ~]# cat /etc/passwd |grep -i hari
hari:x:2306:2300::/home/hari:/bin/bash
[root@NANI-SYS-1-6-A ~]#

Stage –3 Check whether the user created or not. #id -a <username>


Ex :-- #id -a bobby

-TO ASSIGN OR RESET THE PASSWORD FOR A USER-

Stage –4 Creating the password for the user #passwd bobby then we have to
enter password for two times.
Ex :-- #passwd bobby
Changing password for the user bobby.
New password:
Retype new password:
Passwd: all authentication tokens updated successfully.
#passwd <username> or <option> <username>
OPTIONS:
- S — status of the lock - l — lock the password
- u—unlock the password - x <number> –we have to mention the expiry
date, if we mention -1 in the place of number it says that unexpire user.
—/etc/shadow —every user password information will be stored in this file. It will be
stored in encrypted format.
Ex:- [root@NANI-SYS-1-6-A ~]# cat /etc/shadow
[root@NANI-SYS-1-6-A ~]# cat /etc/shadow|grep -i hari
hari:!!$6$iVqNqTwu$/sKxWgSVSLja/
LCUxt4ux2gSK3IIKsqy.oLAIlTdnzzm7oYTwOwEVuOJfGv3uRPJ6tUsaytf6ZmIhc2CL
TmQC0:19432:::2:::
[root@NANI-SYS-1-6-A ~]#
—chage <username> or <option> <username> {CHANGE AGE}—it is to view
and edit the permissions.
OPTIONS:
- l — list of all above parameters.
Ex: [root@NANI-SYS-1-6-A ~]# chage -l hari
Last password change : Mar 16, 2023
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : -1
Maximum number of days between password change : -1
Number of days of warning before password expires :2
—/etc/login.defs –default permission of the passwd settings are available at this
file.
-HOW TO CHANGE SECONDARY GROUP-
#usermod -G <group id> <username> –it is used to add a second person in the
group.
To check the second person #cat /etc/group.
Ex :[root@NANI-SYS-1-6-A ~]# cat /etc/group|grep -i hari
lsg:x:6800:tom,mendis,haris,levi,rony
[root@NANI-SYS-1-6-A ~]#

SWAP
Swap is an independent file system managed by kernel not by the
operating system or by the hardware.The swap is nothing but the extended
memory. We can use the hard disk as an extended ram.
The swap space is located on disk, in the form of a partition or a file.
Swap space in Linux is used when the amount of physical memory (RAM)
is full. If the system needs more memory resources and the RAM is full,
inactive pages in memory are moved to the swap space. While swap space
can help machines with a small amount of RAM, it should not be
considered a replacement for more RAM. Swap space is located on hard
drives, which have a slower access time than physical memory. Swap
space can be a dedicated swap partition (recommended), a swap file, or a
combination of swap partitions and swap files. But , it can also be set
afterward by using the mkswap and swapon commands

SWAP-IN: Moving data from Swap space to the main memory of the machine.
SWAP-OUT: Moving main memory contents to Swap disk when main memory space
fills up

How to Add Swap space?

● Sometimes it is necessary for the 1gb or 1gb ram install system. As per
the above recommended swap space condition we have add 4gb [2
times greater than the swap size].
Stage-1 ADD LUN OF 4GB
RIGHT CLICK ON THE TOP SCREEN.
CLICK ON THE SETTINGS
ADD THE NEW LUN
CLICK ON OK
Stage-2 SCAN THE LUN
#echo “- - -” > /sys/class/scsi_host/host0/scan
Stage-3 CHECK THE LUN WHETHER ADDED OR NOT
#fdisk -l
Stage-4 MAKE FILE SYSTEM OF SWAP
#mkswap <disk name>
Stage-5 UPDATE THE SWAP
#swapon <disk name>

Checking commands for swap:


● swapon -s how many devices are added in swap.
● free -m how much space is there in swap shows (mb).
● free -g how much space is there in swap shows in (gb).
● free -k how much space is there in swap shows in (kb).
● free -h how much space is there in swap shows in (human readable).
How to add swap:
● Add a lun
● Scan the lun
● Make partitions use fdisk /<device name>
● mkswap /device name
● swapon /device name
● Entries Vim /etc/fstab
● swapon -a :swapon all
● swapoff -a : swapoff all

How to check the user in how many groups?


Switch to the user — su - <user name>
–# groups
[root@NANI-SYS-06-27-A ~]# su - mendis2
[mendis2@NANI-SYS-06-27-A ~]$ groups
sl lsg
[mendis2@NANI-SYS-06-27-A ~]$

TRADITIONAL FILE SYSTEM DISADVANTAGES


● We cannot create n number of partitions & file system on the single Hdd ( i.e only 59)
● We cannot combine 2 (or ) more disks as a single file system.
● We cannot extend the file system (increase)
● We cannot provide read /write performance as per customer requirement.
● We cannot provide high availability of the filesystem ( continuous performance ).
On LVM
● we create n-number of partitions & filesystems on the single Hdd.(i.e only 59).
● We can combine 2 or more disks as a single file system.
● We can extend the file system (increase)
● We can provide read é write performance as per customer requirement.
● We can provide high availability of the file system( continuous performance) .

INSTALLATION OF PACKAGES USING RPM(REDHAT


PACKAGE MANAGEMENT)
RPM stands for Red Hat Package Manager. The most famous utility of
package management for Red Hat-Based systems such as Fedora, CentOS
and RHEL. The tool permits system uses and administrators for the installing,
updating, uninstalling, querying, verifying, and managing system software
packages in linux operating system
If you want to install from CD or DVD go to packages located generally in the
/media/RHEL-7.9\ Server.x86_64/ folder.
1. How to install or upgrade an RPM package
Environment :-
● Red Hat Enterprise Linux 6,7,8,9.
To install an RPM package you must first have the RPM package.we can get
products by choosing the RPM package search in the browser.
There are two main option of #rpm command that are used to install or
upgrade RPM packages:
● -i is used to install a new package. Always use this for kernel installation
and upgrades just in case.
● -U is used to upgrade an RPM package but will also install a package
that does not exist in the RPM packages .
By using an additional option can be found in the RPM man page.
QUERY AND VERIFYING PACKAGING OPTIONS
● -v is used to print verbose information - normally routine progress
messages will be displayed.
● -V is used to verify the package's information about the installed files in
the CD OR DVD.
● -l list files in package.
● -a all installed packages.

ERASE OPTIONS
● -e |-- erase erase option.
● - - nodeps don’t check dependencies packages before uninstalling the
packages.
● -q query
● -f find the file – used to check in which packages the command.
Ex: rpm -qf /sbin/fdisk or #which fdisk
- - last used to check the last installed package.
Cd /var/www/html.
PATCHING
There is a version and release for every version. For example: RHEL
6.9 the 6 – version 9 is release. For every version the vendor rearranges the
security issue and corrects the mistakes like security , performance , bugs
fixes.
If they have a security issue they will release another version
immediately with a new update. Like 6.0,1,2,3,4,5,6,7,8,9,10.
This process they called OS patching / kernel upgrade.
The patching is two types
1. Reboot patching
2. Hotpatching
REBOOT PATCHING : [firmware(update)+os patching]
We have to shutdown the server after the patching. Needs 2 to 3 hours
or more to install the patches .
The reboot patching may be done yearly once.
STEP–1: Shut down apps/db(database)
STEP–2: Apply patches (os/firmware)----- patch script
STEP–3: reboot
STEP–4: Start applied db(database)
If any file is deleted for the server. If we added the data after deleting it.
We can't retrieve the file.(if back file also deleted)
Log is activity of the server /var/log – all activity
HOTPATCHING:
We do not need to shutdown the server after the patching. It is a live
patching. It is mostly kernel patching and having 0 down time.
---------------------
Patching servers as a way to update linux systems and keep them
secure. As new vulnerabilities are recognized , software developers release
fixes, available via update. It’s imperative that these patches are applied to
keep data secured. And to minimise the risk of malicious impacts.
As we know for every version there will be updates released by the product
vendors.
Major reasons for the patching of the kernel is bugs, issues, performances &
security bugs /vulnerability.
If the vendors got security patches named RHSA (RED HAT SECURITY
ADVISORY) the vendors will fix the security issues and release the new release.
Advisors are pieces of metadata that tie an update to a human-readable
description. These advisors are created by Red Hat engineering when they generate
a new package and are published on the RED HAT CUSTOMER PORTAL.
Advisories come in three types:-
● Red Hat Security Advisory ( RHSA) : RHSAs contain one or more security
fixes and might also contain bug or enhancement fixes.RHSAs are generally
considered the most important type of errata for many organisations. RHSAs
are ranked using a severity rating of low, moderate, important or critical based
on the severity of the vulnerability.
● Red Hat Bug Advisory (RHBA) : RHBAs always contain one or more bug
fixes and might contain enhancements, but do not contain security fixes.
Because RHBAs are released for bug fixes, they are often considered more
important than an RHEA in priority.
● Red Hat Enhancement Advisory ( RHEA) : RHEAs contain one or more
enhancements or new features and do not contain bug fixes or security fixes.
Essentially, a RHEA is released when new features are added and an
updated package is shipped.
Red Hat commits to generating errata advisories for different products based on
public lifecycle policies.

RUNLEVELS & SERVICES


A runlevel is an operating state on a unix and Unix-based operating system that is
preset on the linux-based system. The runlevels are numbered from zero to six.
Runlevel determines which programs can execute after the OS boots up. The
runlevel means the state of the machine after boot.

OS means the operating system that travels from the first factor of the disk
called OS.
OS—[GUI+APPS+TOOLS+KERNEL]
OS means the combinations of GUI,APPS,TOOLS,KERNEL.]
User is — version ex;-6.8,6.9. Admin is — only the kernel version.
*** INIT — It is the first program . it loads the stages of the Runlevels.
Three services will be added in the one runlevel to another runlevel.
These are the commands to check which runlevel i am in.
● Runlevel
● Who -r
One runlevel to another runlevel services will be increased.
if , I am in at the stage of #init 3 . I changed the runlevel 3 to 5 then changed the
command user interface to graphical user interface.
The INIT configuration file presents at the /etc/init/control-alt-delete.conf

Runlevels
#init 0 — Power off
#init 1 — Single user/resume mode
#init 2 — multi user
#init 3 — multi user with NFS {NETWORK FILE SYSTEM}
#init 4 — not in use
#init 5 — x11 –GUI
#init 6 — reboot
The OS is installed for usage of apps +service +users

PROCESS MANAGEMENT
Process means a running program in execution. If there is any application
going on there are some services running for each service there will be some
processes running in the background for each service.
It generally takes an input, processes it and gives us the appropriate output.
There is two types of processes:
1. Foreground processes: this names another interactive process. These
are the processes that are executed by the user. They are not initiated
by the system services. These processes take input from the user and
return the output. But the major disadvantage is when new processes
run directly in the terminal. We cannot do another process in the same
terminal.
2. Background processes: this is named another non-interactive process.
These processes are executed or initiated by the system itself or by the
users. Although these processes can be managed by the user. These
processes have a unique process id {PID} and parent process id
{PPID}. Then it is easy for the user and the system to run other
commands or the tasks in the foreground. In parallel the other
background processes running in the background.
As all know the parent process id and the process id will be assigned by the
kernel.
These are kernel major operations:
● MEMORY MANAGEMENT
● DISK MANAGEMENT
● SECURITY MANAGEMENT
● PROCESS MANAGEMENT
There are two types of processes running in the operating system:
1. Process
2. Daemon
PROCESS: The process starts the task and after the completion of the task it
will exit. It’s not continuous service. It is also called a foreground process.
DAEMON: Daemon are all names or it said continuous service. If the activity
occurred, it run’s the task and after compilation of the task it will go to sleep
mode. If there is no task it will be there in sleep mode.
It will be represented as a “ d” letter in the end.

The kernel assigns some PID ‘s for the process running in the system
depending on the task given by the user.
There is a tree chain link created by the kernel for the processes depending
on service and the applications running on the system.
These PID and PPID numbers are assigned randomly depending on the task
and the processes. In case the process is completed the pid will be allocated
another process that is not comparable to before one.
The PID and PPID lifetime is up to the task completion or up to the reboot.
What does the kernel do?
It creates a [PID] under the [PPID], where it performs the process of a
program to the operating system on the processor.
Every [PID] has a group id named as [PPID]. As we call PID is a child for the
PPID. “ There are a bunch of processes having different [PID] running for the
single service that have the same [PPID] because the processes are running
for the same application in the system”.
In case, if we delete the [PPID} all the children will become orphans .
In case, if we delete the child[PID] the parent process id [PPID] will allocate a
new PID number for the deleted child. Although the child is there in the
system.
In some scenarios for the [PPID] deleted. When we check the status of the
service. It comes as the service is dead. The child will not be deleted until the
system reboot.
No longer will child services harm the system. But, it will occupy space in the
system when it reaches the high occupancy in the system. The server will
hang up. If we reboot the server automatically the server deletes the
undeleted child processes.

LAB
#sleep 100
1. In this case, the name of the processes is sleep 100 but you may
change the same as per your need.
2. For stopping a process in between its execution. To stop the foreground
process in between of its execution we may press CTRL+Z to force stop
it. Pressing CTRL+Z in between the execution of the command will stop it.
#sleep 100
^Z
[1]+ stopped sleep 100
#
3. To get the list of jobs that are either running or stopped.
It will display the stopped processes in this terminal and even the pending ones.
#jobs -l
[1] + stopped sleep 100
#
4. To run all the pending and force stopped jobs in the background.
This will start the stopped and pending processes in the background.
#bg
[1]+ sleep 100 &
#
5. To get the details of the process running in the background.
#ps -ef |grep -i sleep

● A volume whose subdisks are arranged both


sequentially and contiguously within a plex.
Concatenation allows a volume to be created
from multiple regions of one or more disks if
there is not enough space for an entire volume
on a single region of a disk.

HOW TO CHANGE THE NETWORK INTERFACE


ETH1 TO ETH0 WITHOUT REBOOT SYSTEM IN A
RUNNING SERVER?
Changing the network interface from eth1 to eth0 while the system is

running can be tricky, as it involves modifying the network configuration

files and wan’t to restart network services.

The general procedure to change the interface name:-

1. We have to check current network interface name by running

commands #ifconfig -a or ip link show after identifying the present

network interface whether {eth1 or eth0 or e.t.c}. We have to see the

present HWaadr {hardware address} of the running server & we

have to note it separately.

2. After checking the network interface lets down the present

network interface by the command :

#ip link set <present network- interface name> down

NOTE: if we at the normal user we have to use sudo or we have be in the

root then it is possible to use this command.

3. After the downing the present interface name we have to

update the name in configuration file :

We have to update udev rules: udev is responsible for assigning

names to the network interface based on their MAC address .


#vim /etc/udev/rules.d/70-persistent-net.rules

4. After changing in the configuration file we have to up the server

the changed network interface or we have to restart the network

service

#ip link set <changed network interface name> up

We have to restart the network using the command

#systemctl restart network

Or

#service network restart

5. Verifying the changes : after restart the network services verify the

interface whether the changed name is running or not . by using this commands

#ifconfig -a or #ip link show the interface should be a newly changed network

interface name.

LOGICAL VOLUME
Lvm means LOGICAL VOLUME MANAGEMENT. The combination of 2 or more

physical disks in order to make a big logical disk is named as logical volume.

● Lvm used to manage the disk volume on the linux servers.


● Lvm allows disks to be combined together (or called simply have
flexible capacity)

● Lvm allows the creation of a number of file systems on the single hard
disk.

● Lvm allows the file system to extend the space.


● Lvm gives us read /write performance as per the client requirements.
● Lvm provides high availability {continuous performance} of the file
system.
If a normal partition is filled and an application requires the same or more

disk space. The normal partition cannot be extended for that application

requirement. For this first we have to take a backup of that normal

partition , then delete the partition and again will create the partition with

more disk space , then format the disk and mount the partition and finally

restore the application from the backup. The process requires the down

time.

So, to overcome the problem the LVM concept is used. It is used to extend

or reduce the file system as per the client requirement without of anydata.

COMPONENTS OF THE LVM

1. PHYSICAL VOLUME [PV]

2. PHYSICAL EXTENT [PE]

3. VOLUME GROUP [VG]

4. LOGICAL VOLUME [LV]

5. LOGICAL EXTENT [LE]

1.PHYSICAL VOLUME [PV]:


It is a standard partition that we add to the LVM. Normally a physical

volume is a standard primary or logical partition with the partition code as

8e.

2.PHYSICAL EXTENT [PE] :


It is a chunk of disk space. Every physical volume is divided into a number

of equal sized PE’s.

3.VOLUME GROUP [VG] :


It composed a group of physical volumes and logical volumes .it is named as

organised with physical volume as a group for LVM.

4.LOGICAL VOLUME [LV] :


It is composed with a group of LE’s. We make logical volumes and format

the lv. And create a filesystem and mount the filesystem with a mount point.

The logical volume can easily increase or decrease as per the requirements.

5.LOGICAL EXTENT [LE] :


It is a chunk of disk space .Every logical extent is mapped to a specific

physical extent.

Operation that we can do using LVM:

1. Flexible capacity : – The file system can extend across multiple

disks. Since we can aggregate disks and partitions in a single logical

volume.

2. Resizable storage pommels : – it can extend logical volume or

reduce logical volume size with the simple commands. We can re-

formatting or re-partionable underlying disk devices.

3. Online data relocation : – dep

How to create the LVM, and make a filesystem


and mount the mount point permanently ?
1. Take two physical disks. For example /dev/sdb and /dev/sdc

. if there is no second disk then make the required partition using

#fdisk command and change the partition code as 8e.

2. Convert the physical disk into physical volumes by,

#pvcreate /dev/sdb /dev/sdc

3. Then create the volume group by combining physical volumes

by,

#vgcreate <volume group name> <physical volume name> or

#vgcreate -s <PE size in MB’s> <volume group name>

<physical volume name>

4. Then create the logical volume on the above created volume

group by,

#lvcreate -L +<size in MB’s>{M/G/K/T..} -n <logical volume

group> <volume group name>

Or

#lvcreate -l +<no. of PE’s> -n <logical volume group>

<volume group name>

5. Make the file system on the above created logical volume by,

#mkfs -t ext{2..4}/xfs /dev/<volume group name>/<logical

volume name>

6. Create a mount point to the above created LVM file system by,

#mkdir /mnt/<directory name>

7. Mount the LVM on the above created mount point temporarily

by,
#mount /dev/<volume group name>/<logical volume name>

<mount point>

8. Mount the LVM on mount point permanently by,

#vim /etc/fstab

/dev/<VG name>/<LV name> /mnt/<directory name>

<fs type> defaults 0 0

Esc + :wq!

#mount -a

#df -h {to see the mounted partition with the filesystems}

HOW TO SEE THE DETAILS OF THE PHYSICAL VOLUME?

#pvs {Displays all physical volumes with less details}

#pvdisplay {Displays all physical volume with more details}

#pvdisplay <physical volume name> {Displays the details of the

specified physical volume}

#pvscan {To scan all the physical volumes}

#pvscan <PV name> {To scan the specified physical volume}

HOW TO SEE THE DETAILS OF THE VOLUME GROUPS?

#vgs {Displays all volume groups with less details}

#vgdisplay {Displays all physical volumes with more details}

#vgdisplay <VG name> {Displays the details of the specified volume

group with more detail}

#vgscan {To scan all volume groups}

#vgscan <VG name> {To scan the specified volume group}

HOW TO SEE THE DETAILS OF THE LOGICAL VOLUME?

#lvs {Displays all logical volumes with less details}


#lvdisplay {Displays all logical volumes with more details}

#lvdisplay <lv name>{Displays the specified logical volume details}

#lvscan {To scan all the logical volumes}

#lvscan <LV name> {To scan the specified logical volume}

Raid levels
RAID (Redundant Array of Independent Disks) is a data storage technology that combines

multiple physical disk drives into a single logical unit for improved performance, data redundancy, or both.

There are several RAID levels, each with its own characteristics and benefits. Here are some commonly

used RAID levels:

1. RAID 0 (Striping): Data is divided across multiple drives in stripes without redundancy. It offers
improved performance by distributing data across drives, but there is no fault tolerance. If one
drive fails, data loss occurs.
2. RAID 1 (Mirroring): Data is mirrored across two or more drives. It provides redundancy, as all
drives contain identical data. If one drive fails, data can be retrieved from the remaining drives.
3. RAID 5 (Striping with Parity): Data is striped across multiple drives, and parity information is
distributed across all drives. Parity information allows for data recovery in case of a single drive
failure. RAID 5 requires a minimum of three drives.
4. RAID 6 (Striping with Double Parity): Similar to RAID 5, but with two sets of parity information.
RAID 6 can tolerate the failure of two drives simultaneously, providing higher fault tolerance
compared to RAID 5. RAID 6 requires a minimum of four drives.
5. RAID 10 (RAID 1+0): It combines mirroring (RAID 1) and striping (RAID 0). Data is mirrored
across multiple pairs of drives and then striped across the mirrored pairs. RAID 10 offers both
performance and redundancy, but it requires at least four drives.
6. RAID 50 (RAID 5+0): It combines striping (RAID 0) and RAID 5. Data is striped across multiple
RAID 5 arrays. RAID 50 provides improved performance and fault tolerance but requires at least
six drives.
7. RAID 60 (RAID 6+0): Similar to RAID 50, but with RAID 6 instead of RAID 5. It combines
striping (RAID 0) and double parity (RAID 6). RAID 60 offers high performance and fault
tolerance, but it requires at least eight drives.

These are some of the commonly used RAID levels, but there are also other variations and hybrid RAID

levels available, each with its own advantages and considerations depending on the specific use case and

requirements.

What is RAID? What is the use of the RAID and how many types of RAIDs available?

RAID stands for Redundant Array of Independent Disks.


It provides fault tolerance, load balancing using stripping, mirroring and parity concepts.

There are mainly two types of RAIDs available.

(i) Hardware RAID (Depends on vendors and also more expensive)

(ii) Software RAID (Does not depends on vendors and less expensive when compared to

Hardware

RAID and also it is maintained by system administrators only.

How many types of software RAIDs are available and their requirements?

(i) RAID - 0 —

----- Concat ---- minimum one disks required.

---- Striping ---- Minimum 2 disks required.

(ii) RAID - 1 ---- Mirroring ---- Minimum 2 disks required

(iii) RAID - (1+0) --- Mirroring + Stripping ---- Minimum 4 disks required

(iv) RAID - (0+1) --- Stripping + Mirroring ---- Minimum 4 disks required

(v) RAID - 5 ---- Striping with parity ---- Minimum 3 disks required

How to configure RAID - 0 in Linux?

To configure RAID - 0, minimum 2 disks are required and the partition id is "fd".

Reading and writing is very fast. So, it produces high performance.

if one disk fails, we cannot recover the data.

So, there is no redundancy and fault tolerance in RAID - 0.

How to configure RAID - 1 in Linux?

To configure RAID - 1, minimum 2 disks are required and the partition id is "fd".

In this the same data will be written on 2 disks ie., exact copy on both the disks.

if one disk fails, we can recover the data from another disk.

So, there is a high availability, redundancy and fault tolerance in RAID - 1.

In this writing speed is slow compared to RAID - 0.

How to configure RAID - 5 in Linux?

To configure RAID - 5, minimum 3 disks are required and the partition id is "fd".

In every disk approximately 25 - 30% of space is reserved for parity.


Reading and writing is very fast. So, it produces high performance.

This is used in the Striping with parity concept.

If one disk fails, we can recover the data using the remaining two disks and parity.

If two disks fail, then we cannot recover the data.

So, there is no redundancy and fault tolerance in RAID - 5.

What are the main advantages of RAID - 5

RAID - 5 uses Striping with parity and requires only three disks. Because of Stripping the

data reading

and writing will be fast.And by using parity we can recover the data if one of the three

disks failed.

So, the main advantage of RAID - 5 we can get fast writing, reading and also redundancy

fault

tolerance with less expensive.

RAID LEVELS
RAID means REDUNDANT ARRAY OF INDEPENDENT DISKS.
It is a data storage technology that combines multiple disk drives
into a single logical unit for improving the performance ,data
redundancy or both.
There are two types of raid available. They are:
1.Hardware RAID : it depends on vendors . These are more
expensive to use.
2.Software RAID : it doesn’t depend on the vendors. These are less
costly to use.
RAID’s are maintained by the system administrator.
There are mainly 3 raid levels to discuss . they are
1.Raid 0
2.Raid 1
3.Raid 5
RAID 0
The raid 0 has two levels :
1. Linear / Concat
2. Stripe
Linear /concat:
● The linear level should have a minimum one disk to
create lvs.
● In this reading formance is high and writing formance is
low because in this linear level write the data parallel in
disks .
● It don’t waste the space and zero fault tolerance
Stripe:
● In striping data added across the multiple disks at the same
time by dividing the contents.
● so write performance is high , read performance is low.
● Assume if we have two disks and if we save content to logical
volume it will be saved under both two physical disks by
dividing the content.
● RAID 0 is used for better performance, but we can’t get the
data if one of the drives fails.
1. RAID 0 has High Performance.
2. Zero Capacity Loss in RAID 0. No Space will be wasted.
3. Zero Fault Tolerance ( Can’t get back the data if any one of disk
fails)
RAID 1:
RAID 1 is implemented with a mirror. It means an exact clone (or
mirror) of the data written in two drives.
A minimum two number of disks or more needed to create RAID 1
and it is useful only when read performance or reliability is more
precise than the data storage capacity.
Mirrors are created to protect the data loss due to disk failure.
When one disk fails, the same data can be retrieved from another
functioning disk. However, the failed drive can be replaced from the
running computer without any user interruption.
Features of RAID 1
1. Mirror has Good Performance.
2. 50% of space will be lost. Means if we have two disks with
500GB size total, it will be 1TB but in Mirroring it will only show us
500GB.
3. No data loss in Mirroring if one disk fails, because we have the
same content in both disks.
RAID 5:
In RAID 5, data strips across multiple drives with distributed parity.
The striping with distributed parity means it will split the parity
information and stripe data over the multiple disks, which will have
good data redundancy.
For RAID Level it should have at least three hard drives or more.
RAID 5 is being used in the large scale production environment
where it’s cost effective and provides performance as well as
redundancy.
Linux provides several tools for accessing files on remote systems
connected to the network.
Nfs stands for Network file system. Here it is used to share/mount the
hard disc through the network. An NFS server can export one or more
directories that can be mounted on a linux machine.
NOTE: that if you need to mount a linux filesystem on a windows
machine. You need to use Samba/CIFS instead.
Basically, NFS has the three NFS versions.
1.NFS v2
2.NFS v3
3.NFS v4
At present we were mainly using the NFS v4 for greater security with
allowed by the firewall. The network information service (NIS) maintains
Configuration files for all systems on a network.

What is FTP?
➔ FTP stands for the File Transfer Protocol.
➔ Ftp is a standard internet protocol provided by TCP/IP. And been
used for transmitting the files from one host to another.
➔ It is mainly used for transferring the web page files from their
creator to the computer that acts as a server for other computers
on the internet.
➔ It is also used for downloading the files to the computer from
servers.
It provides the sharing of files.
It is used to encourage the use of remote computers.
It is to transfer the data-more reliable and efficiently.
Why do we have to use FTP?
Basically, FTP has two types, one is data connection :it mainly transmits
the data from one host to another host. And, another one is control
connection : is used to secure the connection properly. Even if the two
systems are different and also the structure is different.
Find command and using of options

[root@vara-sys31-222 ~]# find /tmp


/tmp
/tmp/cc
/tmp/hero
/tmp/bb
/tmp/aa
[root@vara-sys31-222 ~]# find /tmp -print
/tmp
/tmp/cc
/tmp/hero
/tmp/bb
/tmp/aa
[root@vara-sys31-222 ~]# find /tmp -empty
/tmp/cc
/tmp/hero
/tmp/bb
/tmp/aa
[root@vara-sys31-222 ~]# find /tmp -not -empty
/tmp
[root@vara-sys31-222 ~]# find /tmp -name hero
/tmp/hero
[root@vara-sys31-222 ~]# find /var -name '*.gz'
/var/lib/redhat_access_insights/redhat-access-
insights-1.0.13.tar.gz
[root@vara-sys31-222 ~]# find /tmp -type f -name
cc
/tmp/cc
[root@vara-sys31-222 ~]# find /tmp -type d -name
hero
/tmp/hero
[root@vara-sys31-222 ~]# mkdir /tmp/VaRa
[root@vara-sys31-222 ~]# find /tmp -iname vara
/tmp/VaRa
[root@vara-sys31-222 ~]# find /tmp -perm 755
/tmp/hero
/tmp/VaRa
[root@vara-sys31-222 ~]# find /tmp -perm /g=s
[root@vara-sys31-222 ~]# find / -perm /g=s
/sbin/netreport
/bin/cgclassify
/bin/cgexec
find: `/proc/2657/task/2657/fd/5': No such file or
directory
find: `/proc/2657/task/2657/fdinfo/5': No such file
or directory
find: `/proc/2657/fd/5': No such file or directory
find: `/proc/2657/fdinfo/5': No such file or directory
/usr/sbin/lockdev
/usr/sbin/postqueue
/usr/sbin/postdrop
/usr/bin/wall
/usr/bin/write
/usr/bin/locate
/usr/bin/ssh-agent
/usr/libexec/utempter/utempter
/usr/lib64/vte/gnome-pty-helper
[root@vara-sys31-222 ~]# find / -perm /u=s
/sbin/unix_chkpwd
/sbin/mount.nfs
/sbin/pam_timestamp_check
/bin/su
/bin/ping
/bin/umount
/bin/ping6
/bin/mount
/bin/fusermount
/lib64/dbus-1/dbus-daemon-launch-helper
find: `/proc/2659/task/2659/fd/5': No such file or
directory
find: `/proc/2659/task/2659/fdinfo/5': No such file
or directory
find: `/proc/2659/fd/5': No such file or directory
find: `/proc/2659/fdinfo/5': No such file or directory
/usr/sbin/userhelper
/usr/sbin/usernetctl
/usr/sbin/suexec
/usr/bin/sudo
/usr/bin/gpasswd
/usr/bin/chfn
/usr/bin/crontab
/usr/bin/chsh
/usr/bin/ksu
/usr/bin/pkexec
/usr/bin/chage
/usr/bin/staprun
/usr/bin/at
/usr/bin/passwd
/usr/bin/Xorg
/usr/bin/newgrp
/usr/libexec/pt_chown
/usr/libexec/pulse/proximity-helper
/usr/libexec/abrt-action-install-debuginfo-to-abrt-
cache
/usr/libexec/openssh/ssh-keysign
/usr/libexec/polkit-1/polkit-agent-helper-1
/usr/lib64/nspluginwrapper/plugin-config
[root@vara-sys31-222 ~]# find / -perm /o=t
/tmp
/var/tmp
/var/cache/gdm
/var/spool/cups/tmp
/var/log/gdm
/var/lib/gdm
/var/lib/gdm/.gconf.path
/var/lib/gdm/.gconf.mandatory
/var/lib/gdm/.gconf.mandatory/%gconf-tree.xml
/var/gdm
/dev/shm
find: `/proc/2660/task/2660/fd/5': No such file or
directory
find: `/proc/2660/task/2660/fdinfo/5': No such file
or directory
find: `/proc/2660/fd/5': No such file or directory
find: `/proc/2660/fdinfo/5': No such file or directory
[root@vara-sys31-222 ~]# find /tmp -perm 644 -
type f
/tmp/cc
/tmp/bb
/tmp/aa
[root@vara-sys31-222 ~]# find /tmp -perm 755 -
type d
/tmp/hero
/tmp/VaRa
[root@vara-sys31-222 ~]#

LOGICAL VOLUME MANAGER

#pvcreate <diskname(/dev/sdb)> It create physical volume

Yum
Yum is to install the packages along with rpm it will ask the dependencies file to install
the packages. So, we use yum for no dependencies.
To check whether yum is configured in our server.
#yum repolist
We can configure the yum at #cd /etc/yum.repos.d/
Trusted Authentication
It is nothing but, if we tried to login without passwd from one server to another
server by using an automated key is known as trusted authentication.
Mostly , this trusted authentication was used in the same application deployed
server. This trusted authentication has not been done at one to another type of
application of a different application server. If we do that it leads to security
issues.
Where users can login by 2 ways one is with passwd and another one is with
using keys.
There are two types of keys generated. They are
Public key
Private key
Private key means the key. And the public key means the lock.
Vm-ware
Installation procedure for Vm-ware

Problems while installation of Vmware -ESXI


For deploying the Vm-ware-ESXI in vmware workstation we may get errors on

windows 11 and 11pro.

For deploy a server, most probably we have to click on VT-x/Pt


When we power on display a 64 bits vm from vmware workstation 16 hosted on a

windows 11 family edition . or windows 11 provision edition.

if , i got error message

Module ‘HV’ power on failed virtualized intel VT-x/EPT is disabled for this ESX virtual

machine. You will

V-center
First we need to turn on the system where the
vmware esxi machine.
And we

Step:--1: First , we need to login to VMsphere vsphere client.


With ip address and username and passwd.
Ex: IP address /Name:-10.10.1.201
Username:root
passwd:P@55w0rd
After login to the Vmware esxi server {10.10.1.250}
On left we can see the 10.10.1.250 ip address
:+:-- if we click on + symbol we can esxi machines.
Ex:-- vara-vc-01
vara-vc-02
vara-vc03
Step:03: We have power on the esxi machine vara-vc-01
—ip address/Name:10.10.1.201
–user:Administrator@vsphere.local
–password:-P@55w0rd
Step04: after login vara-vc-01{10.10.6.201}

After , right click {10.10.1.201} Create a data center.


After , right click we need to click on New data center or ctrl+D.

Step5:-- After creating the datacenter we need to click on the cluster that we added before or
ctrl+L

We can have new tab of New cluster Wizard –


–Cluster Features
The cluster handle several hosts
In cluster Features we get
Name of the New cluster
Turn On vsphere HA
The high availability detects failure before us and automatically provides a new cluster.
It has rapid recovery when it deducts the failure.
HA– having downtime.
HA– it is used to minimise the downtime.{Actice -Passive} mechanism – only one server has been activated.
It includes host of the virtual machine monitoring to minimise downtime when heartbeats cannot be deducted
Turn on vpshere DRS
We call DRS a distributed Resource service . Here drs help to manage the hosts and resources are used equally with all hosts
connected to the cluster.

You might also like