03-06-2008
6,876,
694
Join Date: Sep 2005
Last Activity: 10 February 2021, 3:50 AM EST
Location: Switzerland - GE
Posts: 6,876
Thanks Given: 594
Thanked 694 Times in 627 Posts
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