Need to decommission numerous HP N class servers...any thoughts to do quickly?


 
Thread Tools Search this Thread
Operating Systems HP-UX Need to decommission numerous HP N class servers...any thoughts to do quickly?
# 1  
Old 03-06-2008
Need to decommission numerous HP N class servers...any thoughts to do quickly?

I have numerous N-class servers with internal and external disks that I need to wipe. Does anyone have any ideas to do this quick and painless. Anything other than a sledge hammer Also, do I need to be in single-user mode and if so how do I do that? Servers are running 11.11
Thanks
# 2  
Old 03-06-2008
>I have numerous N-class servers w...

How many?
I have a killer script but it is no simple task and it shares some c program
# 3  
Old 03-06-2008
Sorry for the delay a nuisance came in my office...

Here you are!
(Got it from HP-ITRC? - not sure what the source was...)
Deleting destroying.. disk .. 21-09-05
------------------------------

Attached is a description of how to use Ignite-UX to scrub disks.^M
Some advantages of using this method are:
o many systems can be done at once from a single Ignite server.
o automated once you have done net-boot
o zero foot-print because it is done from RAM disk

It is a little dated, but the details are correct.



==========================================================================================

Description:
Disk clearing is done using a set of pre_config_cmd's in
/var/opt/ignite/config.local and a modified SYSCMDS that contains a C program,
nukeDisk, that erases the disks. A minimal INDEX config is needed to satisfy the
parser, it is comprised of the default config file
/opt/ignite/data/Rel_B.11.11/config,
a bare bones archive style config file,
/var/opt/ignite/data/Rel_B.11.11/core_cfg
and the config file with all of the pre_config_cmds,
/var/opt/ignite/config.local

The C program nukeDisk uses ftw to traverse the directory /dev/rdsk, and dd's
/dev/zero to any non CD/DVD disks it finds there. nukeDisk depends on few things
happening before it is run:
1) Commands that need to be in the environment:
/sbin/dd
/sbin/insf
/sbin/mknod
/sbin/ln
/usr/bin/sh /* linked to /sbin/sh */
2) Files that need to be in the environment:
/dev/zero /* created with mknod */
/dev/rdsk/* /* disk device files created with insf -eCdisk */

After nukeDisk is run the file /etc/utmp is touched and then /sbin/reboot
is run. The "-h" option to reboot could be added if a halt rather than a reboot
is desired.
The system is rebooted before the regular load of the SYSCMDS archive is started.

Files modified on the Ignite server:
/opt/ignite/boot/INSTALLFS (via supported instl_adm)
/var/opt/ignite/config.local (using supported config keywords)
/opt/ignite/data/Rel_B.11.11/SYSCMDS (via UNSUPPORTED repackaging)
/var/opt/ignite/INDEX (supported format)
/var/opt/ignite/data/Rel_B.11.11/core_cfg (for media install change source to MT)


Creating boot media:
make_medialif -va -c "11.11_with_mediainit_4"
dd if=/var/opt/ignite/local/uxinstlf.recovery of=/dev/rmt/0m bs=2k

FILE DETAILS
==============================
INSTALLFS:
-------------
# instl_adm defaults:
# NOTE: Manual additions between the lines containing "instl_adm defaults"
# and "end instl_adm defaults" will not be preserved.
_hp_keyboard="PS2_DIN_US_English"
clean_all_disks=true
cfg "11.11_with_mediainit_4"=TRUE
allow_disk_remap=true
run_ui=false
control_from_server=false
env_vars += "
INST_ALLOW_WARNINGS=1
INST_BATCH_MODE_TIMEOUT=5
"
#env_vars += "
#INST_DEBUG=3
#"
sysadm_message = "# # # ###### # # ### # # #####
###
# # # # # # # ## # # ## # # # ###
# # # # # # # # # # # # # # # ###
# # # # # ###### # # # # # # # # #### #
# # # ####### # # # # # # # # # # #
# # # # # # # # ## # # ## # # ###
## ## # # # # # # ### # # ##### ###

BOOTING FROM THIS SOURCE WILL WIPEOUT
_ALL_ DATA ON _ALL_ DISKS
ON YOUR SYSTEM!
Proceed at your own risk.
"
# end instl_adm defaults.
=============================================
/var/opt/ignite/config.local:
-----------------------------
# set keyboard to avoid getting prompted
#
_hp_keyboard="PS2_DIN_US_English"
#
# load from SYSCMDS progs needed to nuke disk
# touch- to create /etc/utmp for reboot to work
# insf- to create the disk device files
# reboot- to reset the system after disks are cleared
# dd- to raw write the disk
# mknod- to build /dev/zero
# sh- so the call to system() in my c prog will work
# ln- so /sbin/sh can be linked to /usr/bin/sh (see previous)
#
pre_config_cmd += "/sbin/loadfile -v touch insf reboot dd mknod sh ln;"
pre_config_cmd += "/sbin/mknod /dev/zero c 3 0x000004;"
pre_config_cmd += "/usr/bin/ln /sbin/sh /usr/bin/sh;"
pre_config_cmd += "/sbin/insf -eCdisk;"

#
# load my nukeDisk command and run it
#
pre_config_cmd += "/sbin/loadfile -v nukeDisk;/sbin/nukeDisk;"

#
# reboot the box before we load any software
# need to have a "/etc/utmp" or reboot won't go
#
pre_config_cmd += "/usr/bin/touch /etc/utmp;"
pre_config_cmd += "/sbin/reboot;"

==============================================
nukeDisk.c -
-----------------------
/***************************************************
* nukeDisk
*
* Program to write /dev/zero to all non CD/DVD disk drives on a system.
*
***************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <sys/diskio.h>
#include <sys/fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <ftw.h>
/**************************************************************************
* timeout routines used in breaking out hung open/ioctl's on devices
*/
void
tmout_hdlr(int sig)
{
fprintf(stderr,"open() of disk device took too long (might be CD or DVD), continuing.\n");
}
void
set_timeout(unsigned int sec)
{
(void) signal(SIGALRM, tmout_hdlr);
(void) alarm(sec);
}
/**************************************************************************
* dev_ftw_callback
*
*
* Called by ftw(3C) for each raw disk device file.
*/
int
dev_ftw_callback(path, sbuf, type)
char *path;
struct stat *sbuf;
int type;

{
int fd;
disk_describe_type describe;
char cmd[256];

if(type == FTW_F){ /* is a file */
set_timeout(20); /* timeout in 20 seconds trying to open device */
if ((fd = open(path, O_RDONLY)) < 0) {
fprintf(stderr,"Couldn't open device %s\n",path);
return;
}

alarm(0); /* clear the alarm */
ioctl( fd, DIOC_DESCRIBE, &describe); /* get the device description struct */
close(fd);
if (describe.dev_type == CDROM_DEV_TYPE ) /* skip CD's and DVD's */
fprintf(stdout,"%s is a CD or DVD.\n",path);
else {
sprintf(cmd,"/sbin/dd if=/dev/zero of=%s bs=1000k >/dev/null 2>&1",path);
system(cmd); /* dd zeros to the entire disk */
fprintf(stdout,"cleaned %s\n",path);

}
}

return(0);
}

/**************************************************************************
* check_files
*
* stat the commands needed to be successful
*
**************************************************************************/
int
check_files(){
int ret=0;
struct stat sbuf;
if( stat("/sbin/dd",&sbuf) == -1) ret=1;
if( stat("/sbin/insf",&sbuf) == -1) ret=1;
if( stat("/usr/bin/sh",&sbuf) == -1) ret=1;
if( stat("/dev/zero",&sbuf) == -1) ret=1;
if( stat("/dev/rdsk",&sbuf) == -1) ret=1;

if(ret) {
fprintf(stderr,"Required files missing, need:\n");
fprintf(stderr,"\t/sbin/dd\n");
fprintf(stderr,"\t/sbin/insf\n");
fprintf(stderr,"\t/usr/bin/sh\n");
fprintf(stderr,"\t/dev/zero\n");
fprintf(stderr,"and disk device files in /dev/rdsk created by /sbin/insf -eCdisk\n");
}
return(ret);
}
/**************************************************************************
* main
*
* check for required files and commands
* if all OK then ftw(3c) the /dev/rdsk path
*
**************************************************************************/
void
main(int argc, char *argv[]){

char *devdir;
devdir="/dev/rdsk";
if(check_files() == 0)
/* walk the tree rooted at /dev/rdsk */
(void) ftw(devdir, dev_ftw_callback, /*depth = */5);

exit(0);
}

==============================================
/var/opt/ignite/INDEX:
----------------------
cfg "11.11_with_mediainit" {
description "mediainit the disks"
"/opt/ignite/data/Rel_B.11.11/config"
"/var/opt/ignite/data/Rel_B.11.11/core_cfg"
"/var/opt/ignite/config.local"
}
==============================================
/var/opt/ignite/data/Rel_B.11.11/core_cfg
-----------------------------------------
#########################################################
## Software Sources
#########################################################

sw_source "core archive" {
description = "HP-UX Core Operating System Archives"
load_order = 0
source_format = archive
nfs_source = "15.1.53.4:/var/opt/ignite/archives"
post_load_script = "/opt/ignite/data/scripts/os_arch_post_l"
post_config_script = "/opt/ignite/data/scripts/os_arch_post_c"
}

######################################################
## HPUX Base OS
#####################################################

sw_sel "HPUXBase64" {
description = "HP-UX 64-bit Base OS"
sw_source = "core archive"
archive_type = gzip tar
archive_path = "B.11.11_Base64.gz"
sw_category = "HPUXBaseOS"
exrequisite = sw_category
} = (can_run_64bit)
(sw_sel "HPUXBase64") {
_hp_os_bitness = "64"
}

sw_sel "HPUXBase32" {
description = "HP-UX 32-bit Base OS"
sw_source = "core archive"
archive_type = gzip tar
archive_path = "B.11.11_Base32.gz"
sw_category = "HPUXBaseOS"
exrequisite = sw_category
} = (! can_run_64bit)
(sw_sel "HPUXBase32") {
_hp_os_bitness = "32"
}

==================
==================
To extract SYSCMDS:
-------------------
mkdir /var/tmp/syscmds
cd $_
gzcat /opt/ignite/data/Rel_B.11.11/SYSCMDS |pax -pe -rvf -

cd /var/tmp/syscmds/sbin
cp /var/tmp/nukeDisk .
chmod +s nukeDisk
cd /var/tmp/syscmds

To repackage (from /var/tmp/syscmds):
tar -vcfb - 20 . | gzip -9 -c > /opt/ignite/data/Rel_B.11.11/SYSCMDS
=============================================================================================


All the best
# 4  
Old 03-06-2008
Thank you so much for all the great info. I really appreciate it!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script for Linux server decommission

Hi Folks, I would like to create a script for linux server decommissioning which should collect the all configuration details and store in a file. Now the server configuration details are collected manually. The server configuration detail includes IP, DNS, OS Version, Network Interface... (3 Replies)
Discussion started by: seenuvasan1985
3 Replies

2. Programming

C++ : Base class member function not accessible from derived class

Hello All, I am a learner in C++. I was testing my inheritance knowledge with following piece of code. #include <iostream> using namespace std; class base { public : void display() { cout << "In base display()" << endl; } void display(int k) {... (2 Replies)
Discussion started by: anand.shah
2 Replies

3. Programming

Size of Derived class, upon virtual base class inheritance

I have the two class definition as follows. class A { public: int a; }; class B : virtual public A{ }; The size of class A is shown as 4, and size of class B is shown as 16. Why is this effect ?. (2 Replies)
Discussion started by: techmonk
2 Replies

4. Shell Programming and Scripting

Script to check numerous ports / servers (Solaris native)

Hi I'd like to check that a bunch of firewall rules have been applied and, therefore, want to write a script that basically does the following: telnet serverA port1 telnet serverA port2 telnet serverB port1 telnet serverB port2 I would just compile the list in excel and run it as a... (2 Replies)
Discussion started by: jibberish
2 Replies

5. UNIX for Advanced & Expert Users

Get pointer for existing device class (struct class) in Linux kernel module

Hi all! I am trying to register a device in an existing device class, but I am having trouble getting the pointer to an existing class. I can create a class in a module, get the pointer to it and then use it to register the device with: *cl = class_create(THIS_MODULE, className);... (0 Replies)
Discussion started by: hdaniel@ualg.pt
0 Replies

6. Fedora

Concatenate Numerous Files

Hey! I wanted to find a text version of the Bible for purposes of grepping. The only files I could find, (in the translation I wanted), were Old Testament.txt and New Testament.txt. I thought, "fine, I'll just concatenate those two, no problemo." But when I unpacked them, turns out they had each... (22 Replies)
Discussion started by: sudon't
22 Replies

7. Programming

static use for class inside the same class c++

Hi, I believe the next code is wrong: class Egg { Egg e; int i; Egg(int ii=0) : i(ii) {} }; because you would end up with an endless definition (memory allocation) of Egg objects, thus int i. Ok, so God Eckel proposes for a singleton: class Egg { static Egg e; int... (5 Replies)
Discussion started by: xavipoes
5 Replies

8. Programming

C++ class definition with a member of the same class

Hi, i have a question about C++. Is it possible to declare a class with a member ot the same class? For example, a linked list or i want to convert this C code to C++ class (Elemento) typedef struct elemento { char name; char value; List<struct elemento> ltElementos; ... (7 Replies)
Discussion started by: pogdorica
7 Replies

9. UNIX for Dummies Questions & Answers

car class (not school class)

im just trying to have some fun and kill some time writing a c++ program that has a person type in a car make and model then gives them a year and a price. or something like that. i always have problems getting it goin but once the ball is rolling im usually pretty good. anyone wanna help me out? ... (1 Reply)
Discussion started by: rickym2626
1 Replies

10. UNIX for Dummies Questions & Answers

need solution for this quickly. please quickly.

Write a nawk script that will produce the following report: ***FIRST QUARTERLY REPORT*** ***CAMPAIGN 2004 CONTRIBUTIONS*** ------------------------------------------------------------------------- NAME PHONE Jan | ... (5 Replies)
Discussion started by: p.palakj.shah
5 Replies
Login or Register to Ask a Question