Wednesday, November 24, 2010

How to mount ntfs filesystem in Linux

Mounting NTFS file system on Linux (read only mode)

1. First check for ntfs kernel support
cd /lib/modules/2.6.18-92.el5/kernel/fs/ | grep ntfs

2. List the partitions
fdisk -l
to list only ntfs partitions
fdisk -l | grep NTFS

3. Mount ntfs parition

mount -t ntfs /dev/sda1 /mnt/windows
replace /dev/sda1 with the respective parition on your harddisk
replace /mnt/windows with the respective mount on your harddisk


Read More !

Tuesday, June 8, 2010

How to count files in a directory in linux

count files in a directory : ls -1 | wc -l
count files including hidden files : ls -1a | wc -l

Read More !

Tuesday, June 1, 2010

How to resolve Squid error

Error message when restarting squid :

Error message : squid: ERROR: Could not send signal 0 to process 20348: (3) No such process

Solution :

Executed the following command for detailed squid log /path/to/sbin/squid -DNYCd3 .
Error was due to /var partition being full where squid creates the pid file and other logs.
Cleared the /var parition and squid started working perfectly fine.

Read More !

Monday, May 24, 2010

How to configure LVM (Logical Volume Management)

A 5 Step guide to LVM (logical volume management)

1. Prepare partitions for lvm

pvcreate /dev/hardisk /dev/hardisk

example : pvcreate /dev/sda1 /dev/sdb1

pvdisplay - to display physical volumes

2. next create volume group with each physical volume

vgcreate
/dev/hardisk /dev/hardisk
example : vgcreate fileserver /dev/sda1 /dev/sdb1

vgdisplay - to display volume group

3. next create logical volumes

lvcreate --name --size xxG

example : lvcreate --name share --size 25G fileserver

4. create filesystem

mkfs.ext3 /dev//

example : mkfs.ext3 /dev/fileserver/share

5. mount the logical volume

mount /dev/fileserver/share /var/share
Read More !

Nagios client installation guide

if xinetd is not installed, install it.

1. add nagios user and set a password.

2. create nagcmd group and add nagios and apache to it.
(used to issue commands directly from web interface)

/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache


3. download and install nagios plugin

cd /home/downloads
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
tar xfv nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.11

./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install


4. change the permissions

chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec


5. download and install nrpe plugin (nrpe uses 5666)

cd /home/downloads
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
tar xfv nrpe-2.12.tar.gz
cd nrpe-2.12

./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd


6. nrpe configuration

vim /etc/xinetd.d/nrpe

only_from = 127.0.0.1 (change to nagios server ip address)

7. add nrpe port to services file

vim /etc/services

nrpe 5666/tcp # NRPE


8. service xinetd restart

9. testing nrpe

netstat -at |grep nrpe

output : tcp 0 0 *:nrpe *.* LISTEN

Read More !