Hi Friends...i planned to update interview questions and answers for LINUX admins. Hope this will help you to refresh your knowledge at the time of interview perparation.
Few points before start,
1.Be Clear and Frank while prepare resume. Since mostly question wil be asked based on ur resume.
2.Try to focus more about ur day to day job in resume.
3.Make sure you are clear in basic Linux such as booting, LVM, Architecture, servermodel which you worked.
4.Before give interview write down your day to day work , server model information ,your current environment details and review your self.
5.Dont prepare upto last minute it will spoil your mood and confidence.
6.Once interview over note down the Question which they asked. It will help for next interview.
For L1 & L2 Admin Interview:
Maximum the Question will be on below area
1.Booting procedure of linux server
2.user administration
3.LVM -FS creation/ extend / FS issues & recover
4.Software install / remove / update - RPM or YUM
5.Basic services config /troubleshoot - E.G : NFS ,FTP , SAMBA , DNS , DHCP
6.Utilization issues - CPU , MEMORY , DISK
7.Hardware errors and troubleshoot
8.PAtch installation / roll back
Ok Now we can start look into questions and answers
QUESTIONS :
1.Explain Booting Procedure?
2.What is stage 1.5 Bootloader ?
3.How will you reinstall GRUB?
4.How to resolve booting issues in linux?
5.How to reset root password or recover root password
6.What is Super Block? How will you recover it?
Question 1: Explain Booting procedure or steps in Linux?
1. Once System powered on, it automatically invokes BIOS
2. BIOS will start the processor and perform a POST [power on self test] to check the connected device are ready to use and are working properly.
3. After POST , BIOS will check for the booting device. The boot sector is always the first sector of the hard disk and BIOS will load the MBR into the memory.
MBR holds the boot loader of the OS.
4. Then boot loader takes the control of the booting process.
5. GRUB is the boot loader for Linux.
6. Depending on the boot option selected the kernel is loaded first.
7. After kernel is loaded the kernel will take the control of the booting process
8. Initrd will be loaded which contains drivers to detect hardware (its called Initialization of RAM Disk)
9. Then it will initialize all the hardware including I/O processors etc.
10. Kernel will mounts the root partition as read-only
11. INIT is loaded as the first process.
12. INIT will mount the root partition and other partitions as read/write and checks for file system errors.
13. Sets the System Clock, hostname etc..
14. Based on the Runlevel, it will load the services and runs the startup scripts which are located in /etc/rcX.d/ (Network, nfs, SSH etc.)
15. Finally it runs the rc.local script & Now the login prompt will appear.
Question 2: What is stage 1.5 boot loaded in linux?
The great thing about GRUB is that it includes knowledge of Linux file systems. Instead of using raw sectors on the disk, as LILO does,
GRUB can load a Linux kernel from an ext2 or ext3 file system. It does this by making the two-stage boot loader into a three-stage boot loader.
A. Stage 1.5 boot loader , it contains extra coe to allow cylinders above 1024, or LBA type drives, to be read.
B. It will be stored on MBR or Boot partition .
C. Stage 1 (MBR) boots a stage 1.5 boot loader that understands the particular file system containing the Linux kernel image.
D. Basically this module will load the knowledge of Filesystem to Grub to read the kernel
so ,
Stage 1 Boot loaded is : MBR
Stage 1.5 Boo loader : e2fs_stage1_5
Stage 2 Boot loader is : GRUB
Question 3: How to reinstall GRUB?
A.Boot up using RHEL4 disk.
B.Enter into rescue mode
#linux rescue (hit ok)
C. Then follow below commands
# chroot /mnt/sysimage
# grub
# find /boot/grub/stage1 or find /grub/stage1
root(hd0,0) //example o/p
Now install the GRUB
# setup (hd0)
# EXIT
Another Method
#linux rescue
# chroot /mnt/sysimage
# /sbin/grub-install /dev/hda
Question 4: Linux Booting Issues : How to solve ??
Option 1: init not found error
Option 2: Run fsck on all FS in rescue mode
Option 3: Reinstall GRUB
Option 4: Recover grub.conf / grub configuration
Option 1: For normal panic and "init not found" error.
Error : "init not found" displayed
1) Launch the system to Bash shell prompt
Reboot the server and interrupt to edit the GRUB.
Edit grub and enter the below in last
init=/bin/bash
Then save and exit and boot the server. This will launch you straight into a Bash shell prompt.Then you can remount “/” file system and check /var/log/messages for any error.
Note : init=/bin/bash (Grub boot loader) or linux init=/bin/bash (if Lilo boot loader).
2) Once server booted and if it is in Bash shell prompt
#mount -o remount,rw /
3) Now you can check the log messages and try to find the reason for server pacnic or error.
#more /var/log/messages
Option 2: If the above option not helped then follow the next
1) Boot from the Linux First CD (boot CD).
2) Type “boot rescue” at Linux boot prompt.
3) After the bash shell prompt show up, type the below command
# chroot /mnt/sysimage
a) Run fsck and Check for any disk error
#fdisk -l /dev/sda //check how many partion you have
then run fsck on each partition
#fsck -y /dev/sda2'
Option 3: If the above also not helped then reinstall grub and retry.
In rescue mode.
# chroot /mnt/sysimage
# /sbin/grub-install /dev/hda
Option 4: If a system has issues with the GRUB configuration
(possibly caused by incorrect changes to the the GRUB configuration file, installation of another OS, changes to device ordering due to hardware or BIOS changes, etc.)
# grub> find /boot/grub/grub.conf (or) grub>find /grub/grub.conf (or) find /boot/grub/stage1
(hd0,1)
(hd1,2)
>> This tells us that we have two /boot partitions. Then we have to reinstall the GRUB config on disk (one by one) and try.
#grub> root (hd0,1) //Write the GRUB bootloader on the MBR of the first disk
grub> setup (hd0)
grub>quit
If you have doubt as to where the root partition is located then try to find a file in /etc.
#grub> find /etc/fstab
(hd0,1)
Note: You must pay attention to your devices, for me "hd0" is the root disk and (hd0,1) is /boot partition , and (hd0,1) is my ROOT (/) partition. mostly / "root" partion will be on LVM.
You might not even have "hd0" mapped out. Review your "/boot/grub/device.map" file
#cat /boot/grub/device.map
Question 5 : How to recover or rest Root password in LINUX?
While booting
1. Select the kernel
2. Press the "e" key to edit the entry
3. Select second line (the line starting with the word kernel)
4. Press the "e" key to edit kernel entry so that you can append single user mode
5. Append the letter "S" (or word Single) to the end of the (kernel) line
6. Press ENTER key
7. Now press the b key to boot the Linux kernel into single user mode
8. At prompt type passwd command to reset password:
You need to mount at least / and other partitions:
# mount -t proc proc /proc
# mount -o remount,rw /
Change the root password,
# passwd
thenreboot system:
# sync
# reboot
Question 6: What is super Block and how will u recover it ?
The blocks used for two different purpose:
1. Most blocks stores user data aka files (user data).
2. Some blocks in every file system store the file system's metadata.
So what the hell is a metadata?
File system type
Size
Status
Information about other metadata structures
To find super block
#dumpe2fs /dev/sda3|grep -i superblock
or
# mke2fs -n /dev/sda3
To repair file system by alternative-superblock use command as follows:
# e2fsck -f -b 8193 /dev/sda3
No comments:
Post a Comment