Extended Questions
Extended Questions
Ans: In multi-processor realtime systems, it is sometimes desirable to isolate some CPUs in the system to
enhance their capability to maintain realtime performance. Normally, when the Linux kernel is running in
an SMP configuration, any CPU may take an interrupt or run a process.
#lstopo-no-graphics --no-io --no-legend --of txt
#numactl –hardware
Activate the tuned profile using the tuned-adm utility and then reboot:
# tuned-adm profile realtime
# reboot
Upon reboot, verify that the selected CPUs have been isolated by searching for the isolcpus
parameter at the boot command line:
# cat /proc/cmdline | grep isolcpus
BOOT_IMAGE=/vmlinuz-3.10.0-394.rt56.276.el7.x86_64 root=/dev/mapper/rhel_foo-root ro crashkernel=auto
rd.lvm.lv=rhel_foo/root rd.lvm.lv=rhel_foo/swap console=ttyS0,115200n81 isolcpus=0,4
2) A system is utilizing 100% memory and there is no process running, we knew that rebooting the system will fix
the issue, but how to fix the issue without taking a reboot)
Ans: Linux Server capacity indicates 100% used even after log files have been emptied
If you remove a file that's still open (a process still has it open) the space will not be free'd until that process is
either killed or sent a HUP signal.
If the files removed were from syslog (sysklogd or rsyslog) restart or reload the daemon.
If the files removed were part of Apache or some other web service restart that service.
If this is a custom application restart it. Alternatively, you can try sending a HUP signal (kill -HUP PID) to see if
it will close the file and re-open it.
If you don't know what the process is that has the file open you can use lsof to find open deleted files.
$ lsof -P -n | grep deleted
cat 12313 gene 1w REG 8,1 0 3129916 /tmp/stackexchange.log (deleted)
3) LVM commands are not working, whereas file systems are mounted and those are under LVM (LVM cache).
What could be cause of the issue?
Ans:
Issue System unable to boot receives lvm errors and unable to find root filesystem.
Booting into rescue mode and executing lvm command, it throws error
# lvs
-bash: lvs: command not found
[root@ ~]# lvdisplay
-bash: lvdisplay: command not found
Solution
System seems to be missing the lvm binary files under /sbin folder .
Reinstall the lvm2 package in rescue mode and check to see if all binaries are now made available in /sbin folder.
# yum reinstall lvm2
Root Cause
lvdisplay display binaries were missing
#ls -al /sbin/lv*
ls: /sbin/lv*: No such file or directory
Diagnostic Steps
# which lvdisplay
/sbin/lvdisplay
#ls -al /sbin/lv*
ls: /sbin/lv*: No such file or directory
4) LVM partial errors, how to fix the issue and what is the possible cause of that error?
Fixing LVM I/O Errors:
Example : Reason of this could be because removing the disk/LUN’s without clean shutdown/unmount or de-
attaching disks from LV’s . “ /dev/sdf: read failed after 0 of 4096 at 0: Input/output error “
Solution :
1) Check which Volume Group have the issue , run “vgscan” command .
2) Find out the Logical Volumes attached with that Volume Group .
3) Inactive the logical volumes as :
# lvchange -an <lv-name>
4) Inactive Volume group as :
# vgchange -an <vg-name>
5) Again Scan Volume group using “vgscan” .
6) Now activate the Volume Group :
# vgchange -ay <volume-group-name>
7) Run command “lvscan” , the error should be gone now .
8) Now activate the Logical Volume Name :
# lvchange -ay <lv-name>
5) How we can Share the file systems from Linux to window server without samba server?
Ans: Method: 1 : You can access your Windows share from the Linux command line using the smbclient program.
# sudo apt-get install smbclient
Method: 2 : Using Konqueror
Many Linux distributions use the KDE desktop environment and the Konqueror file manager/browser. If this is
what you are using, you can follow these steps to access your Windows shared folder:
1. Click the K menu icon.
2. Select Internet -> Konqueror.
3. In the Konqueror window that opens, click the Network Folders link, or type remote:/ in the address
bar and press Enter.
4. Click the Samba Shares icon.
5. Click the icon of your Windows Home workgroup.
6. Click the Workgroup icon.
7. Click the icon for your computer.
8. When prompted, enter the username and password for the Windows account that created the share.
9. Click OK.
6) How to make a modification manually in initrd image. Let’s see, we got an ISO image and we need to make a
change in that, after that we have to compress it back so that it can work properly. How will u do that?
Ans: initrd.img is a compressed cpio archive. Compression method depends on the vendor/person who delivers
and it could be gzip, lzma etc. So to view the contents of initrd.img you have to do,
Method:1
1. Decompress the initrd.img.
o find the type of compression using file command.
file initrd.img
o then decompress according to the type of compression
Ex 1: if gzipped,
mv initrd.img initrd.img.gz
gunzip initrd.img.gz
Ex 2: if lzma compressed ,
mv initrd.img initrd.img.lzma
unlzma initrd.img.lzma (you can use xz command also to decompress as shown
below).
2. Extract the cpio archive.
o mkdir initrd_new
o cd initrd_new
o cpio -id < ../initrd.img
3. View the contents and make the required changes.
4. Pack the cpio archive.
o Repack the modified cpio in newc format.
find . | cpio -o --format='newc' > ../initrd_new.img
2. Compress the cpio archive using any of the compression method need not to be same as original
compression method. Compression is an optional step and recommended to use.
Ex: Modifying the RHEL initrd.img
Extract the initrd.img
Extract the initrd.img provided by the RedHat. Redhat initrd.img is an lzma compressed cpio archive. First
uncompress the lzma file and then extract the cpio.
mv initrd.img initrd.img.xz
xz --format=lzma initrd.img.xz --decompress
mkdir initrd_mod
cd initrd_mod
cpio -id < ../initrd.img
Modify the initrd contents.
Repack the initrd.img back
Once the required the changes are made, pack the initrd and compress it back. Remember to create the cpio
archive in newc format.
find . | cpio --create --format='newc' > ../initrd.img
cd ..
xz --format=lzma initrd.img
mv initrd.img.xz initrd.img
The $(uname -r) will use the file for the current kernel version. You may also specify a specific file, such
as:
file /boot/initramfs-2.6.32-754.el6.x86_64.img
Select the appropriate instructions below to extract or repack the correct image type for your system.
gzip format - Extract / Uncompress
Uncompress and extract the contents of the image in the /boot/ directory:
zcat /boot/initrd-$(uname -r).img | cpio -idmv
gzip format - Repack / Recompress
Still in the working directory, find all files and add them to a new boot image file:
find . | cpio -o -c | gzip -9 > /boot/new.img
Uncompress and extract the contents of the image in the /boot/ directory:
/usr/lib/dracut/skipcpio /boot/initramfs-$(uname -r).img | gunzip -c | cpio –idmv
The $(uname -r) will use the file for the current kernel version. You may also specify a specific file, such as:
/usr/lib/dracut/skipcpio /boot/initramfs-3.10.0-957.el7.x86_64.img | gunzip -c | cpio –idmv
You may now view the contents of the boot image and interact with them:
# ls
bin dev etc init lib lib64 proc root run sbin shutdown sys sysroot tmp usr var
Root Cause
The initramfs file now stores both CPU microcode and the initial boot image in the one "combined" image file.
The CPU microcode is stored with CPIO compression, then the boot image is stored with its own separate
compression.
The kernel processes the one "combined" image file, uncompresses and loads the CPU microcode into the CPU,
then uncompresses the boot image and starts init.
When viewing this combined image file on a booted system, it is necessary to use skipcpio to "skip past" the
CPIO-compressed CPU microcode to access the boot image.
8) what is Linear in LV
Ans: Linear Volumes. A linear volume aggregates multiple physical volumes into one logical volume. For example, if
you have two 60GB disks, you can create a 120GB logical volume. The physical storage is concatenated. Creating a
linear volume assigns a range of physical extents to an area of a logical volume in order.
PVMOVE
For this move the following PV command should be used:
# pvmove -n lv_warehouse [source-PV] [destination-PV]
That means that in the case of lv_data02, the command should look like this:
# pvmove -n lv_data02 /dev/sdb /dev/sdbp
11) sometime, while PVMOVE , it may stuck so what is the possible cause and how to fix that?
Issue
When trying to execute a pvmove where the physical volume holds more than one logical volume the process
hangs and fails to complete.
Pvmove hangs when there are other I/O operations occurring on the physical volume
solution
A workaround exists. To avoid the hang, use the '-n" option of pvmove to move only one LV at a time.
o Example:
List of LVS in VG: lvs --noheadings -o name $vg
Move one LV: pvmove -i0 -n $lvname
If a pvmove hang occurred, is in progress, please refer to the knowledge base article "How to recover from a
stopped or cancelled pvmove" for recovery steps.
Root Cause
Known issue involving the suspend/resume cycle of pvmove under certain logical volume configurations.
Diagnostic Steps
To determine whether any LVs share a PV, you can use the below script. If any of the PVs listed show
more than 1 LV on it, you should use "pvmove -n" to move them individually.
# for p in `pvs --noheadings -oname`; do echo "LVs on" $p; lvs --noheadings -oname,devices | grep -c $p; done
LVs on /dev/sda2
5
LVs on /dev/sdb
2
LVs on /dev/sdc
0
12) how to create a striped logical volume and what is striping in LVM?
Ans: # lvcreate -L 50G -i2 -I64 -n gfslv vg0
The following command creates a striped volume 100 extents in size that stripes across two physical volumes,
is named stripelv and is in volume group testvg . The stripe will use sectors 0-49 of /dev/sda1 and sectors 50-
99 of /dev/sdb1 .
13) A few LUNs are showing failed in multipath & storage team has confirmed that there is no issue from their end.
what could be possible cause of the issue from OS end and how to fix it.
Ans: Issue : RHEL 6.10 system attached to HP P9500 Storage Array SAN is showing 1 of 4 LUN paths as
faulty. All LUN's are showing the second path as failed.
2:0:1:0 sdae 65:224 0 [undef][faulty] HP,OPEN-V
2:0:1:1 sdaf 65:240 0 [undef][faulty] HP,OPEN-V
2:0:1:2 sdag 66:0 0 [undef][faulty] HP,OPEN-V
solution
If a closed ELS event was received, that would explain the lack of connectivity. To reinitialize the exchange, a
LIP would need to be issued for the faulty host. As an example, this can be performed by the following:
# echo 1 > /sys/class/fc_host/host2/issue_lip
The above should reinitialize the login exchange and bring the paths back once a successful path_checker iteration
completes.
Root Cause
There is a FCP Target port in 'Not Present' port_state and it was determined that there was a configuration change
on the port that cause the port to go down:
Class Device = "0-3"
Class Device path = "/sys/class/fc_remote_ports/rport-2:0-3"
dev_loss_tmo = "30"
fast_io_fail_tmo = "off"
maxframe_size = "4294967295 bytes"
node_name = "0xffffffffffffffff"
port_id = "0xffffffff"
port_name = "0x50060e8016049100"
port_state = "Not Present"
roles = "unknown"
scsi_target_id = "1"
If an FCP Target port does not respond within dev_loss_tmo, the port is placed in 'Not Present' state and access to
targets are blocked, the signature remains to persist the scsi target id binding in case the port is re-established.
All IO, including the multipathd path_checker are blocked.
Diagnostic Steps
Get the output of the following commands:
# systool -c fc_remote_ports -v
# systool -c fc_host -v
# for d in $(ls /sys/block |grep sd); do echo $d - `cat /sys/block/$d/device/state`; done
17)How to check the status of network bonding? What are the different modes of Network bonding in Linux ?
Ans: # cat /proc/net/bonding/bond0
# ifconfig | grep -i bond
# cat /etc/sysconfig/network-scripts/ifcfg-bond0
There are 7 types of Network Bonding:
1. mode=0 (Balance Round Robin)
2. mode=1 (Active backup) ⇒ Explained in this tutorial.
3. mode=2 (Balance XOR)
4. mode=3 (Broadcast)
5. mode=4 (802.3ad)
6. mode=5 (Balance TLB (Adaptive transmit load balancing))
7. mode=6 (Balance ALB (Adaptive load balancing))
18)How to upgrade Kernel in Linux ? list some of the Linux performing tuning done on a linux server?
Ans:
1. Login as root user
2. Check for updates using the yum check-update command
3. Update the system using the yum update command
4. Reboot the server/box using the reboot command
5. Verify new kernel and updates
Step 1 – Note down the current kernel version
Type the following uname command or cat command to view RHEL kernel version and OS info:
$ uname -a
$ uname -r
$ cat /etc/os-release
Step 2 – Backups
Make a backup – it cannot be stressed enough how important it is to make a backup of your system before you
do this. Most of the actions listed in this post are written with the assumption that they will be executed by the
root user running the bash or any other modern shell.
Step 3 – Check for updates
Type the following yum command:
$ sudo yum check-update
Step 4 – Apply/install updates
Type the following yum command:
$ sudo yum update -y
Step 4 – Reboot the RHEL 7.4 box
Type the following reboot command or shutdown command:
$ sudo reboot
OR
$ sudo shutdown -r now
Step 3 – Verify the RHEL 7.5 update
Type the following commands:
$ uname -a
$ uname -r
$ cat /etc/os-release
$ tail -f /var/log/logfilenames
$ dmesg | grep -i 'err|warn|cri'
$ ss –tulpn
Method-2:
Performing the Upgrade
[root@lab ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[root@lab ~]# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Updating / installing...
1:elrepo-release-7.0-3.el7.elrepo ################################# [100%]
25) what is the difference between a drvier and firmware? how do you update a firmware on a server?
Ans: Device drivers are operating system-specific and hardware-dependent. A device driver acts as a translator between
the hardware device and the programs or operating systems that use it.
Firmware is a software program permanently etched into a hardware device such as a keyboards, hard drive, BIOS, or
video cards.
26)how you check RAID status on a Linux server?
Ans: # cat /etc/mdadm.conf
Or
#cat /proc/mdstat
28)System got rebooted automatically? How do you find the root cause?
30)The system simply hangs after POST. The screen is completely blank. The option to Boot Installed Systems are not
available? How do you fix this issue?
38)How to find out if some one did rm -rf command in Linux server.