Archive for the ‘Redhat’ Category


Plain and simple of how to extend a volumn group in RHEL

Amusing you already added a Virtual disk and its presented to the server . If not check my this post.

[root@aurhel05 ~]# fdisk /dev/sdb

The number of cylinders for this disk is set to 3916.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-3916, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-3916, default 3916):
Using default value 3916

Command (m for help): p

Disk /dev/sdb: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        3916    31455238+  83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@aurhel05 ~]# fdisk -l

Disk /dev/sda: 32.2 GB, 32259548160 bytes
255 heads, 63 sectors/track, 3922 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         131     1052226   83  Linux
/dev/sda2             132         784     5245222+  83  Linux
/dev/sda3             785        1437     5245222+  83  Linux
/dev/sda4            1438        3918    19928632+   5  Extended
/dev/sda5            1438        1698     2096451   83  Linux
/dev/sda6            1699        1959     2096451   82  Linux swap / Solaris
/dev/sda7            1960        2220     2096451   82  Linux swap / Solaris
/dev/sda8            2221        2481     2096451   83  Linux
/dev/sda9            2482        2612     1052226   83  Linux
/dev/sda10           2613        3918    10490413+  83  Linux

Disk /dev/sdb: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        3916    31455238+  83  Linux

[root@aurhel05 ~]# mkfs.ext3 /dev/sdb1

mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
3932160 inodes, 7863809 blocks
393190 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
240 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 25 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Extending the Volume VolGroup00-mysqldb by another 30GB :

1. Create a physical volume from a free disk or partition (e.g. /dev/sdb1 as a partition)
# pvcreate /dev/sdb1

2. Extend the volume group
# vgextend VolGroup00 /dev/sdb1

3. Extend the logical volume
# lvextend -L +30G /dev/mapper/VolGroup00-mysqldb

4. Extend an ext2/3/4 filesystem on the logical volume.
# resize2fs /dev/mapper/VolGroup00-mysqldb

 

Squirelmail Inbox error

Posted: February 24, 2016 in Redhat, Uncategorized

Problem:

After signing in , I was getting the following error for one of the inbox ..

ERROR: Could not complete request.
Query: SELECT “INBOX”
Reason Given: Internal error occured. Refer to server log for more information. [2016-02-21 13:25:45]

 

Solution :

  • Was checking the /var/log/maillog and got the following information –>  [Feb 24 16:05:18 griffin imap(appts.XXX): File isn’t in mbox format: /var/mail/appts.XXX]
  • Then open the file with any text editor like vi /var/mail/appts.XXX
    then Delete the garbage lines(one or two) at the beginning and save the file.

    Restart the service and everything shloud be OK now.

Canot Start Sendmail

Posted: March 17, 2015 in Redhat
Tags:

While trying to start sendmail it complains with the following error.

[root@augs-suatacd mail]# /etc/init.d/sendmail restart

Shutting down sm-client: [FAILED]
Shutting down sendmail: [FAILED]
Starting sendmail: 451 4.0.0 /etc/mail/sendmail.cf: line 87: fileclass: cannot open ‘/etc/mail/local-host-names’: World writable directory
451 4.0.0 /etc/mail/sendmail.cf: line 596: fileclass: cannot open ‘/etc/mail/trusted-users’: World writable directory
[FAILED]
Starting sm-client: /etc/mail/submit.cf: line 552: fileclass: cannot open ‘/etc/mail/trusted-users’: World writable directory
[FAILED]

Solution : 

Replacing line Fw/etc/mail/ local-host-names with line Fw-o /etc/mail/local-host-names in sendmail.cf, and Ft/etc/mail/trusted-users with line Ft-o /etc/mail/trusted-users in submit.cf and sendmail.cf.

Then restart Sendmail . Hope it will work.

Ashraf


This content is password protected. To view it please enter your password below:

Understanding the default output of “DIG”

Posted: October 14, 2011 in Redhat
Tags:

The most typical, simplest query is for a single host. By default, however, dig is pretty verbose. You probably don’t need all the information in the default output, but it’s probably worth knowing what it is. Below is an annotated query.

$ dig www.isc.org

That’s the command-line invocation of dig I used.

; <<>> DiG 9.2.3 <<>> www.isc.org
;; global options:  printcmd

The opening section of dig’s output tells us a little about itself (version 9.2.3) and the global options that are set (in this case, printcmd). This part of the output can be quelled by using the +nocmd option, but only if it’s the very first argument on the command line (even preceeding the host you’re querying).

;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43071
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 3

Here, dig tells us some technical details about the answer received from the DNS server. This section of the output can be toggled using the +[no]comments option—but beware that disabling the comments also turns off many section headers.

;; QUESTION SECTION:
;www.isc.org.                   IN      A

In the question section, dig reminds us of our query. The default query is for an Internet address (A). You can turn this output on or off using the +[no]question option.

;; ANSWER SECTION:
www.isc.org.            600     IN      A       204.152.184.88

Finally, we get our answer: the address of www.isc.org is 204.152.184.88. I don’t know why you’d ever want to turn off the answer, but you can toggle this section of the output using the +[no]answer option.

;; AUTHORITY SECTION:
isc.org.                2351    IN      NS      ns-int.isc.org.
isc.org.                2351    IN      NS      ns1.gnac.com.
isc.org.                2351    IN      NS      ns-ext.isc.org.

The authority section tells us what DNS servers can provide an authoritative answer to our query. In this example, isc.org has three name servers. You can toggle this section of the output using the +[no]authority option.

;; ADDITIONAL SECTION:
ns1.gnac.com.           171551  IN      A       209.182.216.75
ns-int.isc.org.         2351    IN      A       204.152.184.65
ns-int.isc.org.         2351    IN      AAAA    2001:4f8:0:2::15

The additional section typically includes the IP addresses of the DNS servers listed in the authority section. This section of the output can be toggled with the +[no]additional option.

;; Query time: 2046 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Aug 27 08:22:26 2004
;; MSG SIZE  rcvd: 173

The final section of the default output contains statistics about the query; it can be toggled with the +[no]stats option.

 

Ref : http://www.madboa.com/geek/dig/


Was trying to kickstart a RHEL5 this morning from CDROM in a VM but it was comming up with the following error

“Could not find kernel image : linux ”

Solution :

with some time spent  I came accross with the following solution for temporary . Hope this helps.

vmlinuz initrd=initrd.img ks=cdrom:/rhel5-liab-server-x86_64.cfg cdrom


Nice Script to display Date and time .
Ref : http://bashscript.blogspot.com/

#!/bin/bash
# SCRIPT: digclock.sh
# USAGE:  ./digiclock &
# PURPOSE: Displays time and date in the top right corner of the
#          screen using tput command.
# To stop this digclock use command "kill pid"
################################################################

####################### VARIABLE DECLARATION ###################

 # To place the clock on the appropriate column, subtract the
 # length of $Time and $Date, which is 22, from the total number
 # of columns

  Columns=$(tput cols)
  Startpoint=$(($Columns-22))

 # If you're in an X Window System terminal,you can resize the
 # window, and the clock will adjust its position because it is
 # displayed at the last column minus 22 characters.

  Color1=`tput setab 2`        # Green background color for time
  Color2=`tput setab 6`        # Cyan  background color for date
  Normal=`tput sgr0`           # back to normal screen colors

####################### MAIN PROGRAM ###########################

# The script is executed inside a while without conditions

while :
do
  Time=`date +%r`
  Date=`date +"%d-%m-%Y"`
  tput sc                   #Save the cursor position&attributes
  tput cup 0 $Startpoint

 # You can also use bellow one liner
 # tput cup 0 $((`tput cols`-22))
 # But it is not efficient to calculate cursor position for each
 # iteration. That's why I placed variable assignment before
 # beginning of the loop.

 # print time and date in the top right corner of the screen.

  echo -n $Color1$Time $Color2$Date$Normal

 # restore the cursor to whatever was its previous position

  tput rc

 # Delay for 1 second

  sleep 1

done

How to use RSYNC

Posted: May 26, 2011 in Linux-Scripts, Redhat
Tags:

How do I use rsync command?

if you would like to sync’d between www1 and www2(master) servers, type the following command on www1 server:rsync -avrR --links --rsh=/usr/bin/ssh WWW2:/var/html/ /var/htmlWhere,

  • -avrR : archive mode (a), verbose (v), recurse into directories (r), use relative path names (R) [ I did not use R in my scripts for simplicity ]
  • –links : copy symlinks as symlinks
  • –delete                delete files that dont exist on master
    –rsh=/usr/bin/ssh : Use to specify the remote shell ssh to use (secure copy).
  • WWW2:/var/html/ : WWW2 server IP address and path to synchronize to www1 server
  • /var/html : WWW1 server path

A sample shell script for same job

#/bin/bash

MASTER="10.90.0.33"
DIR="/u01/backups/WMS852/online/"
LDIR="/u04/wms852bkup/online"
SSH="/usr/bin/ssh"
rsync -avr --links --delete --rsh=$SSH $MASTER:$DIR $LDIR




SSH is strongly recommended but just in case if you need Telnet server…

In order to turn Telnet on make sure that you have install the telnet-server and telnet RPMs:

Code:
yum install telnet-server telnet

Or 

you can mount the RHEL DVD and copy Telnet RPM and run the following. ( /mnt/Server/telnet-server-0.17-39.el5.i386.rpm )
rpm - Uvh telnet-server-0.17-39.el5.i386.rpm

Open /etc/xinetd.d/telnet

Code:
vi /etc/xinetd.d/telnet

Make sure that disable = yes is changed to read disable = no.

Code:
disable = no

Type following to enable and start service on port 23:

Code:
chkconfig telnet on
chkconfig xinetd on
service xinetd restart

Warning

Quote:

Again, I recommend that you use SSH to connect to a system instead of Telnet for security purposes.

Ref : http://nixcraft.com


To Shutdown Oracle :

1. Log in to Oracle Server as user oracle . You can log in as root and then su to oracle as well.

[root@hkrhel33 ~]# su –
[root@hkrhel33 ~]# su oracle
[oracle@hkrhel33 root]$ ps -ef | grep pmon

root     25524 25413  0 15:14 pts/7    00:00:00 grep pmon
oracle   27243     1  0 May16 ?        00:00:06 ora_pmon_WMS852 <— This is DB name

[oracle@hkrhel33 root]$ . oraenv

ORACLE_SID = [ora_pmon_WMS852] ? WMS852
The Oracle base has been set to /u01/app/oracle
[oracle@hkrhel33 root]$ sqlplus ‘/as sysdba’

SQL*Plus: Release 11.2.0.2.0 Production on Thu May 19 15:22:53 2011

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Release 11.2.0.2.0 – 64bit Production

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit

To Start up Oracle :

[oracle@hkrhel33 root]$ ps -ef | grep pmon
oracle    4720  4516  0 15:42 pts/2    00:00:00 grep pmon
[oracle@hkrhel33 root]$ . oraenv
ORACLE_SID = [oracle] ? WMS852
The Oracle base has been set to /u01/app/oracle
[oracle@hkrhel33 root]$ sqlplus ‘/as sysdba’

SQL*Plus: Release 11.2.0.2.0 Production on Thu May 19 15:43:07 2011

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Release 11.2.0.2.0 – 64bit Production

SQL> startup