Saturday, March 2, 2013

how to brain transplant a linux system from Dell to HP C-class Blade

How to brain transplant linux:

Use install media to bring new blade host to base OS.
- PXE Boot to rescue mode, follow instructions to shell
- Verify partitions (because these Blades had CentOS installed on them for testing purposes, the partitions should be OK, but best to be sure):

 fdisk -l
 Device    Boot      Start         End    Blocks   Id  System
 /dev/sda1   *           1       6774   54412123+ 83  Linux
 /dev/sda2           6775       7297     4200997+ 82  Linux swap / Solaris

Ensure you've mounted your disk properly with your rescue operation (mount should show /dev/sda1 mounted as /mnt/sysimage/)
 Unmount the rescue proc and sys
 umount /mnt/sysimage/proc
 umount /mnt/sysimage/sys
 umount /mnt/sysimage/dev/pts
 umount /mnt/sysimage/dev
 umount /mnt/sysimage/selinux

Remove the old OS, you don't need that anymore:
 cd /mnt/sysimage/
 rm -rf *
Remake your proc and sys and dev folders:
 mkdir proc sys dev

Take note of the IP you picked up from DHCP on vlan1:
 ifconfig eth0

+++
Login to your source system

Disable crontab schedules for various jobs

Shutdown application services and other running resources on the source system

Cleanup /var/spool/clientmqueue
 find /var/spool/clientmqueue -type f -mtime +1 -exec rm {} \;

Cleanup /home/backups/
 Verify source is not larger than 50GB

Tar > netcat the file system of your source DM over to new device

On your new host:
 nc -l -p 5555 | tar xvvf -

On your source host, in a screen session:
tar cvvf - bin boot etc home lib lib64 lost+found media misc mnt net opt root sbin selinux srv tmp usr var | nc 5555


 *nc on centOS does not have the -q option that modern variants of nc have

Once that is completed (they both should die elegantly) chroot to your new environment, and make appropriate changes to grub, fstab, and mtab, and then run grub-install /dev/sda to install the new MBR to the new drive:

chroot /mnt/sysimage
mount -t proc proc proc
mount -t sysfs sysfs sys
cd dev
MAKEDEV generic
grub-install /dev/sda
cd
vim /etc/mtab (change /dev/sda2 to /dev/sda1)
vim /etc/fstab (change LABEL=/1 to /dev/sda1 and LABEL=SWAP-sda3 to /dev/sda2)
vim /boot/grub/menu.lst (change all hd0,1 to hd0,0)

Shutdown the source system and shut the switchports going to that system.
Remove the mac address line from the network-scripts configs
Reboot the new HP blade server.

Once reconnected to the internet, verify nagios checks are coming back good.
 Deactivate any OMSA specific checks for the DM in Nagios
 Configure the Dell OMSA gear to not startup:
 chkconfig dsm_om_connsvc off
 chkconfig dsm_om_shrsvc off
 chkconfig dsm_sa_ipmi off

Install the HP SIM Software *NOTE: voip1-8.sv3 are i686, and voip9 is cents 6.X*
For Centos 5.X server i686 (voip1-8): wget http://admin1-1.sv3.somedomain.com/hpsim/bootstrap.sh
bootstrap.sh ProLiantSupportPack
For Centos 6.x x64 server (voip9): wget http://admin1-1.sv3.somedomain.com/hpsim/psp-9.10.rhel6.x86_64.en.tar.gz
For Centos 5.x x64 servers (voip10-27): wget http://admin1-1.sv3.somedomain.com/hpsim/psp-9.10.rhel5.x86_64.en.tar.gz

yum install -y hp-health hp-smh-templates hp-snmp-agents hpacucli hpdiags hpmouse hponcfg hpsmh cpqacuxe

cd /tmp
wget http://labs.consol.de/download/shinken-nagios-plugins/check_hpasm-4.6.3.tar.gz
tar zxvf check_hpasm-4.6.3.tar.gz
cd check_hpasm-4.6.3
./configure --enable-hpacucli
make
cp -av plugins-scripts/check_hpasm /usr/local/nagios/libexec/

Added to /usr/local/nagios/etc/nrpe.cfg in command definition section:

command[check_hpasm]=/usr/local/nagios/libexec/check_hpasm $ARG1$

Ran 'visudo' and changed Nagios permitted commands to:

nagios        ALL=(root) NOPASSWD: /usr/sbin/smartctl, /sbin/hpasmcli, /sbin/hpacucli, /usr/sbin/hpacucli
Defaults:nagios !requiretty

uncomment the crontabs


No comments: