Linux Scroll

Just another site

Category Archives: centos

Rescan new SCSI bus in linux

To detect new SCSI disk/dev in linux:

# echo "- - -" > /sys/class/scsi_host//scan

# fdisk -l

To detect new SCSI fibre channel disk/LUN in linux:

# echo "1" > /sys/class/fc_host/host#/issue_lip

Script similar to hp_rescan:


# $Id: 48 2008-03-11 12:37:48Z ajo $

# This script will rescan all found FC HBAs for (new) LUNs
# Beware that it will generate failover events (in multipathd for
# instance)

if [ -f /usr/sbin/hp_rescan ]
echo "hp_rescan found - use that instead"
exit 0

for host in $(ls -d /sys/class/fc_host/host*)
echo "Rescanning $host"
echo 1 > /sys/class/fc_host/$host/issue_lip
sleep 5
echo "- - -" > /sys/class/scsi_host/$host/scan

Centos add persistence static route

Static route configuration file:

/etc/sysconfig/network-scripts/route-interface file

Static route conf file for eth0:


IP Command Arguments Format
The following is a sample route-eth0 file using the IP command arguments format. The default gateway is, interface eth0. The two static routes are for the and networks:

default dev eth0 via dev eth0 via dev eth0

Network/Netmask Directives Format
The following is a sample route-eth0 file using the network/netmask directives format. The default gateway is, interface eth0. The two static routes are for the and networks:



The and networks would use the default gateway anyway.

Fedora install flash player

Install flash player in Fedora:

$ rpm -ivh

$ rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
$ yum check-update


$ yum install flash-plugin nspluginwrapper alsa-plugins-pulseaudio libcurl


# yum install flash-plugin nspluginwrapper.x86_64 nspluginwrapper.i686 \

alsa-plugins-pluseaudio.i686 libcurl.i686


(From Centos Documentation)
Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.

So, if:

M = Amount of RAM in GB, and S = Amount of swap in GB, then

If M < 2

S = M *2
S = M + 2

Using this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.

For systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).

Extract rpm deb packages

Extract rpm package:

$ rpm2cpio installer.rpm | cpio -idv

Extract deb package:

$ dpkg-deb -x installer.deb ~/Desktop/

Show RPM packages architecture

Show RPM packages architecture:

su -c 'echo "%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}" >>  


Show architecture for installed rpm:

# rpm -q --queryformat "%{name}.%{arch}\n" glibc-debuginfo-2.9-13.2

YUM – Yellow Dog Updater

YUM use in Redhat, Fedora, Centos. YUM is powerful software utility used to automatically update and install/remove rpm packages.

Keep the Yum cache for future use:

$ vi /etc/yum.conf


Yum cache directory:


Yum install fastest mirror:

$ yum install yum-fastestmirror

Only install security update:

$ yum install yum-security

$ yum --security update

Skip broken dependency:

$ yum install yum-skipbroken

$ yum --skip-broken update

Lists the packages that are not installed but available:

$ yum list php

Lists updates that are available for the installed packages:

$ yum list updates php

Lists all the installed packages:

$ yum list installed php

Install php:

$ yum install php

Remove php:

$ yum remove php

Update php:

$ yum update php

Info php:

$ yum info php

yum whatprovides [file name]:

$ yum whatprovides /usr/bin/php

Group install:

$ yum groupinstall "Development Tools"

$ yum groupinstall "Development Libraries"

Group list:

$ yum grouplist "Development Tools"

Group remove:

$ yum groupremove "Development Tools"

RPM – RPM Package Manager

RPM use in Redhat, Fedora, Suse, Centos.

Using RPM to Install Packages:

$ rpm -ivh package.rpm

* i – install
* v – verbose
* h – hash

Using RPM to Upgrade Packages:

$ rpm -Uvh package.rpm

* U – Upgrade

Using RPM to Erase Packages:

$ rpm -ev package.rpm

* e – erase

Using RPM to Query installed Packages:

$ rpm -qa | grep -i package

* q – query
* a – all

Display all recently installed rpm:

$ rpm -qa --last

Display thunderbird installed info:

$ rpm -qi thunderbird

* i – Display detail

Find out what dependencies a rpm file need:

$ rpm -qpR package.rpm 

* p – Package

Verify all installed package:

$ rpm -Va

RPM Database