Thursday, February 28, 2013

clone new linux server



  • for RHEL6, clear the old interface/device name
    vi /etc/udev/rules.d/70-persistent-net.rules
===================
For XenServer:
  • get CD Depository, tar of the old server
  • create new VM, choose "Other install media"
  • highlight the new vm, under "Storage" tab, select the created virtual disk, under Properties,highlight the last entry on the left panel "vm name(Device 0,(Read/Write)". Change the "Device Position" would change the device name "/dev/hda"

- boot with redhat with "linux rescue"
sh-3.2# fdisk -l        #confirm the device
sh-3.2# fdisk /dev/hda  # create 3 partition 1:100m for /boot, 2:swap, 3:root
                        # make sure the swap partition is type 82 (linux swap)
sh-3.2# mkfs.ext3 /dev/hda1
sh-3.2# mkfs.ext3 /dev/hda3
sh-3.2# mkswap /dev/hda2
sh-3.2# mkdir /mnt/sysimage
sh-3.2# mount /dev/hda3 /mnt/sysimage
sh-3.2# mkdir /mnt/sysimage/boot
sh-3.2# mkdir /dev/hda1 /mnt/sysimage/boot
sh-3.2# cd /mnt/sysimage
sh-3.2# sftp dchen@10.213.66.23         #this is the underline xen
sh-3.2#                                 #get the system tar file
sh-3.2# tar zxpf <server.tgz>
- modify boot/grub/device.map; grub.conf (make sure root=/dev/hda3); etc/fstab; etc/hosts; etc/sysconfig/network; etc/sysconfig/network-script/ifcfg-eth0; etc/resolv,conf; etc/ntp.conf,
(/etc/ntp/step-tickers)
- reboot to "linux rescue" mode again, system would find existing linux partition and mount it under /mnt/sysimage
sh-3.2# chroot /mnt/sysimage
sh-3.2# grub-install /dev/hda
sh-3.2# chkconfig network on
Then force reboot in citrix

- remove packages: "hp-snmp-agents hpacucli hp-health"
- install package: tcsh, OpenIPMI, OpenIPMI-libs
may need to turn off cpuspeed,
- SecurID agent
        modify /etc/pam.d/[login,sudo,system-auth]
- netbackup agent
- register redhat satellite
  # wget https://satellite01-man/pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm
 (or get and install https://satellite01-man/pub/RHN-ORG-TRUSTED-SSL-CERT)
  # rhnreg_ks --activationkey 1-key --serverUrl http://satellite01-man/XMLRPC
 if have ssl problem, check sslCACert in /etc/sysconfig/rhn/up2date or use
 "rhnreg_ks --sslCACert " to point to the right cert.
- snmp agent: /etc/snmp/snmpd.conf
dlmod cmaX /usr/lib64/libcmaX64.so
rwcommunity CAIM4NAGIOS 127.0.0.1
rocommunity CAIM4NAGIOS 127.0.0.1
rwcommunity  CAIM4NAGIOS nagios01-man
rocommunity  CAIM4NAGIOS nagios01-man
trapcommunity caimtrap
trapsink nagios01-man caimtrap
syscontact Dong Chen
syslocation Manassas DataCenter

- fix selinux permission
# foreach f (`rpm -qa`)
foreach? fixfiles -R $f restore
foreach? end

==========
XenSerever:

1. install hp agents for XenServer from \\fs01-man\ocioworking\Xen\hp-xs-agent.zip (hp-agents-xs.iso)
2. After installation, edit "/etc/snmp/snmpd.conf", 
3. update config files
- /etc/sudoers  ( %wheel)
- /etc/group
- ~/.ssh/authorized_keys
- /etc/exports
- /etc/sysconfig/network add:
        DOMAIN=
- /etc/ntp.conf add line:
        server 10.213.72.14
        server 10.213.72.15
- /etc/sysconfig/iptables to allow incoming traffic of snmp (161), ntp (123)
-A RH-Firewall-1-INPUT -p udp -m udp --dport 161 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 123 -j ACCEPT
4. install tcsh and hpacucli package
5. make sure snmpd and ntp automatically start
turn on services (chkconfig) snmpd, snmptrapd, nfs, portmap, nfslock,

# chkconfig ntpd on
# chkconfig snmpd on
# chkconfig hp-snmp-agents on
# chkconfig hp-asrd on
# chkconfig hp-health on
# chkconfig hpsmhd off

# service hp-health restart
# service hp-asrd restart
# service hp-snmp-agents restart
# service ntpd restart
# service snmpd restart
-----------
portmap; nfs; nfslock
===================
Add local storage
# fdisk -l
# pvcreate /dev/cciss/c0d1p1
# xe sr-create type=lvm content-type=user device-config:device=/dev/cciss/c0d1p1 name-label="Local RAID5"

Monday, February 25, 2013

hpacucli

Controller commands:
hpacucli> ctrl all show config ## Display detail of Controller
hpacucli> ctrl all show config detail
hpacucli> ctrl all show status ## Display status of Controller
hpacucli> ctrl slot=0 modify dwc=disable ## Enable or Disable the cache
hpacucli> ctrl slot=0 modify dwc=enable
hpacucli> rescan ## Detects newly added devices since the last rescan

Physical drive commands:
hpacucli> ctrl slot=0 pd all show ## Display detail information of PhysicalDrive 
hpacucli> ctrl slot=0 pd 2:3 show detail
hpacucli> ctrl slot=0 pd all show status ## Display Status of physicalDrive 
hpacucli> ctrl slot=0 pd 2:3 show status
hpacucli> ctrl slot=0 pd 2:3 modify erase ## To Erase the physicalDrive
hpacucli> ctrl slot=0 pd 2:3 modify led=on ## To enable or Disable the LED 
hpacucli> ctrl slot=0 pd 2:3 modify led=off

Logical drive commands:
hpacucli> ctrl slot=0 ld all show ## Display detail information of LogicalDrive 
hpacucli> ctrl slot=0 ld 4 show
hpacucli> ctrl slot=0 ld all show status ## Display Status of LogicalDrive 
hpacucli> ctrl slot=0 ld 4 show status
hpacucli> ctrl slot=0 ld 4 modify reenable forced ## To re-enabling failed drive
hpacucli> ctrl slot=1 array A remove drives=6I:1:8

## remove a drive a ld (logicaldirve 1 is shown on array A)
hpacucli> ctrl slot=1 ld 1 modify size=max ## extend to use newly added space

Configuring RAID level:
  • Create LogicalDrive with RAID 0 using one drive:
    hpacucli> ctrl slot=0 create type=ld drives=1:12 raid=0
  • Create LogicalDrive with RAID 1 using two drives:
    hpacucli> ctrl slot=0 create type=ld drives=1:13,1:14 size=300 raid=1
  • Create LogicalDrive with RAID 5 using five drives:
    hpacucli> ctrl slot=0 create type=ld drives=1:13,1:14,1:15,1:16,1:17 raid=5
  • Expand, Extend, add spare and deleting Logical drives in existing RAID:
    hpacucli> ctrl slot=0 ld 4 delete ## To Delete LogicalDrives
    hpacucli> ctrl slot=0 ld 4 add drives=2:3 ## Expanding ld by adding one more drive
    hpacucli> ctrl slot=0 ld 4 modify size=500 forced ## Extending the LogicalDrives
    hpacucli> ctrl slot=0 array all add spares=1:5,1:7 ## Add two Spare disks