Tuesday, July 14, 2015

how to fix the RPM stuck problem

how to fix the RPM stuck problem 
when running rpm -qa |grep something , then it gets stuck forever ...

It's problably due to the a huge number of RPM process ...

I was suggested to do the following: 
  • ps -ef|grep rpm |awk '{print $2}' | xargs kill -9
  • cd /var/lib/rpm/
  • ls
  • rm -f  __*


Other related links: 
http://unix.stackexchange.com/questions/166966/rpm-command-stuck-freeze-when-installing-rpm-file



rpm may be waiting for a lock to be freed.
First, run ps -ef | grep rpm to see if you have any RPM commands running. If you do, kill them using kill -9.
Next, delete any leftover locks rm -rf /var/lib/rpm/__db.0*

Tuesday, June 23, 2015

NFS and Shared Folder creation between servers


Install NFS on all your servers

yum install nfs-utils -y
service rpcbind start
service nfs start
service autofs restart

NFS server side

Then, in your "NFS server", create the shared folder (aka the folder to be shared)

mkdir /home/mich/SHARED_FOLDER
chmod a+w /home/mich/SHARED_FOLDER



Define the mount folder:

vi /etc/exports /home/mich/SHARED_FOLDER 192.168.1.0/24(rw,sync,no_root_squash,no_all_squash)
where the  192.168.1.0/24 is the IP range of the servers authorized to access this mounted folders

In order to make the export change effective, type:
exportfs -a

then, do not forget to start nfs
/etc/init.d/nfs start

or even to start it automatically in startup:
for ex:

cat /etc/rc.d/rc.local 

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
depmod -a
modprobe acpiphp
if [ -f /etc/rc.firstboot ]
then
        /etc/rc.firstboot | tee /var/log/firstboot.log
        cp /etc/rc.firstboot /usr/local/etc/
        rm /etc/rc.firstboot
        reboot
fi
touch /var/lock/subsys/local
/etc/init.d/nfs start

NFS CLIENT side


Then, on each client side, that want to use this mount :


mkdir /nfs/shared
mount -t nfs 192.168.20.11:/home/mich/SHARED_FOLDER/ /nfs/shared/


where 192.168.20.11 is the IP of the NFS server that you've configured in the previous paragraph

or do it automatically after startup:
vi /etc/fstab

add something like:
192.168.20.11:/home/mich/SHARED_FOLDER/ /nfs/shared/  nfs rsize=8192,wsize=8192,timeo=14,intr

if you want to test it without reboot your machine, do simply
mount -a

All those instructions were freely and quite fully inspired from this link:


Thursday, June 18, 2015

Cannot delete file in Windows - it says Already

Ever tried to delete / move / rename a file , but Windows refuses, saying the file is already used by another program ...


In order to find this f$@@%! other file that prevent you to handle this file, you can use ProcessExplorer




Press on Find / Find Handle or DLL
write the name of your file



Credits goes to
http://superuser.com/questions/399659/how-can-i-identify-what-application-is-using-a-given-file


Thursday, March 12, 2015

Network Connection

In order to understand the spec of the network card being used by your server:

lspci | grep -i net

Here, as example of the status on my job's cloud : 


ro -a -o . -h els2 -s shared -irc %/ lspci | grep -i net
[ virginia / svpr-els204 ] - 03:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)        <<== which means 1 GB only
[ virginia / svpr-els204 ] - 03:00.1 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els204 ] - 03:00.2 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els204 ] - 03:00.3 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els205 ] - 03:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els205 ] - 03:00.1 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els205 ] - 03:00.2 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els205 ] - 03:00.3 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els206 ] - 03:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els206 ] - 03:00.1 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els206 ] - 03:00.2 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els206 ] - 03:00.3 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els207 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)             <<== this means the card is 10Gb/sec 
[ virginia / svpr-els207 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els208 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els208 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els209 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els209 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els21 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els21 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els210 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els210 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els211 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els211 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els212 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els212 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els22 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els22 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)


In addition, in order to understand the SWAP memory usage :

free -g 


 free -g             total       used       free     shared    buffers     cachedMem:           125        110         15          0          3         67-/+ buffers/cache:         39         86Swap:          128          0        128


==> Means that the OS has about 67+15 GB available

If you don't want to use swap (it may slow your server/application etc) 


  • swapoff -a   ==> do never use swap
  • sysctl vm.swappiness=0   ==> use swap only if you don't have any more choice
  • sysctl vm.swappiness=60   ==> use swap only if you reach more than 60% of the memory
  • swapon -a ==> enable usage of SWAP, according to the swappiness value 
  •  sysctl -a |grep swap  : to understand what is the % policy value.


Using top, you can have the following:

Mem:  132119828k total, 131341592k used,   778236k free,  3505520k buffers
Swap: 134365176k total,    88752k used, 134276424k free, 105451036k cached  <<== this is the FULL RAM available

More info regarding swap can be found: 
http://askubuntu.com/questions/103915/how-do-i-configure-swappiness


Tuesday, February 24, 2015

How to characterize stength of a server

In order to understand your server, what is its strenght, its OS version, how many cpu, here is a short list of commands that may help



free -m
             total       used       free     shared    buffers     cached
Mem:          3832       3605        226          0        375       1038
-/+ buffers/cache:       2192       1640
Swap:         4031        126       3905

In this case, we can see the server has about 4GB RAM .



top  (and then click on 1)

top - 18:26:24 up 169 days,  7:07,  3 users,  load average: 0.03, 0.08, 0.08
Tasks: 133 total,   1 running, 130 sleeping,   0 stopped,   2 zombie
Cpu0  :  2.9%us,  0.7%sy,  0.0%ni, 95.9%id,  0.5%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  :  1.4%us,  0.5%sy,  0.0%ni, 97.5%id,  0.6%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   3924684k total,  3658548k used,   266136k free,   380324k buffers
Swap:  4128760k total,   130752k used,  3998008k free,  1035372k cached

Here, we can see that we have 2 CPU (2 core) and still about 4 GB RAM


df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_root-lv_root
                       20G  5.1G   14G  27% /
tmpfs                 1.9G     0  1.9G   0% /dev/shm
/dev/sda1             146M   60M   79M  44% /boot
/dev/mapper/vg_root-lv_home
                      4.0G  137M  3.7G   4% /home
/dev/mapper/vg_root-lv_liveperson
                       28G  987M   26G   4% /liveperson
/dev/mapper/vg_root-lv_tmp
                      4.0G  143M  3.6G   4% /tmp

This command enables to understand the disk partition ... How many storage you have etc ,,,


cat /etc/issue
CentOS release 6.6 (Final)
Kernel \r on an \m

This last command shows you which OS you run on and what is its version.
Here, we use CentOS version 6.6 release.