Tuesday, October 30, 2012

Sendmail Server Interview Questions And Answers

Q: - How to start sendmail server ?
service sendmail restart

Q: - On which ports sendmail and senmail with SSL works ?
By default, Sendmail uses TCP and UDP port 25 for non-encrypted transfers. If the Sendmail server is configured to use SSL for encrypting email sent and received, it uses port 465.

Q: - Explain use of "trusted-users" file ?
List of users that can send email as other users without a warning including system users such as apache for the Apache HTTP Server.

Q: - Explain the use of "local-host-names" file ?
If the email server should be known by different hostnames, list the host-names in this file, one line per hostname. Any email sent to addresses at these hostnames is treated as local mail. The FEATURE(`use_cw_fileĆ¢€™) option must be enabled in the sendmail.mc file for this file to be referenced.

Q: - explain the use of /etc/aliases file ?
/etc/aliases, can be used to redirect email from one user to another. By default, it includes redirects for system accounts to the root user. It can then be used to redirect all email for the root user to the user account for the system administrator.

Q: - Can we use SSL Encryption with Sendmail ?
Yes, Sendmail can be configured to encrypt email sent and received using SSL (secure sockets layer).

Q: - What is Sendmail ?
Sendmail is an MTA, meaning it accepts email messages sent to it using the SMTP proto-col and transports them to another MTA email server until the messages reach heir destinations. It also accepts email for the local network and delivers them to local mail spools, one for each user.

Q: - What is the role of MUA ?
An MUA (Mail User Agent) with access to the mailbox file, directly or through a network file system, can read messages from the disk and display them for the user. this is generally a console or webmail application running on the server.

Q: - Which are the important configuration files for Sendmail server ?
The /etc/mail/ directory contains all the Sendmail configuration files, with sendmail.cf and submit.cf being the main configuration files. The sendmail.cf file includes options for the mail transmission agent and accepts SMTP connections for sending email. The submit.cf file configures the mail submission program.

Q: - How to configure sendmail to accept mail for local delivery that is addressed to other hosts?
Create a /etc/mail/local-host-names file. Put into that file the hostnames and domain names for which sendmail should accept mail for local delivery. Enter the names with one hostname or domain name per line. And also make sure that Sendmail configuration file should contain "use_cw_file" option.
dnl Load class $=w with other names for the local host
FEATURE(`use_cw_file')

Q: - When an organization stores aliases on an LDAP server, how you will configure sendmail to read aliases from the LDAP server?
Use "sendmail -bt -d0" command to check the sendmail compiler options. If sendmail was not compiled with LDAP support, recompile and reinstall sendmail.
Add an ALIAS_FILE define, containing the string ldap  to the sendmail configuration.
# Set the LDAP cluster value
define(`confLDAP_CLUSTER', `wrotethebook.com')
# Tell sendmail that aliases are available via LDAP
define(`ALIAS_FILE', `ldap:')

Q: - How to forward emails of a local user to external address?
Add an alias to the aliases file for each user whose mail must be forwarded to another system. The recipient field of the alias entry must be a full email address that includes the host part. After adding the desired aliases, rebuild the aliases database file with the newaliases command.

Q: - You have been asked to create a sendmail configuration that sends all local mail to a mail hub, while directly delivering mail addressed to external systems.
Create a sendmail configuration containing the MAIL_HUB define to identify the mail relay host for local mail. Use the LOCAL_USER command to exempt the root user's mail from relaying.
dnl Define a relay server for local mail
define(`MAIL_HUB', `smtp.test.com')
dnl Users whose mail is not passed to the mail hub
LOCAL_USER(root)
Rebuild and reinstall sendmail.cf, and then restart sendmail.

Q: - How to  configure multiple mail queues?
mkdir /var/spool/mqueue/queue.1
mkdir /var/spool/mqueue/queue.2
mkdir /var/spool/mqueue/queue.3
chmod 700 /var/spool/mqueue/queue.1
chmod 700 /var/spool/mqueue/queue.2
chmod 700 /var/spool/mqueue/queue.3
Add the QUEUE_DIR define to the sendmail configuration to use the new queue directories.
dnl Declare the queue directory path
define(`QUEUE_DIR', `/var/spool/mqueue/queue.*')

Q: - How to  disable certain SMTP commands?
Add the confPRIVACY_FLAGS define to the sendmail configuration to set Privacy Options that disable unwanted, optional SMTP commands. Here we will disables the EXPN, VRFY, VERB, and ETRN commands.
dnl Disable EXPN, VRFY, VERB and ETRN
define(`confPRIVACY_FLAGS', `noexpn,novrfy,noverb,noetrn')
Rebuild and reinstall sendmail.cf, and then restart sendmail.

Q: - In which Sendmail configuration file we have to make changes?
we will make the changes only in the sendmail.mc file, and the changes will be moved into the sendmail.cf file for us.

Q: -  When Sendmail dispatches your email, it places the servers hostname behind your username, which becomes the "from address" in the email (ie. user@mail.test.com).But we want to use the domain name and not the hostname?
define(`confDOMAIN_NAME', `test.com')dnl
FEATURE(`relay_entire_domain')dnl

Q: - What does /etc/mail/access file contains?
The access database ("/etc/mail/access") is a list of IP addresses and domainnames of allowable connections.
FEATURE(`access_db',`hash -T<TMPF> -o /etc/mail/access.db')dnl
and cat  /etc/mail/access
localhost.localdomain      RELAY
localhost                              RELAY
127.0.0.1                             RELAY
192.168.0                            RELAY
test.com                              RELAY

Q: - How to restrict sendmail to sending a big file?
define(`confMAX_MESSAGE_SIZE',`52428800')dnl
or If you are using a PHP based webmail application like SquirrelMail, you can adjust the max file size in php.ini file.
vi php.ini
post_max_size = 50M
upload_max_filesize = 50M
memory_limit = 64M

Q: - How to set 25 recipients for each email?
define(`confMAX_RCPTS_PER_MESSAGE',`50')dnl

Q: - Which antivirus you have integrated with sendmail ?
ClaimAV

Q: - What is Clamav-Milter?
Clamav-Milter is a tool to integrate sendmail and clamAV antivirus.

Q: - Which configuration files are required to integrate sendmail and ClaimAV antivirus?
milter.conf and clamav-milter

Q: - How to test sendmail integration with ClaimAV?
grep Milter /var/log/maillog
You have to get following type of messages.
sendmail: Milter add: header: X-Virus-Scanned: ClamAV version 0.88.2, clamav-milter version 0.88.2 on mail.test.com
sendmail: Milter add: header: X-Virus-Status: Clean 

Q: - Which tool you have used to block spamming?
SpamAssassin

Q: - What does "/etc/mail/" directory contains?
The /etc/mail/ directory contain all the Sendmail configuration files, with sendmail.cf and submit.cf being the main configuration files.

Q: - Explain the use of /etc/mail/relay-domains file?
The /etc/mail/relay-domains file is used to determine domains from which it will relay mail. The contents of the relay-domains file should be limited to those domains that can be trusted not to originate spam.

Q: - What is the name of spamassassin configuration file?
/etc/mail/spamassassin/local.cf

Q: - How to check mail Queue of sendmail?
/usr/lib/sendmail -bp
or
mailq

Q: - How to use  m4 macro processor to generate a new sendmail.cf?
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

DNS Server Interview Questions And Answers



Q: - which are the important configuration files for DNS server ?
BIND uses /etc/named.conf as its main configuration file, the /etc/rndc.conf file as the configuration file for name server control utility rndc, and the /var/named/ directory for zone files and the like.

Q: - What is BIND ?
BIND stands for Berkeley Internet Name Domain which is the most commonly used Domain Name System (DNS) server on the Internet.

Q: - On which version of bind u have worked ?
BIND 9

Q: - What is the role of DNS ?
A DNS server, or name server, is used to resolve an IP address to a hostname or vice versa.

Q: - On which port DNS server works ?
DNS servers use port 53 by default. Incoming and outgoing packets should be allowed on port 53. Also allow connections on port 921 if you configure a lightweight resolver server. The DNS control utility, rndc, connects to the DNS server with TCP port 953 by default. If you are running rndc on the name server, connections on this TCP port from localhost should be allowed. If you are running rndc on additional systems, allow connections to port 953 (or whatever port you have chosen to configure) from these additional systems.

Q: - What is round robin DNS?
Round robin DNS is usually used for balancing the load of geographically distributed Web servers. For example, a company has one domain name and three identical home pages residing on three servers with three different IP addresses. When one user accesses the home page it will be sent to the first IP address. The second user who accesses the home page will be sent to the next IP address, and the third user will be sent to the third IP address. In each case, once the IP address is given out, it goes to the end of the list. The fourth user, therefore, will be sent to the first IP address, and so forth.

Q: - What is Name Server?
A name server keeps information for the translation of domain names to IP addresses   and IP addresses to domain names. The name server is a program that performs the translation at the request of a resolver or another name server.

Q: - What is Primary name server or primary master server?
Primary name server/primary master is the main data source for the zone. It is the authoritative server for the zone. This server acquires data about its zone from databases saved on a local disk. The primary server must be published as an authoritative name server for the domain in the SOA resource record, while the primary master server does not need to be published.

Q: - What is Secondary name server/slave name server?
Secondary name server/slave name server acquires data about the zone by copying the data from the primary name server (respectively from the master server) at regular time intervals. It makes no sense to edit these databases on the secondary name servers, although they are saved on the local server disk because they will be rewritten during further copying.

Q: - what is Root name server?
Root name server is an authoritative name server for the root domain (for the dot). Each root name server is a primary server, which differentiates it from other name servers.

Q: - what is Stealth name server?
Stealth name server is a secret server. This type of name server is not published anywhere. It is only known to the servers that have its IP address statically listed in their configuration. It is an authoritative server. It acquires the data for the zone with the help of a zone transfer. It can be the main server for the zone. Stealth servers can be used as a local backup if the local servers are unavailable.

Q: - What do you mean by "Resource Records"?
Information on domain names and their IP addresses, as well as all the other information distributed via DNS is stored in the memory of name servers as Resource Records (RR).

Q: - Explain "TTL"?
Time to live. A 32-bit number indicating the time the particular RR can be kept valid in a server cache. When this time expires, the record has to be considered invalid. The value 0 keeps nonauthoritative servers from saving the RR to their cache memory.

Q: - Tell me 5 Types of DNS records?
A, NS, CNAME, SOA, PTR, MX.

Q:- explain "SOA Record"?
The Start of Authority (SOA) record determines the name server that is an authoritative source of information for the particular domain. There is always only one SOA record in the file, and it is placed at the beginning of the file of authoritative resource records.

Q: - what is "A Record"
A (Address) records assign IP addresses to domain names of computers. The IP address cannot have a dot at the end.

Q: - Explain "CNAME Record"?
Synonyms to domain names can be created using CNAME records. This is often referred to as 'creating aliases for computer names'.

Q: - What are "HINFO and TXT Records"?
HINFO and TXT records are for information only. An HINFO record has two items in its data part. The first item is information about hardware, and the second one is information about software. A TXT record contains a general data string in its data part.
Example :
test.com IN SOA ...
...
mail IN A 192.1.1.2
IN HINFO My_Server UNIX
IN TXT my server

Q: - what are "MX Records"?
MX records specify the mailing server of the domain. An MX record shows to which computer a mail of a particular domain should be sent. The MX record also includes a priority number, which can be used to determine several computers where the mail for the domain can be sent. The first attempt is to deliver the mail to the computer with the highest priority (lowest value). If this attempt fails, the mail goes to the next computer (with a higher priority value), and so on.

test.com IN SOA ...
...
mail               IN        A         192.1.1.2
                       IN       HINFO    AlphaServer UNIX
                       IN        TXT       my  server
                       IN         MX   30    mail2.nextstep4it.com
                       IN         MX   20    mail3.nextstep4it.com
                       IN         MX   10    mail2.nextstep4it.com

Q: - Explain "PTR Records"?
A Pointer Record (PTR) is used to translate an IP address into a domain name.

Q: - What is Dynamic DNS?
Dynamic DNS a method of keeping a domain name linked to a changing IP address as not all computers use static IP addresses. Typically, when a user connects to the Internet, the user's ISP assigns an unused IP address from a pool of IP addresses, and this address is used only for the duration of that specific connection. This method of dynamically assigning addresses extends the usable pool of available IP addresses. A dynamic DNS service provider uses a special program that runs on the user's computer, contacting the DNS service each time the IP address provided by the ISP changes and subsequently updating the DNS database to reflect the change in IP address.

Q: - What is the role of "named-checkconf Utility"?
The named-checkconf utility checks the syntax of the named.conf configuration file.
Syntax: named-checkconf    [-t directory] [filename]

Q: - what is the role of "named-checkzone Utility"?
The named-checkzone utility checks the syntax and consistency of the zone file.
Syntax:     named-checkzone [-dgv]   [-c class] zone   [filename]



Scanning for new LUNs on Linux servers

   

# ls /sys/class/fc_host

 host0  host1  host2  host3


 echo "1" > /sys/class/fc_host/host0/issue_lip

 echo "- - -" > /sys/class/scsi_host/host0/scan

 echo "1" > /sys/class/fc_host/host1/issue_lip

 echo "- - -" > /sys/class/scsi_host/host1/scan

 echo "1" > /sys/class/fc_host/host2/issue_lip

 echo "- - -" > /sys/class/scsi_host/host2/scan

 echo "1" > /sys/class/fc_host/host3/issue_lip

 echo "- - -" > /sys/class/scsi_host/host3/scan

 

And in other cases I use the following script to prod the sysfs scan and issue_lip entries directly:

 

 #!/bin/bash

SLEEP_INTERVAL=300

echo "Scanning all fibre channel host adapters"

for i in `ls /sys/class/fc_host`
do
    echo "Rescanning /sys/class/fc_host/${i}:"

    echo "  Issuing a loop initialization on ${i}:" 
    echo "1" > /sys/class/fc_host/${i}/issue_lip

    echo "  Scanning ${i} for new devices:"
    echo "- - -" > "/sys/class/scsi_host/${i}/scan"

    echo "Sleeping for ${SLEEP_INTERVAL} seconds"
    sleep ${SLEEP_INTERVAL}
done
 

=================


1) Check the newly assign LUN using below command and compare it using with our backup.


# multipath –ll

-------------------------------------------------------

mpath4 (36006016069502200b2fbd50e3173e011) dm-4 DGC,RAID 5

[size=400G][features=1 queue_if_no_path][hwhandler=1 emc][rw]

\_ round-robin 0 [prio=2][active]

 \_ 3:0:0:4 sdf 8:80   [active][ready]

 \_ 3:0:2:4 sdr 65:16  [active][ready]

\_ round-robin 0 [prio=0][enabled]

 \_ 3:0:1:4 sdl 8:176  [active][ready]

 \_ 3:0:3:4 sdx 65:112 [active][ready]

-------------------------------------------------------------------

In this case mpath4 is newly assign LUN, So continue to do the activity.
 

2)  Create the partition as below.


# fdisk /dev/mapper/mpath4

n

8e

# partprobe /dev/mapper/mpath4*

 
6) Check the newly created partition using below command.

 
# pvs

---------------------------------------------------------

PV                   VG         Fmt  Attr PSize    PFree

  /dev/dm-5            VolGroup01 lvm2 a-   1016.00M    0

  /dev/dm-6            VolGroup01 lvm2 a-     19.99G    0

  /dev/dm-7            VolGroup01 lvm2 a-    399.99G    0

  /dev/dm-8            VolGroup01 lvm2 a-     69.99G    0

  /dev/mapper/mpath4p1 VolGroup01 lvm2 a-    100.00G 4.00M

  /dev/sda6            VolGroup00 lvm2 a-    109.88G    0

--------------------------------------------------------------------------------

# pvcreate /dev/mapper/mpath4p1

 
# vgs

-----------------------------------------------------------------------------

VG         #PV #LV #SN Attr   VSize   VFree 

  VolGroup00   1   4   0 wz--n- 110.47G  56.56G

  VolGroup01   6   4   0 wz--n- 591.96G 200.00M

-------------------------------------------------------------------

 
# vgextend    VolGroup01   /dev/mapper/mpath4p1

# lvs

---------------------------------------------------------

LV          VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert

  backup      VolGroup00 -wi-a-  54.88G                                     

  home        VolGroup00 -wi-ao  10.00G                                     

  tmp         VolGroup00 -wi-ao   5.00G                                     

  usr         VolGroup00 -wi-ao  10.00G                                      

  var         VolGroup00 -wi-ao  30.00G                                     

  application VolGroup01 -wi-ao 569.96G                                     

  logs        VolGroup01 -wi-ao  20.00G                                      

  redo        VolGroup01 -wi-ao   1.00G 

--------------------------------------------------------------------------------

# lvextend -L +99.99G /dev/VolGroup01/application

# e2fsck –f /dev/VolGroup01/application

# resize2fs /dev/VolGroup01/application 

Linux System Admin Interview Questions And Answers

Q: -How are devices represented in UNIX?

All devices are represented by files called special files that are located in /dev directory.

Q: - What is 'inode'?

All UNIX files have its description stored in a structure called 'inode'. The inode contains info about the file-size, its location, time of last access, time of last modification, permission and so on. Directories are also represented as files and have an associated inode.

Q: - What are the process states in Unix?

As a process executes it changes state according to its circumstances. Unix processes have the following states:

Running : The process is either running or it is ready to run .

Waiting : The process is waiting for an event or for a resource.

Stopped : The process has been stopped, usually by receiving a signal.

Zombie : The process is dead but have not been removed from the process table.

Q: - What command should you use to check the number of files and disk space used and each user's defined quotas?

repquota

Q: - What command is used to remove the password assigned to a group?

gpasswd -r

Q: - What can you type at a command line to determine which shell you are using?

echo $SHELL

Q: - Write a command to find all of the files which have been accessed within the last 30 days.

find / -type f -atime -30 > filename.txt

Q: - What is a zombie?

Zombie is a process state when the child dies before the parent process. In this case the structural information of the process is still in the process table.

Q: - What daemon is responsible for tracking events on your system?

syslogd

Q: - What do you mean a File System?

File System is a method to store and organize files and directories on disk. A file system can have different formats called file system types. These formats determine how the information is stored as files and directories.

Q: - Tell me the name of directory structure hierarchy for Linux

/root

/boot

/bin

/sbin

/proc

/mnt

/usr

/var

/lib

/etc

/dev

/opt

/srv

/tmp

/media 

Q: - What does /boot directory contains?

The /boot/ directory contains static files required to boot the system, such as the Linux kernel, boot loader configuration files. These files are essential for the system to boot properly.

Q: - If some one deletes /boot directory from your server, than what will happen?

In that case your server will be in unbootable state. Your Server can’t boot without /boot directory because this directory contains all bootable files

Q: - What does /dev directory contain?

The /dev directory contains all device files that are attached to system or virtual device files that are provided by the kernel.

Q: - What is the role of udev daemon?

The udev demon used to create and remove all these device nodes or files in /dev/ directory.

Q: - What kind of files or nodes /dev/ directory contains and how do I access or see device files?

Block Device Files:-

Block device files talks to devices block by block [1 block at a time (1 block = 512 bytes to 32KB)].

Examples: - USB disk, CDROM, Hard Disk

# ls /dev/sd*

brw-rw----
   

1 root   
   

root     
   

8,
   

0 Mar 15  2009 sda

brw-rw----  
   

1 root   
   

root     
   

8, 
   

1 Mar 15  2009 sda1

brw-rw----  
   

1 root   
   

root     
   

8, 
   

2 Mar 15  2009 sda2

brw-rw----  
   

1 root   
   

root     
   

8, 
   

3 Mar 15  2009 sda3

brw-rw----  
   

1 root   
   

root     
   

8, 
   

4 Mar 15  2009 sda4

brw-rw----  
   

1 root   
   

root     
   

8, 
   

16 Mar 15  2009 sdb

Q: - Tell me the name of device file for PS/2 mouse connection.

/dev/psaux

Q: - Tell me the name of device file for parallel port (Printers).

/dev/lp0

Q: - What does /etc/X11/ directory contains?

The /etc/X11/ directory is for X Window System configuration files, such as xorg.conf.

Q: - What does /etc/skell directory contains?

The /etc/skel directory contains files and directories that are automatically copied over to a new user's home directory when such user is created by the useradd or adduser command.

Q: - Tell me name of Linux File systems?

Ext2

Ext3

Ext4

Q: -What is the difference between ext2 and ext3 file systems?

The ext3 file system is an enhanced version of the ext2 file system.

The most important difference between Ext2 and Ext3 is that Ext3 supports journaling.

After an unexpected power failure or system crash (also called an unclean system shutdown), each mounted ext2 file system on the machine must be checked for consistency by the e2fsck program. This is a time-consuming process and during this time, any data on the volumes is unreachable.

The journaling provided by the ext3 file system means that this sort of file system check is no longer necessary after an unclean system shutdown. The only time a consistency check occurs using ext3 is in certain rare hardware failure cases, such as hard drive failures. The time to recover an ext3 file system after an unclean system shutdown does not depend on the size of the file system or the number of files; rather, it depends on the size of the journal used to maintain consistency. The default journal size takes about a second to recover, depending on the speed of the hardware.

Q: - Any idea about ext4 file system?

The ext4 or fourth extended filesystem is a journaling file system developed as the successor to ext3. Ext4 filesystem released as a functionally complete and stable filesystem in Linux with kernel version 2.6.28.

Features of ext4 file system:-

1. Currently, Ext3 supports 16 TB of maximum file system size and 2 TB of maximum file size. Ext4 have 1 EB of maximum file system size and 16 TB of maximum file size.

[An EB or exabyte is 1018 bytes or 1,048,576 TB]

2. Fast fsck check than ext3

3 In Ext4 the journaling feature can be disabled, which provides a small performance improvement.

4. Online defragmentation.

5. Delayed allocation

Ext4 uses a filesystem performance technique called allocate-on-flush, also known as delayed allocation. It consists of delaying block allocation until the data is going to be written to the disk, unlike some other file systems, which may allocate the necessary blocks before that step.

Q: - How we create ext3 file system on /dev/sda7 disk?

# mkfs –j /dev/sda7

Q: - Can we convert ext2 filesystem to ext3 file system?

Yes, we can convert ext2 to ext3 file system by tune2fs command.

                tune2fs –j   /dev/<Block-Device-Name>

Q: - Is there any data lose during conversion of ext2 filesystem to ext3 filesystem?

No

Q: - How we will create ext4 file system?

# mke2fs -t ext4 /dev/DEV

Q: - Explain /proc filesystem?

/proc is a virtual filesystem that provides detailed information about Linux kernel, hardware’s and running processes. Files under /proc directory named as Virtual files. Because /proc contains virtual files that’s why it is called virtual file system.

These virtual files have unique qualities. Most of them are listed as zero bytes in size. Virtual files such as /proc/interrupts, /proc/meminfo, /proc/mounts, and /proc/partitions provide an up-to-the-moment glimpse of the system's hardware. Others, like the /proc/filesystems file and the /proc/sys/ directory provide system configuration information and interfaces.

Q: - Can we change files parameters placed under /proc directory?

Yes

To change the value of a virtual file, use the echo command and a greater than symbol (>) to redirect the new value to the file. For example, to change the hostname on the fly, type:

echo www.nextstep4it.com > /proc/sys/kernel/hostname

Q: - What is the use of sysctl command?

The /sbin/sysctl command is used to view, set, and automate kernel settings in the /proc/sys/ directory.

Q: - /proc/ directory contains a number of directories with numerical names. What is that?

These directories are called process directories, as they are named after a program's process ID and contain information specific to that process.

Q: - What is RAID?

RAID, stands for Redundant Array of Inexpensive Disks. RAID is a method by which same data or information is spread across several disks, using techniques such as disk striping (RAID Level 0), disk mirroring (RAID Level 1), and disk striping with parity (RAID Level 5) to achieve redundancy, lower latency, increased bandwidth, and maximized ability to recover from hard disk crashes.

Q: - Why should we use RAID?

System Administrators and others who manage large amounts of data would benefit from using RAID technology.

Following are the reasons to use RAID

-   Enhances speed

-   Increases storage capacity using a single virtual disk

-   Minimizes disk failure

Q: - What is the difference between hardware RAID and Software RAID?

The hardware-based RAID is independent from the host. A Hardware RAID device connects to the SCSI controller and presents the RAID arrays as a single SCSI drive. An external RAID system moves all RAID handling "intelligence" into a controller located in the external disk subsystem. The whole subsystem is connected to the host via a normal SCSI controller and appears to the host as a single disk.

Software RAID is implemented under OS Kernel level. The Linux kernel contains an MD driver that allows the RAID solution to be completely hardware independent. The performance of a software-based array depends on the server CPU performance and load.

Q: - What are the commonly used RAID types?

RAID 0

RAID 1

RAID 5

Q: - Explain RAID 0?

RAID level 0 works on “striping” technique. In RAID 0 the array is broken down into strips and data is written into strips. RAID 0 allows high I/O performance but provides no redundancy. RAID 0 Array Size is equal to sum of disks in array. If one drive fails then all data in the array is lost.

Q: - Explain RAID 1?

RAID Level 1 is based on Mirroring technique. Level 1 provides redundancy by writing identical data to each member disk of the array. The storage capacity of the level 1 array is equal to the capacity of one of the mirrored hard disks in a Hardware RAID or one of the mirrored partitions in a Software RAID. RAID 1 provides redundancy means good protection against disk failure. In RAID 1 write speed is slow but read speed is good.

Q: - Explain RAID 5?

RAID Level 5 is based on rotating parity with striping technique. RAID-5 stores parity information but not redundant data (but parity information can be used to reconstruct data). The storage capacity of Software RAID level 5 is equal to the capacity of the member partitions, minus the size of one of the partitions if they are of equal size. The performance of RAID 5 is based on parity calculation process but with modern CPUs that usually is not a very big problem. In RAID 5 read and write speeds are good.

Q: - Which kernel module is required for Software RAID?

“md” module

Q: - which utility or command is used for creating software RAID’s for RHEL5?

mdadm

Q: - Can we create software RAID during Linux installation?

Yes, we can create Software RAID during Linux Installation by “Disk Druid”

Q: - What is the role of chunk size for software RAID?

Chunk size is very important parameter on which RAID performance based.
We know stripes go across disk drives. But how big are the pieces of the stripe on each disk? The pieces a stripe is broken into are called chunks.To get good performance you must have a reasonable chunk size.

For big I/Os we required small chunks and for small I/Os we required big chunks.

Q: - What is SWAP Space?

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.

Q: - What are the steps to create SWAP files or Partition?

- Create swap partition or file
- Write special signature using “mkswap”
- Activate swap space by “swapon –a” command
- Add swap entry into /etc/fstab file

Q: - How you will create swap file of size 4 GB and explain swap file entry in /etc/fstab file?

Use “dd” command to create swap file.

dd if=/dev/zero  of=/SWAPFILE  bs=1024  count=4

mkswap /SWAPFILE

swapon –a

Entry into /etc/fstab file.

/SWAPFILE   swap   swap   defaults   0   0

Q: - Tell me the steps to remove the swap file?


Firstly disable the swap file by “swapoff” command.
Remove Swap file entry from /etc/fstab file.
Now remove the swap file by “rm” command.


Q: - What can we do with “parted” command or utility?

- View the existing partition table
- Add partitions from free space or additional hard drives
- Change the size of existing partitions

Q: - How we will check free space on drive /dev/sda with parted command?

#parted /dev/sda

print

Q: - Can we resize the size of a partition?

Yes, we can resize the size of partition by “parted” command.

#parted /dev/sda

print

To resize the partition, use the resize command followed by the minor number for the partition, the starting place in megabytes, and the end place in megabytes. For example:

resize 3 1024 2048

After resizing the partition, use the print command to confirm that the partition has been resized correctly, is the correct partition type, and is the correct file system type.

Q: - What is LVM?

LVM stands for Logical Volume Manager. LVM, is a storage management solution that allows administrators to divide hard drive space into physical volumes (PV), which can then be combined into logical volume groups (VG), which are then divided into logical volumes (LV) on which the filesystem and mount point are created.

Q: - What are the steps to create LVM?

- Create physical volumes by “pvcreate” command

#pvcreate /dev/sda2

- Add physical volume to volume group by “vgcreate” command

#vgcreate VLG0 /dev/sda2

- Create logical volume from volume group by “lvcreate” command.

#lvcreate -L 1G -n LVM1 VLG0

Now create file system on /dev/sda2 partition by “mke2fs” command.

#mke2fs -j /dev/VLG0/LVM1

Q: - What is the difference between LVM and RAID?

RAID provides redundancy but LVM doesn’t provide Redundancy.

Q: - What are LVM1 and LVM2?

LVM1 and LVM2 are the versions of LVM.

LVM2 uses device mapper driver contained in 2.6 kernel version.

LVM 1 was included in the 2.4 series kernels.

Q: - What is Volume group (VG)?

The Volume Group is the highest level abstraction used within the LVM. It gathers together a collection of Logical Volumes and Physical Volumes into one administrative unit.

Q: - What is physical extent (PE)?

Each physical volume is divided chunks of data, known as physical extents; these extents have the same size as the logical extents for the volume group.

Q: - What is logical extent (LE)?

Each logical volume is split into chunks of data, known as logical extents. The extent size is the same for all logical volumes in the volume group.

Q: - Explain LVM snapshot?

LVM snapshots allow the administrator to create a new block device which presents an exact copy of a logical volume, frozen at some point in time.

Q: -How you will check on Your server or system device-mapper is installed or not?

Check the following file.

#cat /proc/misc

if this file contains "device-mapper" term it means device mapper is installed on your system.

Q: - How are snapshots in LVM2 different from LVM1?

In LVM2 snapshots are read/write by default, whereas in LVM1, snapshots were read only.

Q: - What is the maximum size of a single LV?

For 2.4 based kernels, the maximum LV size is 2TB.

For 32-bit CPUs on 2.6 kernels, the maximum LV size is 16TB.

For 64-bit CPUs on 2.6 kernels, the maximum LV size is 8EB.

Q: - If a volume group named as VG0 already exists but i need to extend this volume group up to 4GB.Explain all steps?

Firstly create Physical volume (/dev/sda7) of size 4GB.

Now run following command.

vgextend VG0 /dev/sda7

but i want to remove /dev/sda7 pv from this VG0?

vgreduce VG0 /dev/sda7

Q: - Which command is used to extend a logical volume?

lvextend --size +<addsize> /dev/<vgname>/<lvname>

resize2fs /dev/<vgname>/<lvname>

Q: - Tell me all steps to remove a LVM?

To remove a logical volume from a volume group, first unmount it with the umount command:

umount /dev/<vgname>/<lvname>

and then use the lvremove command:

lvremove /dev/<vgname>/<lvname>

Q: - Which command is used to create LVM Snapshot?

vcreate --size <size> -s -n <snapshotname> <lvname>

The lvcreate command is used to create a new logical volume, meaning there must be

free physical extents in the logical volume group to create a snapshot. The -s option

means that the LV is a snapshot, <snapshotname> is the name of the new LV created, and

<lvname> is the name of the LV from which to create the snapshot.

Q: - Is there any relation between modprobe.conf file and network devices?

Yes, This file assigns a kernel module to each network device.

For Example :-

[root@localhost ~]# cat /etc/modprobe.conf

alias eth0 b44

Here b44 is the kernel module for network device eth0.

We can Confirm by following command (This module “b44” is present or not).

[root@localhost ~]# lsmod |grep b44

b44                    29005    0

Q: - What is the location of "network" file and what does this contains?

location :-  /etc/sysconfig/network

This file contains following fields

NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=localhost.localdomain

Q: - What is the role of /etc/resolv.conf file?

In this file we sets the DNS servers (using their IP addresses) and the search domain. The values of the DNS servers are often added when the network is activated because the data can be provided by DHCP or a similar service.

Q: - Which deamon is required to start Network services?

network

/etc/init.d/network start

What "neat" command will do?

neat command provides Graphical interface to change network settings for network devices.

Q: - Which protocol is required to allow local printing and print sharing?

Internet Printing Protocol (IPP) is required to allow local printing and print sharing.

Q: - What is CUPS?

CUPS stands for "Common UNIX Printing System". CUPS is a open source printing system developed by Apple Inc. CUPS uses the Internet Printing Protocol (IPP) to allow local printing and print sharing.

Q: -What is the location of log files for CUPS?

The log files for the CUPS printing system are located in the /var/log/cups/ directory.

Q: - What is YUM?

YUM stands for Yellow dog Updater, Modified because it is based on YUP, the Yellow dog Updater. Where does the name Yellow dog come from? Yellow Dog is a version of Linux for the Power Architecture hardware and is RPM-based, just like Red Hat Enterprise Linux and Fedora. YUP, and later YUM, were written by the Linux community as a way to maintain an RPM-based system.

Q: - What are the advantages of YUM?

- Automatic resolution of software dependencies.
- Multiple software locations at one time.
- Ability to specify particular software versions or architectures.

Q: - How you will install software by YUM?

yum install <pkgname>

Q: - Which option is required to assume the answer "yes" to any questions asked during installation of package dependencies for YUM?

The "-y" option is used to assume the answer "yes".

For Example

yum -y install squid

Q: - How to remove a software by YUM?

yum remove <pkgname>

Q: - How Many Run Levels present in Linux?

There are 7 run levels, with each having its own properties.

-   0: Halt the system

-   1: Single-user mode

-   2: Not used

-   3: Multi-user mode with text login

-   4: Not used

-   5: Multi-user mode with graphical login

-   6: Reboot

Q: - Which configuration file is required to change the Run Level of Server or system?

/etc/inittab

To change the default run level, modify this line.

id:5:initdefault:

Q: - Explain architectures required for RPMs?

noarch Architecture-independent, can run on any architecture

i386   Generic build for a 32-bit x86 system

i586   Sometimes used when building kernels for older x86 processors

Intel® Pentium ® II, Intel Pentium III, Intel Pentium 4, AMD Athlon, and

i686   AMD Duron systems (Most RPMs for these architectures are built using the i386 architecture, with the kernel for these architectures being built with the

i686 for optimal performance.)

x86_64 64-bit processors such as AMD Athlon64, AMD Opteron, and Intel EM64T

ia64   Intel® Itanium

ppc    32-bit IBM® POWER, IBM eServer„ pSeries®, and IBM eServer iSeries

s390x  64-bit IBM eServer System z

Q: - How to install Linux software’s by RPM?

rpm -ivh test-1.0-1.i386.rpm

test  ######################### [100%]

Q: - If a file associated with test-1.0-1.i386.rpm deleted, than How we will recover that file?

We can reinstall this rpm again.

Q: - If you are getting error "package is already installed" but you have to install package any how. what option you will use?

rpm -ivh test-1.0-1.i386.rpm

Preparing... ########################################### [100%] package test-1.0-1 is already installed

In this case you can use "--replacepkgs" option.

rpm -ivh –replacepkgs   test-1.0-1.i386.rpm

Q: -Which options are required to upgrade a RPM?

Upgrading a package is similar to installing one. Type the following command at a shell prompt:

rpm -Uvh test-2.0-1.i386.rpm

Q: - In which directory RPM database stored?

/var/lib/rpm

Q: - Explain the command "rpm -qa"?

It will queries all currently installed packages.

Q: - Explain the command "rpm -qf "?

it queries the RPM database for which package owns <filename>. When specifying a file, specify the absolute path of the file.

Q: - How to verify all installed packages?

rpm -Va

Q: - How to verify the signature of an rpm?

rpm -K test-1.0-1.i386.rpm

Q: - How to list PCI Devices on your server or System?

use "lspci" command.

Q: - What is the role of "Kudzu"?

Kudzu is used to Detect new Hardware

Q: - What happens when you add a new device after installation?

The Kudzu program runs each time the system boots and performs a hardware probe. If new hardware is found, Kudzu attempts to map it to a kernel module. If successful, the information is saved, and the device is configured.

Q: - How to Enable ACLs for /home partition?

Add following entry in /etc/fstab

LABEL=/home    /home       ext3        acl      1  2

Now remount /home partition with acl option.

mount -t ext3 -o acl /dev/sda3  /home

Q: - How to View ACLs for a file(test_file)?

getfacl test_file

Q: - How to remove an ACL?

setfacl --remove-all <file-name>

Q: - What is the difference between pop3 and imap protocols ?

POP3 (Post Office Protocol) is the most commonly used internet mail protocol.It works on 110 port. It is easy to configure and use. With a POP account you download the mail to your local computer and keep it there. Most of the time it gets deleted off of the mail server after being downloaded. One disadvantage of POP is that once you download it to your computer you won't be able to check your mail from a different computer since it will already be downloaded onto your own computer. It tends to be slower than IMAP as well.

IMAP (Internet Message Access Protocol) uses a method where all the mailboxes and messages are maintained on the server. Therefore you can access your e-mail from any location with an internet connection. IMAP is faster than POP because the mail client reads all of the message headers without having to download the entire message. IMAP is also supported in a variety of clients just like POP. One thing to keep in mind is the amount of disk space allocated to your mail on the server may not be enough to hold all of your mail.IMAP supports the folder synchronization option e.g if you create any folder  on the client m/c in outlook(mail client) then that folder will automatically created on the mailserver for the account

POP works best when you are using only a single computer, since you don’t have to worry about checking your e-mail from multiple locations. Plus it is faster as well.

IMAP would suit you better if you need to check your e-mail from multiple locations if you travel a lot. To use IMAP your ISP/mail provider must offer that type of account.

Q: - How to Disable a User Account in Linux ?

#   passwd <username> -l

   This might be useful in the situation where you don’t want to permanently remove the user, but you just want it disabled and no longer able to use the system. The user will still receive emails for example, but he will not be able to login and check them out.

To re-enable the account ,just use below command

# passwd <username> -u

Q: - How to detect CPU architecture/bitmode (32-bit or 64-bit) for Linux ?

# cat /proc/cpuinfo | grep flags

you will find one of them with name "tm(transparent mode)" or

"rm(real mode)" or "lm(long mode)"

1. rm tells ,it is a 16 bit processor

2. tm tells, it is a 32 bit processor

3. lm tells, it is a 64 bit processor

Q: - What is the difference between SSH and Telnet ?

The Primary difference between SSH and Telnet is of security i.e in ssh data transfer between the systems is in encrypted form so it is difficult for the hackers to understand what is going on network.

 In Telnet data transfer between the systems is in plain text.

SSH uses a public key for authentication while Telnet does not use any authentication.

Due to the security measures that were necessary for SSH to be used in public networks, each packet contains less data to make room for the data of the security mechanisms. In order to transmit the same amount of data, you would need to take-up a lot more bandwidth. This is called overhead..

SSH adds a bit more overhead to the bandwidth compared to Telnet.

Q: - What is difference between AT and CRON?

Cron command is used to schedule the task daily at the same time repeatedly ,

at command is used to schedule the task only once i.e to run only one time.

Q: - What is network bonding in Linux and steps to configure network bonding ?

 Network interface card (NIC) bonding (also referred to as NIC teaming) is the bonding together of two or more physical NICs so that they appear as one logical device. This allows for improvement in network performance by increasing the link speed beyond the limits of one single NIC and increasing the redundancy for higher availability. For example, you can use two 1-gigabit NICs bonded together to establish a 2-gigabit connection to a central file server.

When bonded together, two or more physical NICs can be assigned one IP address. And they will represent the same MAC address. If one of the NICs fails, the IP address remains accessible because it is bound to the local NIC rather than to a single physical NIC.

Steps to configure :

Step #1: Create a bond0 configuration file

Red Hat Linux stores network configuration in /etc/sysconfig/network-scripts/ directory. First, you need to create bond0 config file:

# vi /etc/sysconfig/network-scripts/ifcfg-bond0

Append following lines to it:

DEVICE=bond0

IPADDR=192.168.1.20

NETWORK=192.168.1.0

NETMASK=255.255.255.0

USERCTL=no

BOOTPROTO=none

ONBOOT=yes

Replace above IP address with your actual IP address. Save file and exit to shell prompt.

Step #2: Modify eth0 and eth1 config files:

Open both configuration using vi text editor and make sure file read as follows for eth0 interface

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Modify/append directive as follows:

DEVICE=eth0

USERCTL=no

ONBOOT=yes

MASTER=bond0

SLAVE=yes

BOOTPROTO=none

Open eth1 configuration file using vi text editor:

# vi /etc/sysconfig/network-scripts/ifcfg-eth1Make sure file read as follows for eth1 interface:

DEVICE=eth1

USERCTL=no

ONBOOT=yes

MASTER=bond0

SLAVE=yes

BOOTPROTO=none

Save file and exit to shell prompt.

Step # 3: Load bond driver/module

Make sure bonding module is loaded when the channel-bonding interface (bond0) is brought up. You need to modify kernel modules configuration file:

# vi /etc/modprobe.conf

Append following two lines:

alias bond0 bonding

options bond0 mode=balance-alb miimon=100

Step # 4: Test configuration

First, load the bonding module:

# modprobe bonding

Restart networking service in order to bring up bond0 interface:

# service network restart

Verify everything is working:

# less /proc/net/bonding/bond0Output:

Bonding Mode: load balancing (round-robin)

MII Status: up
 MII Polling Interval (ms): 0
 Up Delay (ms): 0
 Down Delay (ms): 0


 Slave Interface: eth0
 MII Status: up
 Link Failure Count: 0
 Permanent HW addr: 00:0c:29:c6:be:59

Slave Interface: eth1
 MII Status: up
 Link Failure Count: 0
 Permanent HW addr: 00:0c:29:c6:be:6



What is the difference between LILO and GRUB ?

 1) LILO has no interactive command interface, whereas GRUB does.

2) LILO does not support booting from a network, whereas GRUB does.

3) LILO stores information regarding the location of the operating systems it can to load physically on the MBR.

If you change your LILO config file, you have to rewrite the LILO stage one boot loader to the MBR. Compared with GRUB, this is a much more risky option since a misconfigured MBR could leave the system unbootable. With GRUB, if the configuration file is configured incorrectly, it will simply default to the GRUB command-line interface.

Q: - What is LVM Snapshot ?

 An LVM snapshot is an exact copy of an LVM partition that has all the data from the LVM volume from the time the snapshot was created. The big advantage of LVM snapshots is that they can be used to greatly reduce the amount of time that your services/databases are down during backups because a snapshot is usually created in fractions of a second. After the snapshot has been created, you can back up the snapshot while your services and databases are in normal operation.

Q: - How to verify the signature of an rpm ?

rpm -K test-1.0-1.i386.rpm

Q: - What is the meaning of  Hard & soft mount option in NFS server ?

Hard mount

- If the NFS file system is hard mounted, the NFS daemons will try repeatedly to contact the server. The NFS daemon retries will not time out, will affect system performance, and you cannot interrupt them

Soft mount

- If the NFS file system is soft mounted, NFS will try repeatedly to contact the server until either:

    A connection is established
    The NFS retry threshold is met
    The nfstimeout value is reached

Q: - What is an inode ?

 An inode is a data structure on a traditional Unix-style file system such as UFS. An inode stores basic information about a regular file, directory, or other file system object.

When a file system is created, data structures that contain information about files are created. Each file has an inode and is identified by an inode number (often "i-number" or even shorter, "ino") in the file system where it resides. Inodes store information on files such as user and group ownership, access mode (read, write, execute permissions)

and type of file. There is a fixed number of inodes, which indicates the maximum number of files each filesystem can hold.

Q: - What is the role of udev daemon in Unix ?

 udev is the device manager for the Linux 2.6 kernel series. Primarily, it manages device nodes in /dev. It is the successor of devfs and hotplug, which means that it handles the /dev directory and all user space actions when adding/removing devices, including firmware load.

Q: - What is the difference between ext2 and ext3 file systems?

The ext3 file system is an enhanced version of the ext2 file system.The most important difference between Ext2 and Ext3 is that Ext3 supports journaling.

After an unexpected power failure or system crash (also called an unclean system shutdown), each mounted ext2 file system on the machine must be checked for consistency by the e2fsck program. This is a time-consuming process and during this time, any data on the volumes is unreachable. The journaling provided by the ext3 file system means that this sort of file system check is no longer necessary after an unclean system shutdown. The only time a consistency check occurs using ext3 is in certain rare hardware failure cases, such as hard drive failures. The time to recover an ext3 file system after an unclean system shutdown does not depend on the size of the file system or the number of files; rather, it depends on the size of the journal used to maintain consistency. The default journal size takes about a second to recover, depending on the speed of the hardware.

Q: - How are devices represented in UNIX?

All devices are represented by files called special files that are located in /dev directory.

Q: - What is 'inode'?

All UNIX files have its description stored in a structure called 'inode'. The inode contains info about the file-size, its location, time of last access, time of last modification, permission and so on. Directories are also represented as files and have an associated inode

Q: - What are the process states in Unix?

As a process executes it changes state according to its circumstances. Unix processes have the following states:

Running : The process is either running or it is ready to run .

Waiting : The process is waiting for an event or for a resource.

Stopped : The process has been stopped, usually by receiving a signal.

Zombie : The process is dead but have not been removed from the process table.

Q: - What is Super Block in Linux/Unix ?

Each file system is different and they have type like ext2, ext3 etc.Further eachfile system has size like 5 GB, 10 GB and status  such as mount status. In short each file system has a superblock, which contains informationabout file system such as:

  File system type

    Size
    Status
    Information about other metadata structures

            If this information lost, you are in trouble (data loss) so Linux             maintains multiple redundant copies of thesuperblock in every file             system. This is very important in many emergency situation, for             example you can usebackup copies to restore damaged primary             super block.

Following command displays primary and backup superblock location on/dev/sda3:

# dumpe2fs /dev/hda3 | grep -i superblock

Q: - What is the load average of the server and What is an acceptable Server Load Average ?

The load average is the sum of the run queue length and the number of jobs currently running on the CPUs. The three load-average values in the first line of top output are the 1-minute, 5-minute and 15-minute average. (These values also are displayed by other commands, such as uptime, not only top.)

There are a few factors involved to determine the server average load. If your server (s) use dual processors, the acceptable Server Load Average is 2.00. This load is considered "optimal".



Q: -What is Greylisting  ?

Greylisting (or graylisting) is a method of defending e-mail users against spam. A mail transfer agent (MTA) using greylisting will "temporarily reject" any email from a sender it does not recognize. If the mail is legitimate the originating server will, after a delay, try again and, if sufficient time has elapsed, the email will be accepted. If the mail is from a spam sender, sending to many thousands of email addresses, it will probably not be retried.

Q: - Can we have two apache servers having diff versions?

Yes, you can have two different apache servers on one server, but they can't listen to the same port at the same time.Normally apache listens to port 80 which is the default HTTP port. The second apache version should listen to another port with the Listen option in httpd.conf, for example to port 81.

For testing a new apache version before moving your sites from one version to another, this might be a good option.You just type www.example.com:81 in the browser window and you will be connected to the second apache  instance.


Monday, October 15, 2012

Skip FSCk while boot / fastboot in linux



How to skip or bypass a fsck on reboot? How to stop a FSCK from prompting or running automatically while rebooting the server.

1. To change grub.conf

Reboot the server using below command

# shutdown -rf now

Above command will reboot the system and will not run auto fsck.

change Linux kernel option by editing grub.conf / menu list.

Open grub.conf or menu list.

# vi /boot/grub.conf

Find kernel line and put "fastboot" at the end of the kernel line. In the end it should look as follow:

kernel /vmlinuz-2.6.18-92.1.22.el5 ro root=LABEL=/ console=tty0 console=ttyS1,19200n8 fastboot


This will be saved as permanent and every time server boots it won’t check the fsck. If you want to do only one time, then edit the grub at the time of boot by pressing the key "e".



2. To change /etc/fstab option:

You can skip the fsck option by modifying the /etc/fstab file like below .

In /etc/fstab end of the mount point option the values to 0 . (sixth field)

If the sixth field is not present or zero, a value of zero is returned and fsck will assume that the filesystem does not need to be checked. Here is sample entry:


LABEL=/disk1        /disk1            ext3    defaults    0 0

then save and exit.


By using the above  2 way we can skip or bypass fsck