Labels

hpunix (63) marathi kavita (52) linux (21) solaris11 (10) AWS (5) numerology (5)

Friday, March 3, 2017

Linux Query or Interview question - 4

Query 1. Why we put ‘- - -‘ in echo command which we use for scanning the lun.

Ans: We use below command to scan the new luns/disks.

[root@ testmachine~]# cd /sys/class/scsi_host/
[root@ testmachine scsi_host]# ls
host0  host1  host2
[root@ testmachine scsi_host]# echo “- - -“ > /sys/class/scsi_host/host0/scan
[root@ testmachine scsi_host]# echo “- - -“ > /sys/class/scsi_host/host1/scan
[root@ testmachine scsi_host]# echo “- - -“ > /sys/class/scsi_host/host2/scan

“- - -“ means we are echoing wild card entries of “Channel, SCSI targe ID & LUN” respectively and scanning it. So the OS will scan the device path connected to that particular host.

If the Luns are coming from HBA (fiber channel) then the echo command will slightly get differ.
[root@ testmachine~]# cd /sys/class/fc_host/
[root@ testmachine scsi_host]# ls
host0  host1 
[root@ testmachine fc_host]# echo “- - -“ > /sys/class/fc_host/host0/scan
[root@ testmachine fc_host]# echo “- - -“ > /sys/class/fc_host/host1/scan

After scanning of luns, if you still unable to see them then use below command.

[root@ testmachine fc_host]# echo 1 > /sys/class/fc_host/host/issue_lip

issue_lip refreshes the scsi bus (fiber channel interconnect).

Query 2. How to indentify CPU & core information.

1.a. Run lscpu command.
Socket =1 shows we have 1 CPU socket, nothing but 1 CPU
Core per socket = 4 shows that we are having 4 core in 1 socket.
Thread per core = 2 shows multithreading is there

CPU 8 = show logical cpu. We are having 8 logical CPU. (1*4*2 = 8)

[root@ testmachine:/root]lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-7
Thread(s) per core:    2
Core(s) per socket:    4
Socket(s):             1

1.b.To see CPU which are online in extended readable format.

[root@ testmachine:/root]lscpu -b -e
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE
0   0    0      0    0:0:0:0       yes
1   0    0      1    1:1:1:0       yes
2   0    0      2    2:2:2:0       yes
3   0    0      3    3:3:3:0       yes
4   0    0      0    0:0:0:0       yes
5   0    0      1    1:1:1:0       yes
6   0    0      2    2:2:2:0       yes
7   0    0      3    3:3:3:0       yes

2.In /proc/cpuinfo, the “Physical ID” shows number of CPU’s. 
In our case,
Physical id = 0 means we are having   only 1 CPU.

[root@ testmachine:/root]grep -i "physical id" /proc/cpuinfo
physical id     : 0
physical id     : 0
physical id     : 0
physical id     : 0
physical id     : 0
physical id     : 0
physical id     : 0
physical id     : 0


Thanks & Regards,
Kirann Jadhav




No comments:

Post a Comment