Archive for May, 2011

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

VMFS Datastores Are Inaccessible

Posted: May 19, 2011 in VMware
Tags:

Problem : One of the LUN becomes inaccessible as it came up as snapshot LUN .

You can check if one LUN is seen from ESX as snapshot LUN by logging into ESX and do the following .

[root@uesx05 /]# cd /var/log
[root@uesx05 log]# less vmkernel | grep UQNAP:LUN14
May 19 12:13:59 uesx05 vmkernel: 3:21:24:42.383 cpu6:4110)Vol3: 1010: [label: UQNAP:LUN14, uuid: 4dcc9251-36dbd158-1405-001b24a2e4d4] detected as a snapshot file system.

As you can see that UQNAP:LUN14 has been detected as Snapshot file system .Also you can check more on this status as

By connecting directly to the ESX host service console:

  1. Log in as root to the ESX host which cannot mount the datastore using an SSH client. For more information, see

    Run the command:

    esxcfg-volume -l

    The results appear similar to:

    VMFS3 UUID/label: 4b057ec3-6bd10428-b37c-005056ab552a/ UQNAP:LUN14
    Can mount: Yes
    Can resignature: Yes
    Extent name: naa.6000eb391530aa26000000000000130c:1 range: 0 – 1791 (MB)

    Record the UUID portion of the output. In the above example the UUID is 4b057ec3-6bd10428-b37c-005056ab552a.

Solution :

To mount it back again ew need to resignature that LUN and mount it back again .

1. Log in as root to the ESX hos

2. esxcfg-volumn -r  “uqnap:lun14”

3. esxcfg-rescan vmhba32

4. Then complete rescan HBA of all esx.

5. Then you will see this LUN is mounted as a snapLUN .

6. Unregister all VM resides from old LUN ( after that you can see that LUN will disappear)

7. Rename the new snap LUN as old one ( UQNAP:LUN14)

8. Register back all VM again and power on .


Symptoms
  • Need to confirm an IP Appliance’s serial number (Previous Nokia device)?
Solution
If you are physically next to the device, look for a label on the physical box.

    1. If you are remotely accessing the firewall, log into Voyager, then look for “Unit SN” under the “Basic IPSO Information” section of the homepage.
    2. Run the following IPSO command:

      ipso[admin]# ipsctl hw:eeprom:serial_number
      hw:eeprom:serial_number = 9xxxxxxxx4

      or you can run: ipsctl -a | grep serial, which will give you all serial numbers related to different parts.

      ipso[admin]# ipsctl -a | grep "serial"
      hw:eeprom:motherboard:serial_number = 94072202114
      hw:eeprom:cpci_1:serial_number = 94072301073
      hw:eeprom:cpci_2:serial_number = 94072301093
      hw:eeprom:power_a:serial_number = SH52618
      hw:eeprom:power_b:serial_number = SH52471
      hw:eeprom:wx_3:serial_number = 94072202755
      hw:eeprom:viper_4:serial_number = 94072300835
      hw:eeprom:wx_1_1:serial_number = 94073601141
      hw:eeprom:serial_number = 9xxxxxxxx4
      hw:motherboard:serialnumber = 0
      hw:chassis:serialnumber = 9xxxxxxxx4

    3. In CLISH, you can run command: “show asset hardware”, which will also give you much information about major parts.

      ipso[admin]# clish
      NokiaIP1260:102> show asset hardware
      Chassis Serial Number: 9xxxxxxxx4
      CPU Model: Pentium 4/XEON
      CPU MFR: GenuineIntel
      CPU Frequency: 2794587100
      Memory: 1073741824
      Disk 0 Model: STI Flash 8.0.0
      Disk 0 Capacity: 128MB
      Disk 1 Model: FUJITSU MHV2040AS
      Disk 1 Capacity: 40007MB
      Platform: IP1260
      Bios Vendor: Hilo BIOS
      Bios Version: 5.0-1.5
      Bios Date: 10-19-2004
      Motherboard Serial Number: 0
      Motherboard Revision: B01
      Motherboard Model: HILO-RCC1

    4. For Nokia IP VPN devices:

      hostname> show fru
      MAIN (MOTHERBOARD) EEPROM FRU INFO:
      -----------------------------------
      Product Name: 10i
      EEPROM info format rev num: 6
      Number of slots: 0
      MAC address count: 3
      Base MAC address: 00:A0:8E:XX:XX:XX
      System serial number: 7HXXXXXXXXX
      System Agile part number: N806189001
      System Agile H/W rev: C
      Onboard MAC count: 3
      System PCA Agile P/N base: 6187
      System PCA Agile P/N suffix: 1

    5. For former Nokia IPS platforms, please run the following command:

      ip390ips ~ # cat /proc/nokia/nvram/serial_num

  1. For UTM-1 EDGE devices, you can also use run the command:

    EDGE:XX> show asset hardware


This step-by-step article describes how to change a GUID partition table (GPT) disk into a master boot record (MBR) disk (64-bit only). But I have tried these on Virtual disk and that does not work .

Using the Windows Interface

  1. Right-click My Computer and click Manage.
  2. Click Disk Management.
  3. Right-click the GPT disk you want to change into an MBR disk, and then click Convert to MBR disk.

Using a Command Line

  1. At a command prompt, type: diskpart, and then press ENTER.
  2. At the diskpart prompt, type: list disk, and then press ENTER.
  3. Record the disk number of the disk that you want to convert to an MBR disk.
  4. At the diskpart prompt, type: select disk n, and then press ENTER.
  5. At the diskpart prompt, type: convert mbr, and then press ENTER.

You must be logged on as an administrator or a member of the Administrators group to complete this procedure. If your computer is connected to a network, the network policy settings may prevent you from completing this procedure.

On Itanium-based computers, you can change a disk from GPT to MBR, provided that the disk is empty.

Ref : Microsoft.com

How to create SOSREPORT

Posted: May 4, 2011 in Redhat
Tags:

What is an “sosreport” and how do I create it in Red Hat Enterprise Linux 4.6 and later?

Issue

The “sosreport” command is a tool that collects information about a Red Hat Enterprise Linux system, such as what kernel is running, what drivers are loaded, and various configuration files for common services. It also does some simple diagnostics against known problematic patterns.

Environment

  • Red Hat Enterprise Linux 4.6 and later

Resolution

To run  “sosreport”, the “sos” package must be installed. The package should be installed by default, but if the package is not installed, follow the steps below:

Red Hat Enterprise Linux 4.6 and later

If the system is registered with Red Hat Network (RHN), “sos” can be installed using the up2date command:

# up2date sos

Red Hat Enterprise Linux 5 and later

If the system is registered with RHN, use the yum command:

# yum install sos

If the system is not registered with RHN, the “sos” package can be downloaded from the RHN website or found on the installation CDs. The RPM command can be used to install the package on any version of Red Hat Enterprise Linux:

# rpm -Uvh sos-<version>.<arch>.rpm 

Once the package has been installed, issue the following command:

Note: sosreport requires root permissions to run.

# sosreport

The sosreport will run for several minutes, according to different system, the running time maybe more longer.

Once completed, “sosreport” will generate a compressed a bz2 file under /tmp. Provide this file to the support representative.

Normally, the size of the bz2 file will be about 3MB, but if your system has a large amount of log files, it maybe very big.

The sosreport has some plugins which can be turn on/off, the following command lists the plugins:

# sosreport -l 

For example, turning off the rpmva plugin will save time running sosreport.

# sosreport -k rpm.rpmva=off 

Note:

1. Before Red Hat Enterprise Linux 4.5, please use “sysreport” instead: What is a sysreport and how do I run it ?

2. In the sos package, there is also a command called “sysreport”, but it is just a soft link to the sosreport command:

# ls -l /usr/sbin/sysreport lrwxrwxrwx 1 root root 19 Nov  3  2008 /usr/sbin/sysreport -> /usr/sbin/sosreport 

If you do want to use the legacy version of sysreport, please use the sysreport.legacy command in sos package.

Ref : Redhat.com