Tuesday, October 8, 2013

linux system administrator interview questions and answers for experienced

1. How to check Gateway and net mask??
Ans. netstat -ar

2. RSYNC command executed, got error while copying, again the command initiated, whether the file copies from 1st and incremental.
Ans:- The rsync command is incremental copy(check the files with destination and copies rest of the part).

3. In RAID 5, two disks are corrupted what to do ?
Ans:- In RAID 5 , if one disk is corrupted , we can replace that effective drive without any downtime. But here the scenario is  two disks are corrupted , in this case we don’t have much option left. Need to replace all the effective disks and rebuild the OS. If we kept two spare hard disk while creating RAID , the situation will be different.

4.what is hard and soft mounting?
Ans. 

    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

When one of these events occurs, control returns to the calling program.

5.what is /proc file system ?

Ans. procfs (or the proc file system  is a special file system in UNIX-like operating systems that presents information about processes and other system information in a hierarchical file-like structure, providing a more convenient and standardized method for dynamically accessing process data held in the kernel than traditional tracing methods or direct access to kernel memory.

6.what is daemon responsible for tracking events in a server?
Ans. syslogd


7.what is difference between raid 0 and raid 1?
Ans. RAID 0, No redundancy
       RAID 1, Redundancy

8.what is kernel panic?
Ans. A kernel panic is an action taken by an operating system upon detecting an internal fatal error from which it cannot safely recover. The term is largely specific to Unix and Unix-like systems; for Microsoft Windows operating systems the equivalent term is "bug check" (or "Blue Screen of Death").

9.what is '0' process?
Ans. parent process id of 'init' (sched process)

10.what is the last service started by init before logging screen appears?
Ans. /etc/rc.local which are the last commands run in initialization process or even booting process

11.difference between LILO &GRUB?
Ans. LILO, Linux Loader, on kernel versions < 2.4,It does'nt support booting from n/w.
     Grub, Grand unified boot loader. on Kernel versions >= 2.6, supports booting from network.


12.Stages of boot loader?
Ans.6 stages.

1. BIOS
2. MBR
3. GRUB
4. Kernel 
5. Init
6. Runlevels 


13.when two machines are there, one machine MAC & IP address is known,  another machine MAC address is there, how to find IP of another machine using command?

Ans. 'arp' command


14.while 'ping' cmd is used  the system not receiving any o/p?
Ans. ping cmd is blocked in kernel parameters

     ping  cmd uses icmp protocol.

15.Issue is there with hard drives ,dont know  which drive is fault. how to check which drive is fault?

Ans. If it is HP and IBM Servers, it will show amber color for faulty HDD.  otherwise we can see the status of the hard disks in ILO (Integrated Lights   Out)configuration for HP servers and the same remote accessing feature also available for IBM. other wise you can check in dmesg .


16.In production server one drive got failed,how to replace new drive?
Ans. plug and play devices, in raid -1 mirror is used machine can run with one hard disk . we can replace 

17.ASR means AUTOMATED SERVER RECOVERY

18. What is Network bonding? Requirements for bonding?
Ans. N/w Bonding will configure on the servers for redundancy. It requires minimum 2 Ethernet Ports/Cards.

19. MI means?

Ans. Major Incident

20. Different mount options apart from mount command?
Ans. crazy question, i will say /bin/mount., But it is mount command full form. I heared guestmount commnad also there to mount a disk ...but didn't used yet.

22.how to start services apart from 'service' cmd?
Ans. /ect/init.d/<service name> start

23.how to display memory info?
Ans. cat /proc/meminfo

   free -go (To see in GB)

24.how to display hardware information?
Ans. dmidecode |less

     Command: lscpu

List available cpus and their caracteristics , Not available on older distribution
     
     Command: lshal

         Require HAL (Hardware Abstraction Layer) to be installed . List all hardware visible by HAL

     Command: lshw

          Available on Debian and Ubuntu based distributions by default .Available in the Fedora repositories .Uses many inputs            to detect all hardware: Kernel, HAL, DMI, etc. use ‘-html’ switch that generates hardware reports
    
     Command: lspci

     Standard command ,List all hardware connected to the PCI bus as detected by the kernel
     
     Command: lsusb

      Standard command. List all hardware connected to the USB buses as detected by the kernel

     Command: dmidecode

      Standard command, Get the source information from the DMI (a kind of BIOS interface) .List all hardware as reported by       the DMI interface

25. command to check the directory's partition or mount ?

Ans. df -P file/goes/here | tail -1 | cut -d' ' -f 1

[root@testmachine Desktop]# df -P /boot/ | tail -1 | cut -d' ' -f1

/dev/sda1


26.how to rollback application?

Ans.  insert 'ts_flags=repackage' in /etc/yum.conf and create file /etc/rpm/macros with an entry'repackage' parameter.

27.how to rollback filesystem?
Ans. If 'Snapshot'(backup) is taken, using superblocks we can rollback file system.

28. Newly attached hard drive is not recognizing how to make it active ?
Ans. After building server with 2 hard disks, again if we attach any hdd, server wont recognizes it. if the server want to recognize it, we need to reboot it and create RIAD fo that HDD also.

If we replaced Faulty hard disk with new one, Server will take 1 hr time to synchronize the data (RIAD 1 and RAID 5).


29.Different raid levels & explanation?
Ans. raid 0, raid1, raid1+0, raid 1+0, raid3, raid 5, raid50, raid6.

30.file system is full? user need some space to run his work ?
Ans. 1. If it is configured with 'lvm' we can extend it, or else we can make use of reserved blocks.
     2. Delete the old files after getting confirmation from user.
     

31. How to check a package is installed or not?

Ans.  rpm -qa | grep <package name>, it will gives package name and version, if it installed, returns empty screen if not installed.

32.how to check which ports are working?

Ans. netstat cmd

33.how to configure static route?
Ans. vi /etc/sysconfig/network-scripts/ifcfg-route0

34. How to check the processor type ?

Ans. grep "model name" /proc/cpuinfo

[root@testmachine Desktop]# grep -i "model name" /proc/cpuinfo  | cut -d: -f2

 Intel(R) Core(TM)2 Duo CPU     T9550  @ 2.66GHz


35.what is GRUB?
Ans. Grand unified Boot loader. Its boot loader in linux. (kernel versions >=2.6)

36.how to check info of  hard drives ?
Ans. df or mount

37.difference between rpm and yum ?
Ans.

38.How to increase physical memory in steps?
Ans. Hardware job, Its requires a down time form the users/customers , to upgrade memory modules . (memory size should be match with old memory modules.)


40.kernel patching?
Ans. 

41.how to mount alternate superblock command?
Ans. mount  sb=alternative superblock  /dev/sda

42. How to create a never expire passwod for user?
Ans. chage -E -1 username 

43. tune2fs command used for ?

Ans. for tuning  the file system parameters

44. I am sharing a directory through samba , everything is accessible apart  from soft link files ,how to share those soft links shares?
Ans. Apply parameters in share definition
         follow symlinks =yes
         wide links =yes

46.what is the way to set dump and fsck options in /etc/fstab?
Ans.

47.maximum file grow in ext4 filesystem?
Ans. The ext4 file system can support volumes with sizes up to 1 exbibyte (EiB) and files with sizes up to 16 tebibytes (TiB). However, Red Hat recommends using XFS instead of ext4 for volumes larger than 100 TB.

1 exbibyte = 260 bytes = 1152921504606846976bytes = 1,024 pebibytes
1 tebibyte = 240 bytes = 1099511627776bytes = 1024 gibibytes

48.difference between linear and mirror volumes?
Ans.

49. scenerio 
# df -h
……………. file system full 
#ls -l 
two files…..1. one file is occupying full space
# rm -f filename
#df  -h 
same output …file system is full 
#ls -l 
file is not there ..still file system is full.
Ans.
 # lsof | grep "(deleted)" # (or lsof | grep (filename))

If it's safe to do so, take the pid from the lsof command, and do:

Code:
# ls -l /proc/(pid)/fd # to get the fd# for the file
# > /proc/(pid)/fd/(fd#) # to empty the file.

Otherwise the space will be freed when the application using it closes, or the system restarts.

# implies a root prompt, meaning your sysadmin needs to do this.

(S)he will need to install lsof if it's not already installed.

50.what is webstack? how to improve performance and bottlenecks?

Ans.

51. No such file or directory error?
Ans. ls -ld <filename>, error, no such file or directory.. 

  Reasons: Check it , by logging as a root. might be normal user not having the permissions to view it.
  we will get these type of messages, if the directory or file is unmounted or deleted.


52.how to check database and other applications running?
Ans. ps -ef | grep <database name/ application name>

53.mpstat, iostat,vmstat statistics define?
Ans.
   1. iostat – Basic example

Iostat without any argument displays information about the CPU usage, and I/O statistics about all the partitions on the system as shown below.

 #iostat
Linux 2.6.32-100.28.5.el6.x86_64 (dev-db)       07/09/2013

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           5.68    0.00    0.52    2.03    0.00   91.76

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda             194.72      1096.66      1598.70 2719068704 3963827344
sda1            178.20       773.45      1329.09 1917686794 3295354888
sda2             16.51       323.19       269.61  801326686  668472456


   vmstat : vmstat by default will display the memory usage (including swap) as shown below.

#vmstat

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache     si   so    bi    bo   in   cs us sy id wa st
 0  0 305416 260688  29160 2356920    2    2     4     1    0    0  6  1 92  2  0

Procs – r: Total number of processes waiting to run
Procs – b: Total number of busy processes
Memory – swpd: Used virtual memory
Memory – free: Free virtual memory
Memory – buff: Memory used as buffers
Memory – cache: Memory used as cache.
Swap – si: Memory swapped from disk (for every second)
Swap – so: Memory swapped to disk (for every second)
IO – bi: Blocks in. i.e blocks received from device (for every second)
IO – bo: Blocks out. i.e blocks sent to the device (for every second)
System – in: Interrupts per second
System – cs: Context switches
CPU – us, sy, id, wa, st: CPU user time, system time, idle time, wait time


mpstat – Display basic info

By default mpstat displays CPU statistics.


54. how to list newly attached hardware?
Ans. dmidecode | less

55.In RAID , statistics display  "_U" .what is the meaning?
Ans. one of the hard disk is failed.

56.what is initrd? what it does?
Ans. initrd stands for Initial RAM Disk. initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted. It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware parts of the server.


58.where /proc file system rests?
Ans. Linux systems store all data as files. Most users are familiar with the two primary types of files: text and binary. But the /proc/ directory contains another type of file called a virtual file. As such, /proc/ is often referred to as a virtual file system.

59.where tmpfs stores?
Ans. Tmpfs is a file system which keeps all files in virtual memory. Everything in tmpfs is temporary in the sense that no files will be created on your hard drive. If you unmount a tmpfs instance, everything stored therein is lost. tmpfs lives completely in the page cache and on swap, all tmpfs pages currently in memory will show up as cached

60.Daemons in nfs?
Ans. mountd ,nfsd,lockd,statd,nfslogd

61.how to change user access to entire file system?
Ans. chown -R

62.why UMASK is used, where to change its value to be effective on entire OS?
Ans. When user create a file or directory under Linux or UNIX, it creates with a default set of permissions. In most case the system defaults may be open or relaxed for file sharing purpose. For example, if a text file has 666 permissions, it grants read and write permission to everyone. Similarly a directory with 777 permissions, grants read, write, and execute permission to everyone.


You can setup umask in /etc/bashrc or /etc/profile file for all users. By default most Linux machines set it to 0022 (022) or 0002 (002). 
Open /etc/profile or ~/.bashrc file, enter:
# vi /etc/profile

OR

# vi ~/.bashrc

Append/modify following line to setup a new umask:

umask 022

Save and close the file. Changes will take effect after next login. All UNIX users can override the system umask defaults in their /etc/profile file, ~/.profile (Korn / Bourne shell) ~/.cshrc file (C shells), ~/.bash_profile (Bash shell) or ~/.login file (defines the user's environment at login).

63.how to display the list of specific  port ?
Ans. netstat -ntlp | grep <service daemon name>


68.what is SFTP?
Ans.secure file transfer protocol, a network protocol for secure file transfer over a secure shell.


69.Top responding slowly..other option to check load average?
Ans. vmstat

71.Difference between crontab and at ?
list crontab entry?
Ans.crontab -l

72.what is MTA?
Ans. Mail Transfer Agent

73.while install rpm package, progress reports already use , but  no package name doesn't exist in rpm  list ?
Ans. rpm --reinstall <package name>

74.create user in different directory?
Ans. useradd -m -d  /newdir/<username>  username

3 comments: