Dec 112013
 

This is an old cheat sheet I unearthed digging through an old USB drive I used to use for backups. It’s from ’07 — good to reminisce about the oldish days ūüėÄ

 

Okay…so it’s by no means a complete document, but it’s all I got for now. Moreover, if you are still using HPUX, you are either stuck in the 1990s or a really really “old-school” shop (heck they tell me the same thing about Solaris these days — those darned linux n00bs ;-))

 

Oct 292013
 

We all have to create topology diagrams, high level visual representations of our thoughts or environments (or software solutions etc) from time to time, for as they say – “A picture is worth a thousand words”.

The Graphviz software (http://www.graphviz.org/) provides us a simple and elegant way to do so, which with a little bit of practice can make a huge difference in time saved. It also lets us take safe shortcuts, where in we bypass the entire cumbersome process of creating visio diagrams ( or some other tool). And do this instead:

Input Configuration file:

# START_TOPO
#cluster:tier:node:dc
cluster01:web:web1:Chicago
cluster02:middleware:mid1:Chicago
cluster03:db:db1:Chicago
cluster11:web:web2:New York
cluster12:middleware:mid2:New York
cluster13:db:db2:New York
# END_TOPO
# START_EDGE
#nodes:dir:style:label
web1:web2:both:invis:UNDEF
mid1:mid2:both:invis:UNDEF
db1:db2:both:invis:UNDEF
web1,web2:mid1,mid2:::p9099
db1,db2:DBSID:both::Database
mid1,mid2:db1,db2:::p1514
# END_EDGE

Having prepared this type of configuration file (which should take a few minutes), run the script given below to generate the “dot” code needed to generate the diagrams. If you use a wiki (which should be all but ubiquitous in IT by now), most modern wikis (eg: mediawiki, dokuwiki) come with plugins for graphviz. The “dot” code generated by the script can then be pasted into your wiki page and an associated graphviz image will be displayed.

Run the script as follows:

¬†$ ./graph.pl –cfg=”./graphit.cfg” –output=/tmp/foo.dot

This will generate the necessary framework for your diagram. You do still need to know the “Dot” language in order to edit/modify/improve on the code, but this script will do the bulk of your work for you. ¬†However, that is provided you are drawing topology diagrams (as shown here, in a similar format).

Feel free to pull the script from the git repo here and use/modify it as you deem fit:

https://github.com/implicateorder/sysadmin-tools/blob/master/graph.pl

 

The script:

 

The Dot code:

 

And the diagram looks like this (needs to tweaked further), provided my graphviz plugin works :

wpg_div_wp_graphviz_1

 Posted by at 8:49 pm
Oct 102013
 
About the STREAM benchmark

http://blogs.utexas.edu/jdm4372/tag/stream-benchmark/

Here’s what the author has to say about the benchmark itself —

What is STREAM?

The STREAM benchmark is a simple synthetic benchmark program that measures sustainable memory bandwidth (in MB/s) and the corresponding computation rate for simple vector kernels.

/*-----------------------------------------------------------------------*/
/* Program: Stream                                                       */
/* Revision: $Id: stream.c,v 5.9 2009/04/11 16:35:00 mccalpin Exp $ */
/* Original code developed by John D. McCalpin                           */
/* Programmers: John D. McCalpin                                         */
/*              Joe R. Zagar                                             */
/*                                                                       */
/* This program measures memory transfer rates in MB/s for simple        */
/* computational kernels coded in C.                                     */
/*-----------------------------------------------------------------------*/
/* Copyright 1991-2005: John D. McCalpin                                 */
/*-----------------------------------------------------------------------*/
/* License:                                                              */
/*  1. You are free to use this program and/or to redistribute           */
/*     this program.                                                     */
/*  2. You are free to modify this program for your own use,             */
/*     including commercial use, subject to the publication              */
/*     restrictions in item 3.                                           */
/*  3. You are free to publish results obtained from running this        */
/*     program, or from works that you derive from this program,         */
/*     with the following limitations:                                   */
/*     3a. In order to be referred to as "STREAM benchmark results",     */
/*         published results must be in conformance to the STREAM        */
/*         Run Rules, (briefly reviewed below) published at              */
/*         http://www.cs.virginia.edu/stream/ref.html                    */
/*         and incorporated herein by reference.                         */
/*         As the copyright holder, John McCalpin retains the            */
/*         right to determine conformity with the Run Rules.             */
/*     3b. Results based on modified source code or on runs not in       */
/*         accordance with the STREAM Run Rules must be clearly          */
/*         labelled whenever they are published.  Examples of            */
/*         proper labelling include:                                     */
/*         "tuned STREAM benchmark results"                              */
/*         "based on a variant of the STREAM benchmark code"             */
/*         Other comparable, clear and reasonable labelling is           */
/*         acceptable.                                                   */
/*     3c. Submission of results to the STREAM benchmark web site        */
/*         is encouraged, but not required.                              */
/*  4. Use of this program or creation of derived works based on this    */
/*     program constitutes acceptance of these licensing restrictions.   */
/*  5. Absolutely no warranty is expressed or implied.                   */
/*-----------------------------------------------------------------------*/
Leveraging the Parallelization potential of the T4

In order to run this benchmark, the stream benchmark program was compiled with GCC as well as SolarisStudio 12 (the optimized, native compiler for Solaris).

A standard compile with the gcc compiler resulted in this —

[jdoe@myserver:~/stream-gcc (52)]
$ ./stream32
-------------------------------------------------------------
STREAM version $Revision: 5.9 $
-------------------------------------------------------------
This system uses 8 bytes per DOUBLE PRECISION word.
-------------------------------------------------------------
Array size = 120000000, Offset = 0
Total memory required = 2746.6 MB.
Each test is run 20 times, but only
the *best* time for each is used.
-------------------------------------------------------------
Printing one line per active thread....
-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 1614701 microseconds.
   (= 1614701 clock ticks)
Increase the size of the arrays if this shows that
you are not getting at least 20 clock ticks per test.
-------------------------------------------------------------
WARNING -- The above is only a rough guideline.
For best results, please be sure you know the
precision of your system timer.
-------------------------------------------------------------
Function      Rate (MB/s)   Avg time     Min time     Max time
Copy:        1119.4976       1.7513       1.7151       1.7878
Scale:       1094.2510       1.7722       1.7546       1.7939
Add:         1455.0495       1.9815       1.9793       1.9847
Triad:       1463.1247       1.9774       1.9684       1.9889
-------------------------------------------------------------
Solution Validates
-------------------------------------------------------------

Then we compiled the code using Solaris studio and immediately saw improvements in Memory throughput (without any optimization) —

Unoptimized compile gave --

$ ./stream32
-------------------------------------------------------------
STREAM version $Revision: 5.9 $
-------------------------------------------------------------
This system uses 8 bytes per DOUBLE PRECISION word.
-------------------------------------------------------------
Array size = 120000000, Offset = 0
Total memory required = 2746.6 MB.
Each test is run 20 times, but only
the *best* time for each is used.
-------------------------------------------------------------
Printing one line per active thread....
-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 1434242 microseconds.
   (= 1434242 clock ticks)
Increase the size of the arrays if this shows that
you are not getting at least 20 clock ticks per test.
-------------------------------------------------------------
WARNING -- The above is only a rough guideline.
For best results, please be sure you know the
precision of your system timer.
-------------------------------------------------------------
Function      Rate (MB/s)   Avg time     Min time     Max time
Copy:        1322.0838       1.4544       1.4523       1.4573
Scale:       1365.2033       1.4066       1.4064       1.4070
Add:         1968.3168       1.4633       1.4632       1.4637
Triad:       1944.1898       1.4815       1.4813       1.4819
-------------------------------------------------------------
Solution Validates
-------------------------------------------------------------

After optimization —

Various degrees of optimization resulted in slight variations of performance (the following gave best results which was around 3x of unoptimized code)

cc -mt -m32 -xarch=native -xO4 stream.c -o stream_omp32

$ ./stream_omp32
-------------------------------------------------------------
STREAM version $Revision: 5.9 $
-------------------------------------------------------------
This system uses 8 bytes per DOUBLE PRECISION word.
-------------------------------------------------------------
Array size = 120000000, Offset = 0
Total memory required = 2746.6 MB.
Each test is run 20 times, but only
the *best* time for each is used.
-------------------------------------------------------------
Printing one line per active thread....
-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 278639 microseconds.
   (= 278639 clock ticks)
Increase the size of the arrays if this shows that
you are not getting at least 20 clock ticks per test.
-------------------------------------------------------------
WARNING -- The above is only a rough guideline.
For best results, please be sure you know the
precision of your system timer.
-------------------------------------------------------------
Function      Rate (MB/s)   Avg time     Min time     Max time
Copy:        3137.3320       0.6123       0.6120       0.6128
Scale:       3142.1011       0.6119       0.6111       0.6125
Add:         4230.4671       0.6811       0.6808       0.6817
Triad:       4323.3051       0.6667       0.6662       0.6674
-------------------------------------------------------------
Solution Validates
Make it Parallel

Using the sunstudio compiler, it is possible to force a single-threaded app to multi-thread on the CMT platform —

devzone:$(build) # cc -m32 -mt -xautopar -xarch=native -xO4 stream.c -o stream_omp32

$ ./stream_omp32
-------------------------------------------------------------
STREAM version $Revision: 5.9 $
-------------------------------------------------------------
This system uses 8 bytes per DOUBLE PRECISION word.
-------------------------------------------------------------
Array size = 120000000, Offset = 0
Total memory required = 2746.6 MB.
Each test is run 20 times, but only
the *best* time for each is used.
-------------------------------------------------------------
Printing one line per active thread....
-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 133846 microseconds.
   (= 133846 clock ticks)
Increase the size of the arrays if this shows that
you are not getting at least 20 clock ticks per test.
-------------------------------------------------------------
WARNING -- The above is only a rough guideline.
For best results, please be sure you know the
precision of your system timer.
-------------------------------------------------------------
Function      Rate (MB/s)   Avg time     Min time     Max time
Copy:        6126.3741       0.3178       0.3134       0.3267
Scale:       6318.8244       0.3057       0.3039       0.3135
Add:         8280.5469       0.3490       0.3478       0.3508
Triad:       8396.7949       0.3438       0.3430       0.3449
-------------------------------------------------------------
Solution Validates
-------------------------------------------------------------

This defaults to only 2 threads running in parallel (albeit the app thinks it is using a single thread of execution)

Now explicitly setting the following two variables in the parent shell, we were able to get 8 parallel threads of execution, effectively getting around 3x higher memory throughput (going from ~ 3GB/s with single thread to 6GB/s with 2 threads to 21GB/s with 8 threads — ie utilizing a full core)

$ export PARALLEL=8
[jdoe@myserver:~ (9)]
$  export SUNW_MP_THR_IDLE=8
[jdoe@myserver:~ (10)]
$ ./stream_omp32
-------------------------------------------------------------
STREAM version $Revision: 5.9 $
-------------------------------------------------------------
This system uses 8 bytes per DOUBLE PRECISION word.
-------------------------------------------------------------
Array size = 120000000, Offset = 0
Total memory required = 2746.6 MB.
Each test is run 20 times, but only
the *best* time for each is used.
-------------------------------------------------------------
Printing one line per active thread....
-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 43905 microseconds.
   (= 43905 clock ticks)
Increase the size of the arrays if this shows that
you are not getting at least 20 clock ticks per test.
-------------------------------------------------------------
WARNING -- The above is only a rough guideline.
For best results, please be sure you know the
precision of your system timer.
-------------------------------------------------------------
Function      Rate (MB/s)   Avg time     Min time     Max time
Copy:       21245.0500       0.0914       0.0904       0.0920
Scale:      21816.9850       0.0885       0.0880       0.0908
Add:        28052.9390       0.1032       0.1027       0.1056
Triad:      28368.5107       0.1022       0.1015       0.1065
-------------------------------------------------------------
Solution Validates
-------------------------------------------------------------
[jdoe@myserver:~ (11)]

Now running 16 parallel threads —

$ ./stream_64.ap
-------------------------------------------------------------
STREAM version $Revision: 5.9 $
-------------------------------------------------------------
This system uses 8 bytes per DOUBLE PRECISION word.
-------------------------------------------------------------
Array size = 600000000, Offset = 10
Total memory required = 13732.9 MB.
Each test is run 20 times, but only
the *best* time for each is used.
-------------------------------------------------------------
Printing one line per active thread....
-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 219395 microseconds.
   (= 219395 clock ticks)
Increase the size of the arrays if this shows that
you are not getting at least 20 clock ticks per test.
-------------------------------------------------------------
WARNING -- The above is only a rough guideline.
For best results, please be sure you know the
precision of your system timer.
-------------------------------------------------------------
Function      Rate (MB/s)   Avg time     Min time     Max time
Copy:       32325.0822       0.3009       0.2970       0.3427
Scale:      32666.0515       0.3126       0.2939       0.3858
Add:        40507.6894       0.3741       0.3555       0.4537
Triad:      40263.1710       0.3676       0.3576       0.4074
-------------------------------------------------------------
Solution Validates
-------------------------------------------------------------
[jdoe@myserver:~/benchmarks (24)]

While prstat sees —

   PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/LWPID
 15865 jdoe   74  25 0.0 0.0 0.0 0.4 0.0 0.7  12  40  17   0 stream_64.ap/4
 15865 jdoe   73  26 0.0 0.0 0.0 0.5 0.0 0.6  14  40  17   0 stream_64.ap/11
 15865 jdoe   73  23 0.0 0.0 0.0 3.5 0.0 0.2  14  35  17   0 stream_64.ap/15
 15865 jdoe   73  23 0.0 0.0 0.0 2.9 0.0 1.0  12  40  17   0 stream_64.ap/8
 15865 jdoe   73  23 0.0 0.0 0.0 3.2 0.0 0.7  19  40  24   0 stream_64.ap/10
 15865 jdoe   73  23 0.0 0.0 0.0 3.9 0.0 0.2  14  40  17   0 stream_64.ap/13
 15865 jdoe   73  22 0.0 0.0 0.0 4.2 0.0 0.0  14  40  19   0 stream_64.ap/2
 15865 jdoe   73  22 0.0 0.0 0.0 3.1 0.0 1.1  15  31  19   0 stream_64.ap/6
 15865 jdoe   71  23 0.0 0.0 0.0 5.6 0.0 0.0  10  35 740   0 stream_64.ap/1
 15865 jdoe   71  23 0.0 0.0 0.0 6.0 0.0 0.0  15  35  17   0 stream_64.ap/14
 15865 jdoe   71  23 0.0 0.0 0.0 6.1 0.0 0.0  14  38  19   0 stream_64.ap/5
 15865 jdoe   71  23 0.0 0.0 0.0 6.2 0.0 0.0  15  35  17   0 stream_64.ap/7
 15865 jdoe   71  23 0.0 0.0 0.0 6.3 0.0 0.0  12  35  15   0 stream_64.ap/16
 15865 jdoe   71  22 0.0 0.0 0.0 6.5 0.0 0.0  15  35  22   0 stream_64.ap/9
 15865 jdoe   71  22 0.0 0.0 0.0 6.6 0.0 0.0  19  35  19   0 stream_64.ap/3
 15865 jdoe   71  22 0.0 0.0 0.0 6.8 0.0 0.0  14  37  17   0 stream_64.ap/12
 15182 jdoe  0.6 0.8 0.0 0.0 0.0 0.0  99 0.0   7   1  3K   0 prstat/1
 14998 jdoe  0.0 0.0 0.0 0.0 0.0 0.0 100 0.0   4   0  34   0 bash/1
 14996 jdoe  0.0 0.0 0.0 0.0 0.0 0.0 100 0.0  11   0 118   0 sshd/1
 15162 jdoe  0.0 0.0 0.0 0.0 0.0 0.0 100 0.0   1   0   8   0 sshd/1
 15164 jdoe  0.0 0.0 0.0 0.0 0.0 0.0 100 0.0   0   0   0   0 bash/1

  NLWP USERNAME  SWAP   RSS MEMORY      TIME  CPU
    21 jdoe    13G   13G    11%   0:00:48 1.5%

Total: 6 processes, 21 lwps, load averages: 0.23, 0.11, 0.16

The acceleration was astounding.

In time elapsed, with single thread —

[jdoe@myserver:~/benchmarks (24)]
$ export SUNW_MP_THR_IDLE=1
[jdoe@myserver:~/benchmarks (25)]
$ export PARALLEL=1
[jdoe@myserver:~/benchmarks (26)]
$ ptime ./stream_64.ap
-------------------------------------------------------------
STREAM version $Revision: 5.9 $
-------------------------------------------------------------
This system uses 8 bytes per DOUBLE PRECISION word.
-------------------------------------------------------------
Array size = 600000000, Offset = 10
Total memory required = 13732.9 MB.
Each test is run 20 times, but only
the *best* time for each is used.
-------------------------------------------------------------
Printing one line per active thread....
-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 1379961 microseconds.
   (= 1379961 clock ticks)
Increase the size of the arrays if this shows that
you are not getting at least 20 clock ticks per test.
-------------------------------------------------------------
WARNING -- The above is only a rough guideline.
For best results, please be sure you know the
precision of your system timer.
-------------------------------------------------------------
Function      Rate (MB/s)   Avg time     Min time     Max time
Copy:        2956.0364       3.2745       3.2476       3.3159
Scale:       3025.7681       3.1895       3.1727       3.2110
Add:         4026.0036       3.5974       3.5767       3.6166
Triad:       4025.0673       3.5911       3.5776       3.6025
-------------------------------------------------------------
Solution Validates
-------------------------------------------------------------

real     4:57.114
user     4:47.825
sys         9.284
[jdoe@myserver:~/benchmarks (27)]
$

With 16 parallel threads —

[jdoe@myserver:~/benchmarks (27)]
$ export PARALLEL=16
[jdoe@myserver:~/benchmarks (28)]
$ export SUNW_MP_THR_IDLE=16
[jdoe@myserver:~/benchmarks (29)]
$ ptime ./stream_64.ap
-------------------------------------------------------------
STREAM version $Revision: 5.9 $
-------------------------------------------------------------
This system uses 8 bytes per DOUBLE PRECISION word.
-------------------------------------------------------------
Array size = 600000000, Offset = 10
Total memory required = 13732.9 MB.
Each test is run 20 times, but only
the *best* time for each is used.
-------------------------------------------------------------
Printing one line per active thread....
-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 231461 microseconds.
   (= 231461 clock ticks)
Increase the size of the arrays if this shows that
you are not getting at least 20 clock ticks per test.
-------------------------------------------------------------
WARNING -- The above is only a rough guideline.
For best results, please be sure you know the
precision of your system timer.
-------------------------------------------------------------
Function      Rate (MB/s)   Avg time     Min time     Max time
Copy:       32235.5417       0.3057       0.2978       0.3653
Scale:      32646.3996       0.3104       0.2941       0.3647
Add:        40598.9607       0.3722       0.3547       0.4290
Triad:      40255.7375       0.3656       0.3577       0.4070
-------------------------------------------------------------
Solution Validates
-------------------------------------------------------------

real       29.316
user     7:13.691
sys        10.981
[jdoe@myserver:~/benchmarks (30)]
$

See how the “real” time went from 5 minutes to 30s.

The benchmark program
/*-----------------------------------------------------------------------*/
/* Program: Stream                                                       */
/* Revision: $Id: stream.c,v 5.9 2009/04/11 16:35:00 mccalpin Exp $ */
/* Original code developed by John D. McCalpin                           */
/* Programmers: John D. McCalpin                                         */
/*              Joe R. Zagar                                             */
/*                                                                       */
/* This program measures memory transfer rates in MB/s for simple        */
/* computational kernels coded in C.                                     */
/*-----------------------------------------------------------------------*/
/* Copyright 1991-2005: John D. McCalpin                                 */
/*-----------------------------------------------------------------------*/
/* License:                                                              */
/*  1. You are free to use this program and/or to redistribute           */
/*     this program.                                                     */
/*  2. You are free to modify this program for your own use,             */
/*     including commercial use, subject to the publication              */
/*     restrictions in item 3.                                           */
/*  3. You are free to publish results obtained from running this        */
/*     program, or from works that you derive from this program,         */
/*     with the following limitations:                                   */
/*     3a. In order to be referred to as "STREAM benchmark results",     */
/*         published results must be in conformance to the STREAM        */
/*         Run Rules, (briefly reviewed below) published at              */
/*         http://www.cs.virginia.edu/stream/ref.html                    */
/*         and incorporated herein by reference.                         */
/*         As the copyright holder, John McCalpin retains the            */
/*         right to determine conformity with the Run Rules.             */
/*     3b. Results based on modified source code or on runs not in       */
/*         accordance with the STREAM Run Rules must be clearly          */
/*         labelled whenever they are published.  Examples of            */
/*         proper labelling include:                                     */
/*         "tuned STREAM benchmark results"                              */
/*         "based on a variant of the STREAM benchmark code"             */
/*         Other comparable, clear and reasonable labelling is           */
/*         acceptable.                                                   */
/*     3c. Submission of results to the STREAM benchmark web site        */
/*         is encouraged, but not required.                              */
/*  4. Use of this program or creation of derived works based on this    */
/*     program constitutes acceptance of these licensing restrictions.   */
/*  5. Absolutely no warranty is expressed or implied.                   */
/*-----------------------------------------------------------------------*/
# include <stdio.h>
# include <math.h>
# include <float.h>
# include <limits.h>
# include <stddef.h>
# include <sys/time.h>

/* INSTRUCTIONS:
 *
 *      1) Stream requires a good bit of memory to run.  Adjust the
 *          value of 'N' (below) to give a 'timing calibration' of
 *          at least 20 clock-ticks.  This will provide rate estimates
 *          that should be good to about 5% precision.
 */

#ifndef N
#   define N    120000000
#endif
#ifndef NTIMES
#   define NTIMES       20
#endif
#ifndef OFFSET
#   define OFFSET       0
#endif

/*
 *      3) Compile the code with full optimization.  Many compilers
 *         generate unreasonably bad code before the optimizer tightens
 *         things up.  If the results are unreasonably good, on the
 *         other hand, the optimizer might be too smart for me!
 *
 *         Try compiling with:
 *               cc -O stream_omp.c -o stream_omp
 *
 *         This is known to work on Cray, SGI, IBM, and Sun machines.
 *
 *
 *      4) Mail the results to mccalpin@cs.virginia.edu
 *         Be sure to include:
 *              a) computer hardware model number and software revision
 *              b) the compiler flags
 *              c) all of the output from the test case.
 * Thanks!
 *
 */

# define HLINE "-------------------------------------------------------------\n"

# ifndef MIN
# define MIN(x,y) ((x)<(y)?(x):(y))
# endif
# ifndef MAX
# define MAX(x,y) ((x)>(y)?(x):(y))
# endif

static double   a[N+OFFSET],
                b[N+OFFSET],
                c[N+OFFSET];

static double   avgtime[4] = {0}, maxtime[4] = {0},
                mintime[4] = {FLT_MAX,FLT_MAX,FLT_MAX,FLT_MAX};

static char     *label[4] = {"Copy:      ", "Scale:     ",
    "Add:       ", "Triad:     "};

static double   bytes[4] = {
    2 * sizeof(double) * N,
    2 * sizeof(double) * N,
    3 * sizeof(double) * N,
    3 * sizeof(double) * N
    };

extern double mysecond();
extern void checkSTREAMresults();
#ifdef TUNED
extern void tuned_STREAM_Copy();
extern void tuned_STREAM_Scale(double scalar);
extern void tuned_STREAM_Add();
extern void tuned_STREAM_Triad(double scalar);
#endif
#ifdef _OPENMP
extern int omp_get_num_threads();
#endif
int
main()
    {
    int                 quantum, checktick();
    int                 BytesPerWord;
    register int        j, k;
    double              scalar, t, times[4][NTIMES];

    /* --- SETUP --- determine precision and check timing --- */

    printf(HLINE);
    printf("STREAM version $Revision: 5.9 $\n");
    printf(HLINE);
    BytesPerWord = sizeof(double);
    printf("This system uses %d bytes per DOUBLE PRECISION word.\n",
        BytesPerWord);

    printf(HLINE);
#ifdef NO_LONG_LONG
    printf("Array size = %d, Offset = %d\n" , N, OFFSET);
#else
    printf("Array size = %llu, Offset = %d\n", (unsigned long long) N, OFFSET);
#endif

    printf("Total memory required = %.1f MB.\n",
        (3.0 * BytesPerWord) * ( (double) N / 1048576.0));
    printf("Each test is run %d times, but only\n", NTIMES);
    printf("the *best* time for each is used.\n");

#ifdef _OPENMP
    printf(HLINE);
#pragma omp parallel
    {
#pragma omp master
        {
            k = omp_get_num_threads();
            printf ("Number of Threads requested = %i\n",k);
        }
    }
#endif

    printf(HLINE);
#pragma omp parallel
    {
    printf ("Printing one line per active thread....\n");
    }

    /* Get initial value for system clock. */
#pragma omp parallel for
    for (j=0; j<N; j++) {
        a[j] = 1.0;
        b[j] = 2.0;
        c[j] = 0.0;
        }

    printf(HLINE);

    if  ( (quantum = checktick()) >= 1)
        printf("Your clock granularity/precision appears to be "
            "%d microseconds.\n", quantum);
    else {
        printf("Your clock granularity appears to be "
            "less than one microsecond.\n");
        quantum = 1;
    }

    t = mysecond();
#pragma omp parallel for
    for (j = 0; j < N; j++)
        a[j] = 2.0E0 * a[j];
    t = 1.0E6 * (mysecond() - t);

    printf("Each test below will take on the order"
        " of %d microseconds.\n", (int) t  );
    printf("   (= %d clock ticks)\n", (int) (t/quantum) );
    printf("Increase the size of the arrays if this shows that\n");
    printf("you are not getting at least 20 clock ticks per test.\n");

    printf(HLINE);

    printf("WARNING -- The above is only a rough guideline.\n");
    printf("For best results, please be sure you know the\n");
    printf("precision of your system timer.\n");
    printf(HLINE);

    /*  --- MAIN LOOP --- repeat test cases NTIMES times --- */

    scalar = 3.0;
    for (k=0; k<NTIMES; k++)
        {
        times[0][k] = mysecond();
#ifdef TUNED
        tuned_STREAM_Copy();
#else
#pragma omp parallel for
        for (j=0; j<N; j++)
            c[j] = a[j];
#endif
        times[0][k] = mysecond() - times[0][k];

        times[1][k] = mysecond();
#ifdef TUNED
        tuned_STREAM_Scale(scalar);
#else
#pragma omp parallel for
        for (j=0; j<N; j++)
            b[j] = scalar*c[j];
#endif
        times[1][k] = mysecond() - times[1][k];

        times[2][k] = mysecond();
#ifdef TUNED
        tuned_STREAM_Add();
#else
#pragma omp parallel for
        for (j=0; j<N; j++)
            c[j] = a[j]+b[j];
#endif
        times[2][k] = mysecond() - times[2][k];

        times[3][k] = mysecond();
#ifdef TUNED
        tuned_STREAM_Triad(scalar);
#else
#pragma omp parallel for
        for (j=0; j<N; j++)
            a[j] = b[j]+scalar*c[j];
#endif
        times[3][k] = mysecond() - times[3][k];
        }

    /*  --- SUMMARY --- */

    for (k=1; k<NTIMES; k++) /* note -- skip first iteration */
        {
        for (j=0; j<4; j++)
            {
            avgtime[j] = avgtime[j] + times[j][k];
            mintime[j] = MIN(mintime[j], times[j][k]);
            maxtime[j] = MAX(maxtime[j], times[j][k]);
            }
        }

    printf("Function      Rate (MB/s)   Avg time     Min time     Max time\n");
    for (j=0; j<4; j++) {
        avgtime[j] = avgtime[j]/(double)(NTIMES-1);

        printf("%s%11.4f  %11.4f  %11.4f  %11.4f\n", label[j],
               1.0E-06 * bytes[j]/mintime[j],
               avgtime[j],
               mintime[j],
               maxtime[j]);
    }
    printf(HLINE);

    /* --- Check Results --- */
    checkSTREAMresults();
    printf(HLINE);

    return 0;
}

# define        M       20

int
checktick()
    {
    int         i, minDelta, Delta;
    double      t1, t2, timesfound[M];

/*  Collect a sequence of M unique time values from the system. */

    for (i = 0; i < M; i++) {
        t1 = mysecond();
        while( ((t2=mysecond()) - t1) < 1.0E-6 )
            ;
        timesfound[i] = t1 = t2;
        }

/*
 * Determine the minimum difference between these M values.
 * This result will be our estimate (in microseconds) for the
 * clock granularity.
 */

    minDelta = 1000000;
    for (i = 1; i < M; i++) {
        Delta = (int)( 1.0E6 * (timesfound[i]-timesfound[i-1]));
        minDelta = MIN(minDelta, MAX(Delta,0));
        }

   return(minDelta);
    }

/* A gettimeofday routine to give access to the wall
   clock timer on most UNIX-like systems.  */

#include <sys/time.h>

double mysecond()
{
        struct timeval tp;
        struct timezone tzp;
        int i;

        i = gettimeofday(&tp,&tzp);
        return ( (double) tp.tv_sec + (double) tp.tv_usec * 1.e-6 );
}

void checkSTREAMresults ()
{
        double aj,bj,cj,scalar;
        double asum,bsum,csum;
        double epsilon;
        int     j,k;

    /* reproduce initialization */
        aj = 1.0;
        bj = 2.0;
        cj = 0.0;
    /* a[] is modified during timing check */
        aj = 2.0E0 * aj;
    /* now execute timing loop */
        scalar = 3.0;
        for (k=0; k<NTIMES; k++)
        {
            cj = aj;
            bj = scalar*cj;
            cj = aj+bj;
            aj = bj+scalar*cj;
        }
        aj = aj * (double) (N);
        bj = bj * (double) (N);
        cj = cj * (double) (N);

        asum = 0.0;
        bsum = 0.0;
        csum = 0.0;
        for (j=0; j<N; j++) {
                asum += a[j];
                bsum += b[j];
                csum += c[j];
        }
#ifdef VERBOSE
        printf ("Results Comparison: \n");
        printf ("        Expected  : %f %f %f \n",aj,bj,cj);
        printf ("        Observed  : %f %f %f \n",asum,bsum,csum);
#endif

#ifndef abs
#define abs(a) ((a) >= 0 ? (a) : -(a))
#endif
        epsilon = 1.e-8;

        if (abs(aj-asum)/asum > epsilon) {
                printf ("Failed Validation on array a[]\n");
                printf ("        Expected  : %f \n",aj);
                printf ("        Observed  : %f \n",asum);
        }
        else if (abs(bj-bsum)/bsum > epsilon) {
                printf ("Failed Validation on array b[]\n");
                printf ("        Expected  : %f \n",bj);
                printf ("        Observed  : %f \n",bsum);
        }
        else if (abs(cj-csum)/csum > epsilon) {
                printf ("Failed Validation on array c[]\n");
                printf ("        Expected  : %f \n",cj);
                printf ("        Observed  : %f \n",csum);
        }
        else {
                printf ("Solution Validates\n");
        }
}

void tuned_STREAM_Copy()
{
        int j;
#pragma omp parallel for
        for (j=0; j<N; j++)
            c[j] = a[j];
}

void tuned_STREAM_Scale(double scalar)
{
        int j;
#pragma omp parallel for
        for (j=0; j<N; j++)
            b[j] = scalar*c[j];
}

void tuned_STREAM_Add()
{
        int j;
#pragma omp parallel for
        for (j=0; j<N; j++)
            c[j] = a[j]+b[j];
}

void tuned_STREAM_Triad(double scalar)
{
        int j;
#pragma omp parallel for
        for (j=0; j<N; j++)
            a[j] = b[j]+scalar*c[j];
}

Sep 092013
 

Prerequisites are as follows:

1.NFS share that is “rw” on target host

2.working flarcreate (if not working, use a flarcreate from a patched Solaris 9 system. There is a flarcreate bug on Solaris 9 that can be worked around by using the aforementioned file)

In this example, we will use old-phys-server (jumpstart) as the P2V source and cdom-001 as a P2V target

Create a local NFS share on cdom-001 (or mount a “rw” nfs share) and mount it on source host:

<code>

user001@cdom-001:/export/home/p2v/old-phys-server$ df -h

Filesystem             Size   Used  Available Capacity  Mounted on

syspool/ROOT/solaris11-0

547G   2.1G       456G     1%    /

/devices                 0K     0K         0K     0%    /devices

/dev                     0K     0K         0K     0%    /dev

ctfs                     0K     0K         0K     0%    /system/contract

proc                     0K     0K         0K     0%    /proc

mnttab                   0K     0K         0K     0%    /etc/mnttab

swap                    10G   2.4M        10G     1%    /system/volatile

objfs                    0K     0K         0K     0%    /system/object

sharefs                  0K     0K         0K     0%    /etc/dfs/sharetab

fd                       0K     0K         0K     0%    /dev/fd

syspool/ROOT/solaris11-0/var

547G   751M       456G     1%    /var

swap                    10G   112M        10G     2%    /tmp

syspool/export         547G    32K       456G     1%    /export

syspool/export/home    547G    87M       456G     1%    /export/home

syspool/export/home/ocmgr

547G    36K       456G     1%    /export/home/ocmgr

syspool/guests         547G    34K       456G     1%    /guests

syspool                547G    73K       456G     1%    /syspool

syspool/p2v            100G    14G        86G    15%    /export/home/p2v

syspool/ISO             40G   4.1G        36G    11%    /export/home/ISO

user001@cdom-001:/export/home/p2v/old-phys-server$

</code>

Share the FS on cdom-001:

<code>

$ sudo share -F nfs -o anon=0,rw /export/home/p2v

Mount the filesystem

$ sudo mount -F nfs -o rw,vers=3 cdom-001:/export/home/p2v /var/tmp/p2v

$ df -h|grep p2v

cdom-001:/export/home/p2v   100G    14G    86G    15%    /var/tmp/p2v

Update the /var/sadm/system/admin/.platform file to contain the target platform (in this case sun4v):

PLATFORM_GROUP=sun4u

INST_ARCH=sparc

PLATFORM_NAME=SUNW,SPARCstation-fusion

PLATFORM_ID=SUNW,SPARCstation-fusion

IN_PLATFORM_GROUP=sun4u

PLATFORM_NAME=FJSV,GP

PLATFORM_ID=FJSV,GP

IN_PLATFORM_GROUP=sun4u

PLATFORM_NAME=FJSV,GPUU

PLATFORM_ID=FJSV,GPUU

IN_PLATFORM_GROUP=sun4u

PLATFORM_NAME=NATE,s-Note_737S

PLATFORM_ID=NATE,s-Note_737S

IN_PLATFORM_GROUP=sun4u

PLATFORM_NAME=NATE,s-Note_747S

PLATFORM_ID=NATE,s-Note_747S

IN_PLATFORM_GROUP=sun4u

PLATFORM_NAME=NATE,s-Note_777S

PLATFORM_ID=NATE,s-Note_777S

IN_PLATFORM_GROUP=sun4u

PLATFORM_GROUP=sun4v

Not doing this step will render the flash archive uninstallable on the sun4v platform

Create the flash archive

$ sudo /usr/local/bin/flarcreate -n old-phys-server-flar -c -x /var/tmp/p2v /var/tmp/p2v/`hostname`/old-phys-server.flar

Ensure that the VM (LDOM) on cdom-001 is configured to be on the network (old-phys-server is in VLAN 40, so VLAN 40 must be added to the trunk port and vswitches or network interface (corresponding to relevant vswitch must be in vlan 40):

VSW

NAME             MAC               NET-DEV   ID   DEVICE     LINKPROP   DEFAULT-VLAN-ID PVID VID                  MTU   MODE   INTER-VNET-LINK

primary_10g_vsw0 00:14:4f:fb:b7:08 aggr0310gEM0 0    switch@0   phys-state 1               602  343,950,40           1500         off

primary_1g_vsw1  00:14:4f:fb:1b:05 aggr01EM2 1    switch@1   phys-state 1               1    343,602,950          1500         off

primary_10g_vsw2 00:14:4f:f9:95:aa aggr0410gEM8 2    switch@2   phys-state 1               602  343,950,40           1500         off

primary_1g_vsw3  00:14:4f:f9:02:51 aggr02EM11 3    switch@3   phys-state 1               1    602,343,950          1500         off

Note that the VID corresponding to 2 vswitches includes 40

Create the ldom corresponding to old-phys-server on the control domain:

user001@cdom-001:/export/home/p2v/old-phys-server$ sudo ldm list -l old-phys-server

NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME

old-phys-server¬†¬†¬†¬†¬†¬†¬†¬†¬† active¬†¬†¬†¬† -n—-¬† 5003¬†¬†¬† 8¬†¬†¬†¬† 8G¬†¬†¬†¬†¬†¬†¬† 15%¬† 15m

SOFTSTATE

Solaris running

UUID

c99db9c0-adb7-6af6-cf15-e3473bf4bdef

MAC

00:14:4f:fa:91:fa

HOSTID

0x84fa91fa

CONTROL

failure-policy=ignore

extended-mapin-space=off

cpu-arch=native

DEPENDENCY

master=

CORE

CID    CPUSET

16     (128, 129, 130, 131, 132, 133, 134, 135)

VCPU

VID    PID    CID    UTIL STRAND

0      128    16     6.9%   100%

1      129    16      12%   100%

2      130    16      12%   100%

3      131    16      13%   100%

4      132    16      11%   100%

5      133    16      12%   100%

6      134    16      15%   100%

7      135    16      21%   100%

MEMORY

RA               PA               SIZE

0x20000000       0x1e20000000     8G

CONSTRAINT

cpu=whole-core

max-cores=2

threading=max-throughput

NETWORK

NAME             SERVICE                     ID   DEVICE     MAC               MODE   PVID VID                  MTU   LINKPROP

vnet0            primary_10g_vsw0@primary    0    network@0  00:14:4f:fa:f5:6a        40                        1500  phys-state

DISK

NAME             VOLUME                      TOUT ID   DEVICE  SERVER         MPGROUP

vdisk01          vdisk11_2031_0E6E@primary_local_vds0      0    disk@0  primary

cdrom            sol10u10@primary_iso_vds0        1    disk@1  primary

VCONS

NAME             SERVICE                     PORT

old-phys-server          primary_vcc0@primary        5003

We have already assigned a 90g lun 2031_0E6E to this ldom and vnet0 has pvid set to 40, thus treating this virtual network interface as being in vlan 40 natively. Also note that there is an ISO image added to the ldom as cdrom. This is the device which we will boot off, to start the P2V process

Boot the ldom from cdrom and start the installation process

Ensure that when the default filesystem layout is presented, you modify it to accomodate all filesystems from the target host (in this case old-phys-server)

{0} ok boot cdrom

Boot device: /virtual-devices@100/channel-devices@200/disk@1  File and args:

SunOS Release 5.10 Version Generic_147440-01 64-bit

Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved.

Configuring devices.

Using RPC Bootparams for network configuration information.

Attempting to configure interface vnet0…

Skipped interface vnet0

Setting up Java. Please wait…

Serial console, reverting to text install

Beginning system identification…

Searching for configuration file(s)…

Search complete.

Discovering additional network configuration…

Select a Language

0. English

1. Brazilian Portuguese

2. French

3. German

4. Italian

5. Japanese

6. Korean

7. Simplified Chinese

8. Spanish

9. Swedish

10. Traditional Chinese

Please make a choice (0 – 10), or press h or ? for help: 0

What type of terminal are you using?

1) ANSI Standard CRT

2) DEC VT52

3) DEC VT100

4) Heathkit 19

5) Lear Siegler ADM31

6) PC Console

7) Sun Command Tool

8) Sun Workstation

9) Televideo 910

10) Televideo 925

11) Wyse Model 50

12) X Terminal Emulator (xterms)

13) CDE Terminal Emulator (dtterm)

14) Other

Type the number of your choice and press Return: 3

Completing system identification…

in.rdisc: No interfaces up

? The Solaris Installation Program ?????????????????????????????????????????????

The Solaris installation program is divided into a series of short sections

where you’ll be prompted to provide information for the installation. At

the end of each section, you’ll be able to change the selections you’ve

made before continuing.

About navigation…

– The mouse cannot be used

– If your keyboard does not have function keys, or they do not

respond, press ESC; the legend at the bottom of the screen

will change to show the ESC keys to use for navigation.

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Identify This System ?????????????????????????????????????????????????????????

On the next screens, you must identify this system as networked or

non-networked, and set the default time zone and date/time.

If this system is networked, the software will try to find the information

it needs to identify your system; you will be prompted to supply any

information it cannot find.

> To begin identifying this system, press F2.

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Network Connectivity ?????????????????????????????????????????????????????????

Specify Yes if the system is connected to the network by one of the Solaris

or vendor network/communication Ethernet cards that are supported on the

Solaris CD. See your hardware documentation for the current list of

supported cards.

Specify No if the system is connected to a network/communication card that

is not supported on the Solaris CD, and follow the instructions listed under

Help.

Networked

?????????

[X] Yes

[ ] No

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? DHCP for vnet0 ???????????????????????????????????????????????????????????????

Specify whether or not this network interface should use DHCP to configure

itself.  Choose Yes if DHCP is to be used, or No if the network interface is

to be configured manually.

NOTE: DHCP support will not be enabled, if selected, until after the system

reboots.

Use DHCP for vnet0

??????????????????

[ ] Yes

[X] No

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Host Name for vnet0 ??????????????????????????????????????????????????????????

Enter the host name which identifies this system on the network.  The name

must be unique within your domain; creating a duplicate host name will cause

problems on the network after you install Solaris.

A host name must have at least one character; it can contain letters,

digits, and minus signs (-).

Host name for vnet0 old-phys-server-ldom

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? IP Address for vnet0 ?????????????????????????????????????????????????????????

Enter the Internet Protocol (IP) address for this network interface.  It

must be unique and follow your site’s address conventions, or a

system/network failure could result.

IP addresses contain four sets of numbers separated by periods (for example

129.200.9.1).

IP address for vnet0 192.168.136.32

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Subnet for vnet0 ?????????????????????????????????????????????????????????????

On this screen you must specify whether this system is part of a subnet.  If

you specify incorrectly, the system will have problems communicating on the

network after you reboot.

> To make a selection, use the arrow keys to highlight the option and

press Return to mark it [X].

System part of a subnet

???????????????????????

[X] Yes

[ ] No

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Netmask for vnet0 ????????????????????????????????????????????????????????????

On this screen you must specify the netmask of your subnet.  A default

netmask is shown; do not accept the default unless you are sure it is

correct for your subnet.  A netmask must contain four sets of numbers

separated by periods (for example 255.255.255.0).

Netmask for vnet0 255.255.255.0

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? IPv6 for vnet0 ???????????????????????????????????????????????????????????????

Specify whether or not you want to enable IPv6, the next generation Internet

Protocol, on this network interface.  Enabling IPv6 will have no effect if

this machine is not on a network that provides IPv6 service.  IPv4 service

will not be affected if IPv6 is enabled.

> To make a selection, use the arrow keys to highlight the option and

press Return to mark it [X].

Enable IPv6 for vnet0

?????????????????????

[ ] Yes

[X] No

Please wait…

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Set the Default Route for vnet0 ??????????????????????????????????????????????

To specify the default route, you can let the software try to detect one

upon reboot, you can specify the IP address of the router, or you can choose

None.  Choose None if you do not have a router on your subnet.

> To make a selection, use the arrow keys to select your choice and press

Return to mark it [X].

Default Route for vnet0

??????????????????????????

[ ] Detect one upon reboot

[X] Specify one

[ ] None

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Default Route IP Address for vnet0 ???????????????????????????????????????????

Enter the IP address of the default route. This entry will be placed in the

/etc/defaultrouter file and will be the default route after you reboot

(example 129.146.89.225).

Router IP Address for vnet0 192.168.136.3

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Confirm Information for vnet0 ????????????????????????????????????????????????

> Confirm the following information.  If it is correct, press F2;

to change any information, press F4.

Networked: Yes

Use DHCP: No

Host name: old-phys-server-ldom

IP address: 192.168.136.32

System part of a subnet: Yes

Netmask: 255.255.255.0

Enable IPv6: No

Default Route: Specify one

Router IP Address: 192.168.136.3

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-4_Change    Esc-6_Help

? Configure Security Policy: ???????????????????????????????????????????????????

Specify Yes if the system will use the Kerberos security mechanism.

Specify No if this system will use standard UNIX security.

Configure Kerberos Security

???????????????????????????

[ ] Yes

[X] No

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Confirm Information ??????????????????????????????????????????????????????????

> Confirm the following information.  If it is correct, press F2;

to change any information, press F4.

Configure Kerberos Security: No

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-4_Change    Esc-6_Help

Starting remote procedure call (RPC) services:

? Name Service ?????????????????????????????????????????????????????????????????

On this screen you must provide name service information.  Select the name

service that will be used by this system, or None if your system will either

not use a name service at all, or if it will use a name service not listed

here.

> To make a selection, use the arrow keys to highlight the option

and press Return to mark it [X].

Name service

????????????

[ ] NIS+

[ ] NIS

[ ] DNS

[ ] LDAP

[X] None

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Confirm Information ??????????????????????????????????????????????????????????

> Confirm the following information.  If it is correct, press F2;

to change any information, press F4.

Name service: None

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-4_Change    Esc-6_Help

done.

? NFSv4 Domain Name ????????????????????????????????????????????????????????????

NFS version 4 uses a domain name that is automatically derived from the

system’s naming services. The derived domain name is sufficient for most

configurations. In a few cases, mounts that cross domain boundaries might

cause files to appear to be owned by “nobody” due to the lack of a common

domain name.

The current NFSv4 default domain is: “”

NFSv4 Domain Configuration

??????????????????????????????????????????????

[X] Use the NFSv4 domain derived by the system

[ ] Specify a different NFSv4 domain

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Confirm Information for NFSv4 Domain ?????????????????????????????????????????

> Confirm the following information.  If it is correct, press F2;

to change any information, press F4.

NFSv4 Domain Name:  << Value to be derived dynamically >>

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-4_Change    Esc-6_Help

? Time Zone ????????????????????????????????????????????????????????????????????

On this screen you must specify your default time zone.  You can specify a

time zone in three ways:  select one of the continents or oceans from the

list, select other – offset from GMT, or other – specify time zone file.

> To make a selection, use the arrow keys to highlight the option and

press Return to mark it [X].

Continents and Oceans

??????????????????????????????????

–¬†¬† [ ] Africa

?   [X] Americas

?   [ ] Antarctica

?   [ ] Arctic Ocean

?   [ ] Asia

?   [ ] Atlantic Ocean

?   [ ] Australia

?   [ ] Europe

v   [ ] Indian Ocean

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Country or Region ????????????????????????????????????????????????????????????

> To make a selection, use the arrow keys to highlight the option and

press Return to mark it [X].

Countries and Regions

???????????????????????????

–¬†¬† [X] United States

?   [ ] Anguilla

?   [ ] Antigua & Barbuda

?   [ ] Argentina

?   [ ] Aruba

?   [ ] Bahamas

?   [ ] Barbados

?   [ ] Belize

?   [ ] Bolivia

?   [ ] Brazil

?   [ ] Canada

?   [ ] Cayman Islands

v   [ ] Chile

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Time Zone ????????????????????????????????????????????????????????????????????

> To make a selection, use the arrow keys to highlight the option and

press Return to mark it [X].

Time zones

??????????????????????????????????????????????????????????????????????????

–¬†¬† [ ] Eastern Time

?   [ ] Eastern Time РMichigan Рmost locations

?   [ ] Eastern Time РKentucky РLouisville area

?   [ ] Eastern Time РKentucky РWayne County

?   [ ] Eastern Time РIndiana Рmost locations

?   [ ] Eastern Time РIndiana РDaviess, Dubois, Knox & Martin Counties

?   [ ] Eastern Time РIndiana РPulaski County

?   [ ] Eastern Time РIndiana РCrawford County

?   [ ] Eastern Time РIndiana РPike County

?   [ ] Eastern Time РIndiana РSwitzerland County

?   [X] Central Time

?   [ ] Central Time РIndiana РPerry County

v   [ ] Central Time РIndiana РStarke County

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Date and Time ????????????????????????????????????????????????????????????????

> Accept the default date and time or enter

new values.

Date and time: 2013-04-22 10:21

Year   (4 digits) : 2013

Month  (1-12)     : 04

Day    (1-31)     : 22

Hour   (0-23)     : 10

Minute (0-59)     : 21

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Confirm Information ??????????????????????????????????????????????????????????

> Confirm the following information.  If it is correct, press F2;

to change any information, press F4.

Time zone: Central Time

(US/Central)

Date and time: 2013-04-22 10:21:00

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-4_Change    Esc-6_Help

? Root Password ????????????????????????????????????????????????????????????????

Please enter the root password for this system.

The root password may contain alphanumeric and special characters.  For

security, the password will not be displayed on the screen as you type it.

> If you do not want a root password, leave both entries blank.

Root password:  *

Root password:  *

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Enabling remote services ?????????????????????????????????????????????????????

Would you like to enable network services for use by remote clients?

Selecting “No” provides a more secure configuration in

which Secure Shell is the only network service provided to

remote clients.¬† Selecting “Yes” enables a larger set of

services as in previous Solaris releases. If in doubt, it is

safe to select “No” as any services can be individually enabled

after installation.

Note: This choice only affects initial installs. It doesn’t affect upgrades.

Remote services enabled

???????????????????????

[X] Yes

[ ] No

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Provide Solaris Auto Registration Info: ??????????????????????????????????????

To improve products and services, Oracle Solaris communicates configuration

data to Oracle after rebooting.

You can register your version of Oracle Solaris to capture this data for

your use, or the data is sent anonymously.

For information about what configuration data is communicated and how to

control this facility, see the Release Notes or

www.oracle.com/goto/solarisautoreg.

> Use the arrow keys to select the option and press Return to

mark it [X].

?????????????????????????????????????????????????????????????????

[ ] I would like to register using My Oracle Support information.

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

? Provide Solaris Auto Registration Info: ??????????????????????????????????????

To send the configuration data anonymously, complete the following fields.

If using a proxy server, provide the proxy settings.

For information about what configuration data is communicated and how to

control this facility, see the Release Notes or

www.oracle.com/goto/solarisautoreg.

Proxy Server Host Name:

Proxy Server Port Number:

HTTP Proxy User Name:

HTTP Proxy Password:

????????????????????????????????????????????????????????????????????????????????

Esc-2_Continue    Esc-6_Help

System identification is completed.

System identification complete.

Starting Solaris installation program…

Executing JumpStart preinstall phase…

Searching for SolStart directory…

Checking rules.ok file…

Using begin script: install_begin

Using finish script: patch_finish

Executing SolStart preinstall phase…

Executing begin script “install_begin”…

Begin script install_begin execution completed.

? Solaris Interactive Installation ?????????????????????????????????????????????

On the following screens, you can accept the defaults or you can customize

how Solaris software will be installed by:

– Selecting the type of Solaris software to install

– Selecting disks to hold software you’ve selected

– Selecting unbundled products to be installed with Solaris

– Specifying how file systems are laid out on the disks

After completing these tasks, a summary of your selections (called a

profile) will be displayed.

There are two ways to install your Solaris software:

– “Standard” installs your system from a standard Solaris Distribution.

Selecting “Standard” allows you to choose between initial install

and upgrade, if your system is upgradable.

– “Flash” installs your system from one or more Flash Archives.

????????????????????????????????????????????????????????????????????????????????

F2_Standard    F4_Flash    F5_Exit    F6_Help

? Reboot After Installation? ???????????????????????????????????????????????????

After Solaris software is installed, the system must be rebooted. You can

choose to have the system automatically reboot, or you can choose to

manually reboot the system if you want to run scripts or do other

customizations before the reboot.  You can manually reboot a system by using

the reboot(1M) command.

[X] Auto Reboot

[ ] Manual Reboot

????????????????????????????????????????????????????????????????????????????????

F2_Continue    F3_Go Back    F5_Exit

? Choose Filesystem Type ???????????????????????????????????????????????????????

Select the filesystem to use for your Solaris installation

[X] UFS

[ ] ZFS

????????????????????????????????????????????????????????????????????????????????

F2_Continue    F3_Go Back    F5_Exit    F6_Help

? Flash Archive Retrieval Method ???????????????????????????????????????????????

On this screen you must select a method to retrieve the Flash archive. The

retrieval method depends on where the archive is stored.  For example, if

the archive is stored on a tape, select “Local Tape”.

Available Retrieval Methods

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

[ ]  HTTP

[ ]  FTP

[X]  NFS

[ ]  Local File

[ ]  Local Tape

[ ]  Local Device

????????????????????????????????????????????????????????????????????????????????

F2_Continue    F5_Cancel    F6_Help

? Flash Archive Addition ???????????????????????????????????????????????????????

Please specify the path to the network file system where the Flash archive

is located.  For example:

NFS Location: syrinx:/export/archive.flar

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

NFS Location: 192.168.12.176:/export/home/p2v/old-phys-server/old-phys-server.fla>

????????????????????????????????????????????????????????????????????????????????

F2_Continue    F5_Cancel    F6_Help

? Flash Archive Selection ??????????????????????????????????????????????????????

You selected the following Flash archives to use to install this system.  If

you want to add another archive to install select “New”.

Retrieval Method      Name

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

NFS                   old-phys-server-flar

????????????????????????????????????????????????????????????????????????????????

F2_Continue    F3_Go Back    F4_Edit    F5_New    F6_Help

? Select Disks ?????????????????????????????????????????????????????????????????

On this screen you must select the disks for installing Solaris software.

Start by looking at the Suggested Minimum field; this value is the

approximate space needed to install the software you’ve selected. Keep

selecting disks until the Total Selected value exceeds the Suggested Minimum

value.

NOTE: denotes current boot disk

Disk Device                                              Available Space

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

[X] c0d0                                             93491 MB  (F4 to edit)

Total Selected:  93491 MB

Suggested Minimum:  18949 MB

????????????????????????????????????????????????????????????????????????????????

F2_Continue    F3_Go Back    F4_Edit    F5_Exit    F6_Help

? Select Boot Disk ?????????????????????????????????????????????????????????????

On this screen you can select the disk for installing the root (/) file

system of the Solaris software.

Original Boot Device : c0d0

Disk

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

[X] c0d0  (F4 to select boot device)

????????????????????????????????????????????????????????????????????????????????

F2_OK    F4_Edit    F5_Cancel    F6_Help

? Select Boot Disk ?????????????????????????????????????????????????????????????

On this screen you can select the disk for installing the root (/) file

system of the Solaris software.

Original Boot Device : c0d0

Disk

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

[X] c0d0  (F4 to select boot device)

????????????????????????????????????????????????????????????????????????????????

F2_OK    F4_Edit    F5_Cancel    F6_Help

? Reconfigure EEPROM? ??????????????????????????????????????????????????????????

Do you want to update the system’s hardware (EEPROM) to always

boot from c0d0s0?

????????????????????????????????????????????????????????????????????????????????

Esc-2_Reconfigure EEPROM¬†¬†¬† Esc-5_Don’t Reconfigure EEPROM

? Preserve Data? ???????????????????????????????????????????????????????????????

Do you want to preserve existing data? At least one of the disks you’ve

selected for installing Solaris software has file systems or unnamed slices

that you may want to save.

????????????????????????????????????????????????????????????????????????????????

F2_Continue    F3_Go Back    F4_Preserve    F5_Exit    F6_Help

? File System and Disk Layout ??????????????????????????????????????????????????

The summary below is your current file system and disk layout, based on the

information you’ve supplied.

NOTE: If you choose to customize, you should understand file systems, their

intended purpose on the disk, and how changing them may affect the operation

of the system.

File sys/Mnt point Disk/Slice                                       Size

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

/                  c0d0s0                                     27457   MB

/var               c0d0s1                                     93      MB

overlap            c0d0s2                                     93491   MB

swap               c0d0s3                                     513     MB

/export/home       c0d0s7                                     65426   MB

????????????????????????????????????????????????????????????????????????????????

F2_Continue    F3_Go Back    F4_Customize    F5_Exit    F6_Help

? Customize Disk: c0d0 ?????????????????????????????????????????????????????????

Boot Device: c0d0s0

Entry: swap                       Recommended:  420 MB     Minimum:    0 MB

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

Slice  Mount Point                 Size (MB)

0   /                               27457

1   swap                             8192

2   overlap                         93491

3                                     513

4                                       0

5                                       0

6                                       0

7   /export/home                    65426

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

Capacity:       93491 MB

Allocated:       93489 MB

Rounding Error:           2 MB

Free:           0 MB

????????????????????????????????????????????????????????????????????????????????

Esc-2_OK    Esc-4_Options    Esc-5_Cancel    F6_Help

? File System and Disk Layout ??????????????????????????????????????????????????

The summary below is your current file system and disk layout, based on the

information you’ve supplied.

NOTE: If you choose to customize, you should understand file systems, their

intended purpose on the disk, and how changing them may affect the operation

of the system.

File sys/Mnt point Disk/Slice                                       Size

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

/                  c0d0s0                                     27457   MB

swap               c0d0s1                                     8193    MB

overlap            c0d0s2                                     93491   MB

/var               c0d0s3                                     10241   MB

/export/home       c0d0s6                                     47598   MB

????????????????????????????????????????????????????????????????????????????????

F2_Continue    F3_Go Back    F4_Customize    F5_Exit    F6_Help

? Mount Remote File Systems? ???????????????????????????????????????????????????

Do you want to mount software from a remote file server? This may be

necessary if you had to remove software because of disk space problems.

????????????????????????????????????????????????????????????????????????????????

F2_Continue    F3_Go Back    F4_Remote Mounts    F5_Exit    F6_Help

? Profile ??????????????????????????????????????????????????????????????????????

The information shown below is your profile for installing Solaris software.

It reflects the choices you’ve made on previous screens.

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

Installation Option: Flash

Boot Device: c0d0

Root File System Type: UFS

Client Services: None

Software: 1 Flash Archive

NFS: old-phys-server-flar

File System and Disk Layout: /                   c0d0s0 27457 MB

swap                c0d0s1 8193 MB

/var                c0d0s3 10241 MB

/export/home        c0d0s6 47598 MB

????????????????????????????????????????????????????????????????????????????????

Esc-2_Begin Installation    F4_Change    F5_Exit    F6_Help

Preparing system for Flash install

Configuring disk (c0d0)

– Creating Solaris disk label (VTOC)

Creating and checking file systems

– Creating / (c0d0s0)

– Creating /var (c0d0s3)

– Creating /export/home (c0d0s6)

Beginning Flash archive processing

16 blocks

16 blocks

16 blocks

Solaris Flash Install

MBytes Installed: 14576.30

MBytes Remaining:    -0.03

Installing: Extracting Archive:

|           |           |           |           |           |

0          20          40          60          80         100

Customizing system files

– Mount points table (/etc/vfstab)

– Network host addresses (/etc/hosts)

– Environment variables (/etc/default/init)

Cleaning devices

Customizing system devices

– Physical devices (/devices)

– Logical devices (/dev)

Installing boot information

– Installing boot blocks (c0d0s0)

– Installing boot blocks (/dev/rdsk/c0d0s0)

Installation log location

– /a/var/sadm/system/logs/install_log (before reboot)

– /var/sadm/system/logs/install_log (after reboot)

Flash installation complete

Executing JumpStart postinstall phase…

The begin script log ‘begin.log’

is located in /var/sadm/system/logs after reboot.

Pausing for 90 seconds at the “Reboot” screen. The wizard will continue to

the next step unless you select “Pause”. Enter ‘p’ to pause. Enter ‘c’ to

continue. [c]

syncing file systems… done

rebooting…

Resetting…

The LDOM reboots

SPARC T4-4, No Keyboard

Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.

OpenBoot 4.34.1, 8192 MB memory available, Serial #83530234.

Ethernet address 0:14:4f:fa:91:fa, Host ID: 84fa91fa.

Boot device: disk  File and args:

Can’t open boot_archive

Evaluating:

The file just loaded does not appear to be executable.

If this is a solaris 9 host or an older release of Solaris 10 (unsupported by the hypervisor/ldoms manager), it will not boot. So, another boot cdrom will be called for, and this time we will upgrade the existing installation. Boot from cdrom into single user mode:

ok> boot cdrom -s

Once booted up, create a file /tmp/prof looking like this:

install_type upgrade

nospacecheck

nobootblock

root_device c0d0s0

Run the pfinstall script in debug/dry-run mode:

# /usr/sbin/install.d/pfinstall -x 10 -D /tmp/prof

<snipped>

EOF

echo “OS=Solaris” > ${base}/var/sadm/system/admin/services/Solaris_10

echo “VERSION=10″ >> ${base}/var/sadm/system/admin/services/Solaris_10

echo “REV=0″ >> ${base}/var/sadm/system/admin/services/Solaris_10

touch ${base}/reconfigure

/usr/bin/pkgadm sync -R $base/ -q > /dev/null 2>&1

Preparing system for Solaris upgrade

Upgrade complete

Test run complete. Exit status 0.

If the dry-run returns with exit 0, that means your image can be upgraded. If not, look at the output and figure out what you might need to fix (eg: if the source system was mirroed using disksuite or veritas, you might want to edit the /etc/vfstab and /etc/system file by mounting rootdisk to temporary mount point and comment out entries corresponding to rootdev or encapsulated Solaris Vol Mgr or vxfs filesystems).

At that point, run the pfinstall dry-dun with debug mode again (see above). Once all errors are resolved and dry-run exits with status 0, run:

# /usr/sbin/install.d/pfinstall /tmp/prof

Processing profile

Loading local environment and services

Generating upgrade actions

WARNING: SUNWmccom depends on SUNWjhrt, which is not selected

WARNING: SUNWmccom depends on SUNWj3dev, which is not selected

WARNING: SUNWmccom depends on SUNWj3rt, which is not selected

WARNING: SUNWmcc depends on SUNWj3dev, which is not selected

WARNING: SUNWmcc depends on SUNWj3rt, which is not selected

WARNING: SUNWmc depends on SUNWj3dev, which is not selected

WARNING: SUNWmc depends on SUNWj3rt, which is not selected

WARNING: SUNWwbmc depends on SUNWwbcou, which is not selected

WARNING: SUNWwbmc depends on SUNWj3dev, which is not selected

WARNING: SUNWwbmc depends on SUNWj3rt, which is not selected

WARNING: SUNWmga depends on SUNWj3rt, which is not selected

WARNING: SUNWmga depends on SUNWwbpro, which is not selected

WARNING: SUNWmga depends on SUNWwbcor, which is not selected

WARNING: SUNWmga depends on SUNWwbcou, which is not selected

WARNING: SUNWmga depends on SUNWwbapi, which is not selected

WARNING: SUNWrmui depends on SUNWmgapp, which is not selected

WARNING: SUNWrmui depends on SUNWwbcor, which is not selected

WARNING: SUNWrmui depends on SUNWwbcou, which is not selected

WARNING: SUNWrmui depends on SUNWwbapi, which is not selected

WARNING: SUNWjato depends on SUNWj3dev, which is not selected

WARNING: SUNWjato depends on SUNWj3rt, which is not selected

WARNING: SUNWmctag depends on SUNWjhdev, which is not selected

WARNING: SUNWmctag depends on SUNWjhrt, which is not selected

WARNING: SUNWtcatu depends on SUNWj3dev, which is not selected

WARNING: SUNWtcatu depends on SUNWj3rt, which is not selected

WARNING: SUNWmcon depends on SUNWjhdev, which is not selected

WARNING: SUNWmcon depends on SUNWjhrt, which is not selected

WARNING: SUNWdtjxt depends on SUNWj3rt, which is not selected

WARNING: SUNWjmf depends on SUNWj3rt, which is not selected

WARNING: SUNWfsmgtu depends on SUNWj3rt, which is not selected

WARNING: SUNWfsmgtu depends on SUNWwbpro, which is not selected

WARNING: SUNWfsmgtu depends on SUNWwbcor, which is not selected

WARNING: SUNWfsmgtu depends on SUNWwbcou, which is not selected

WARNING: SUNWfsmgtu depends on SUNWwbapi, which is not selected

WARNING: SUNWdmgtu depends on SUNWwbpro, which is not selected

WARNING: SUNWdmgtu depends on SUNWwbcou, which is not selected

WARNING: SUNWdmgtu depends on SUNWwbcor, which is not selected

WARNING: SUNWlvma depends on SUNWj3rt, which is not selected

WARNING: SUNWlvma depends on SUNWwbpro, which is not selected

WARNING: SUNWlvma depends on SUNWwbcor, which is not selected

WARNING: SUNWlvma depends on SUNWwbcou, which is not selected

WARNING: SUNWlvma depends on SUNWwbapi, which is not selected

WARNING: SUNWlvmg depends on SUNWj3rt, which is not selected

WARNING: SUNWlvmg depends on SUNWwbcor, which is not selected

WARNING: SUNWlvmg depends on SUNWwbcou, which is not selected

WARNING: SUNWlvmg depends on SUNWwbapi, which is not selected

WARNING: SUNWfdl depends on SUNWj3rt, which is not selected

WARNING: SUNWdclnt depends on SUNWwbpro, which is not selected

WARNING: SUNWdclnt depends on SUNWj3rt, which is not selected

WARNING: SUNWdclnt depends on SUNWwbcor, which is not selected

WARNING: SUNWdclnt depends on SUNWwbcou, which is not selected

WARNING: SUNWdclnt depends on SUNWwbapi, which is not selected

WARNING: SUNWpprou depends on SUNWj3rt, which is not selected

WARNING: SUNWjatodmo depends on SUNWj3dev, which is not selected

WARNING: SUNWjatodmo depends on SUNWj3rt, which is not selected

WARNING: SUNWdhcsu depends on SUNWwbcou, which is not selected

WARNING: SUNWiqu depends on SUNWjhrt, which is not selected

WARNING: SUNWant depends on SUNWj3dev, which is not selected

WARNING: SUNWant depends on SUNWj3rt, which is not selected

WARNING: SUNWasu depends on SUNWjhrt, which is not selected

WARNING: SUNWjai depends on SUNWj3rt, which is not selected

WARNING: SUNWppro-plugin-sunos-base depends on SUNWj3rt, which is not selected

WARNING: SUNWpmgr depends on SUNWj3rt, which is not selected

WARNING: SUNWpmgr depends on SUNWwbapi, which is not selected

WARNING: SUNWzfsgu depends on SUNWjhrt, which is not selected

WARNING: SUNWzfsgu depends on SUNWjhdev, which is not selected

WARNING: SUNWswupcl depends on SUNWj3rt, which is not selected

WARNING: SUNWj3dmo depends on SUNWj3rt, which is not selected

WARNING: SUNWmgts depends on SUNWj3rt, which is not selected

WARNING: SUNWmgts depends on SUNWwbpro, which is not selected

WARNING: SUNWmgts depends on SUNWwbcor, which is not selected

WARNING: SUNWmgts depends on SUNWwbcou, which is not selected

WARNING: SUNWmgts depends on SUNWwbapi, which is not selected

WARNING: SUNWjmfmp3 depends on SUNWj3rt, which is not selected

WARNING: SUNWmcex depends on SUNWj3rt, which is not selected

WARNING: SUNWswupclr depends on SUNWj3rt, which is not selected

WARNING: SUNWglow depends on SUNWjhrt, which is not selected

WARNING: SUNWtcatr depends on SUNWj3dev, which is not selected

WARNING: SUNWtcatr depends on SUNWj3rt, which is not selected

WARNING: SUNWj3cfg depends on SUNWj3rt, which is not selected

Space check complete.

Building upgrade script

Preparing system for Solaris upgrade

Upgrading Solaris: 100% completed

– Environment variables (/etc/default/init)

Installation log location

– /a/var/sadm/system/logs/upgrade_log (before reboot)

– /var/sadm/system/logs/upgrade_log (after reboot)

Please examine the file:

– /a/var/sadm/system/data/upgrade_cleanup

It contains a list of actions that may need to be performed to complete

the upgrade. After this system is rebooted, this file can be found at:

– /var/sadm/system/data/upgrade_cleanup

Upgrade complete

# more /a/var/sadm/system/logs/upgrade_log

Starting upgrade:

Removing obsolete packages and saving modified files

Removing package FJSVvplu:

Removal of <FJSVvplu> was successful.

Removing package FJSVvplr:

Removal of <FJSVvplr> was successful.

Removing package SUNWcsu:

Removal of <SUNWcsu> was successful.

Removing package SUNWcsl:

Removal of <SUNWcsl> was successful.

Removing package TSBWvplu:

Removal of <TSBWvplu> was successful.

Removing package TSBWvplr:

Removal of <TSBWvplr> was successful.

Removing package SUNWkvm:

# more /a/var/sadm/system/data/upgrade_cleanup

This file contains a list of files on the upgraded system that may need

to be manually modified after the upgrade.  Typically, the files in this

list are files that were modified since their original installation.

The following text explains the entries in this file:

ENTRY:

<file1>: existing file renamed to <file2>

EXPLANATION:

The file with the name <file1> was present on the system at the time of

the upgrade.  It had been modified since its original installation,

so the upgrade program renamed it to <file2>.

RECOMMENDED ACTION:

The user should examine the contents of the renamed file to determine

whether the modifications made to the file should be made to the

newly installed version of the file, which will have name <file1>

after the upgrade completes.

ENTRY

# ifconfig -a

lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1

inet 127.0.0.1 netmask ff000000

vnet0: flags=1000863<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,IPv4> mtu 1500 index 2

inet 192.168.136.32 netmask ffffff00 broadcast 192.168.136.255

ether 0:14:4f:fa:f5:6a

# ifconfig vnet0 unplumb

# hostname

old-phys-server-ldom

# df -h

Filesystem             size   used  avail capacity  Mounted on

/ramdisk-root:a        203M   181M   2.3M    99%    /

/devices                 0K     0K     0K     0%    /devices

ctfs                     0K     0K     0K     0%    /system/contract

proc                     0K     0K     0K     0%    /proc

mnttab                   0K     0K     0K     0%    /etc/mnttab

swap                    15G   352K    15G     1%    /etc/svc/volatile

objfs                    0K     0K     0K     0%    /system/object

sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab

swap                    15G   107M    15G     1%    /tmp

/tmp/dev                15G   107M    15G     1%    /dev

fd                       0K     0K     0K     0%    /dev/fd

/devices/virtual-devices@100/channel-devices@200/disk@1:a

2.1G   2.1G     0K   100%    /cdrom

df: cannot statvfs /platform/sun4v/lib/libc_psr.so.1: Operation not applicable

df: cannot statvfs /platform/sun4v/lib/sparcv9/libc_psr.so.1: Operation not applicable

swap                    15G    32K    15G     1%    /tmp/root/var/run

/usr/sbin/install.d/install_config

203M   181M   2.3M    99%    /tmp/_install_config

/dev/dsk/c0d0s0         26G    21G   5.5G    79%    /a

/dev/dsk/c0d0s3        9.8G   1.5G   8.3G    16%    /a/var

/dev/dsk/c0d0s6         46G   262M    45G     1%    /a/export/home

df: cannot statvfs /platform/sun4u-us3/lib/libc_psr.so.1: Operation not applicable

df: cannot statvfs /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1: Operation not applicable

# cd /a/etc

# more hosts

#

# Internet host table

#

#

# Merged entries from ipnodes into hosts on <Mon Apr 22 14:04:53 CDT 2013>

# Backup files saved in /etc/inet/ directory: hosts.premerge, ipnodes.premerge

#

::1     localhost

127.0.0.1       localhost

192.168.136.32     old-phys-server-ldom    loghost

# more /etc/hostname.vnet0

/etc/hostname.vnet0: No such file or directory

# ls -lart /a/etc/hostname*

-rw-r–r–¬†¬† 1 root¬†¬†¬†¬† root¬†¬†¬†¬†¬†¬†¬†¬†¬† 13 Apr 22 10:45 /a/etc/hostname.vnet0

# more /a/etc/hostname.vnet0

old-phys-server-ldom

# init 0

Creating boot_archive for /a

updating /a/platform/sun4v/boot_archive

# syncing file systems… done

Program terminated

SPARC T4-4, No Keyboard

Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.

OpenBoot 4.34.1, 8192 MB memory available, Serial #83530234.

Ethernet address 0:14:4f:fa:91:fa, Host ID: 84fa91fa.

{0} ok boot

Boot device: disk  File and args:

Migrating/upgrading from a physical server to an LDOM will entail some hiccups, as will upgrading from Solaris 9 to 10. Boot newly created ldom into single-user mode and then pkgrm all Veritas software and also edit the /etc/system file to ensure any remnant of veritas from the physical incarnation of the system are removed as well.

Re-install Veritas storage foundation from media if you need to mount veritas volumes on newly converted host.

Also, as soon as possible, migrate from UFS-based root filesystem to ZFS boot

Converting to ZFS boot

Investigating the sizes of existing filessystems on the server, it might turn out that a particular filesystem is not very heavily being used. In our instance (old-phys-server-ldom:/export/home size was 46GB and only 213MB of it was being used.

So, tar-balling the contents of /export/home to /export/home2 (under current root fs), the slice c0d0s6 was cleared up to become a ZFS pool.

# mkdir /export/home2

# cd /export/home

# tar cvf – .|(cd /export/home2; tar xfBp -)

# cd /

# umount /export/home

# cd /export; mv home home.old; mv home2 home

Comment out vfstab entry for /dev/dsk/c0d0s6

# zpool create -f syspool c0d0s6

# lucreate -n firstBE -p syspool

Determining types of file systems supported

Validating file system requests

Preparing logical storage devices

Preparing physical storage devices

Configuring physical storage devices

Configuring logical storage devices

Analyzing system configuration.

No name for current boot environment.

INFORMATION: The current boot environment is not named – assigning name <c0d0s0>.

Current boot environment is named <c0d0s0>.

Creating initial configuration for primary boot environment <c0d0s0>.

INFORMATION: No BEs are configured on this system.

The device </dev/dsk/c0d0s0> is not a root device for any boot environment; cannot get BE ID.

PBE configuration successful: PBE name <c0d0s0> PBE Boot Device </dev/dsk/c0d0s0>.

Updating boot environment description database on all BEs.

Updating system configuration files.

The device </dev/dsk/c0d0s6> is not a root device for any boot environment; cannot get BE ID.

Creating configuration for boot environment <firstBE>.

Source boot environment is <c0d0s0>.

Creating file systems on boot environment <firstBE>.

Creating <zfs> file system for </> in zone <global> on <syspool/ROOT/firstBE>.

Apr 22 15:50:04 old-phys-server-ldom unix: /kernel/drv/sparcv9/pfil: undefined symbol

Apr 22 15:50:04 old-phys-server-ldom unix:¬† ‘ill_g_head’

Apr 22 15:50:04 old-phys-server-ldom unix: WARNING: mod_load: cannot load module ‘pfil’

Apr 22 15:50:04 old-phys-server-ldom unix: /kernel/drv/sparcv9/pfil: undefined symbol

Apr 22 15:50:04 old-phys-server-ldom unix:¬† ‘ill_g_head’

Apr 22 15:50:04 old-phys-server-ldom unix: WARNING: mod_load: cannot load module ‘pfil’

Populating file systems on boot environment <firstBE>.

Analyzing zones.

Mounting ABE <firstBE>.

Generating file list.

Copying data from PBE <c0d0s0> to ABE <firstBE>.

2% of filenames transferred

# luactivate -n firstBE

When you can manage it, get another 90gb lun allocated to the host, create a new pool, say “rpool” from that new lun and run the same command again to create a larger root pool (90gb vs 46gb)

# lucreate -n altBE -p rpool

Jul 052013
 

It’s been a while since I’ve posted anything. So, here goes:

Identifying kernel memory leak on myhost-ldom (after P2V and OS upgrade from Solaris 9 to Solaris 10u10):

kmem_track.d sees this:

Tracing...If you see more allocs than frees, there is a potential issue...
Check against the cache name that is suspect

CACHE NAME                       ALLOCS   FREES
kmem_bufctl_audit_cache          0        47775
kmem_alloc_256                   0        87805
streams_dblk_1040                26072    0
kmem_alloc_40                    63752    0
vn_cache                         64883    64484
kmem_alloc_1152                  85338    82191
rctl_val_cache                   98712    99425
anonmap_cache                    105272   106039
kmem_alloc_96                    109072   108992
sfmmu8_cache                     109171   112886
kmem_alloc_32                    134058   135008
zio_cache                        146456   146456
streams_dblk_80                  162260   162274
kmem_alloc_160                   167740   167783
kmem_alloc_80                    187855   188146
sfmmu1_cache                     190247   194525
segvn_cache                      217514   218797
seg_cache                        232548   233831
kmem_alloc_8                     283391   283672
kmem_alloc_64                    286856   286354
streams_mblk                     313263   313281
anon_cache                       330058   336717
Tracing...If you see more allocs than frees, there is a potential issue...
Check against the cache name that is suspect

CACHE NAME                       ALLOCS   FREES
kmem_bufctl_audit_cache          0        47778
kmem_alloc_256                   0        87807
streams_dblk_1040                26216    0
kmem_alloc_40                    63777    0
vn_cache                         64887    64488
kmem_alloc_1152                  85383    82236
rctl_val_cache                   98787    99500
anonmap_cache                    105331   106098
kmem_alloc_96                    109075   108995
sfmmu8_cache                     109226   112967
kmem_alloc_32                    134132   135082
zio_cache                        146468   146468
streams_dblk_80                  162472   162486
kmem_alloc_160                   167875   167918
kmem_alloc_80                    187950   188241
sfmmu1_cache                     190362   194689
segvn_cache                      217628   218911
seg_cache                        232666   233949
kmem_alloc_8                     283452   283733
kmem_alloc_64                    286923   286421
streams_mblk                     313688   313706
anon_cache                       330176   336835
Tracing...If you see more allocs than frees, there is a potential issue...
Check against the cache name that is suspect

The two caches ( streams_dblk_1040 and kmem_alloc_40 are growing rapidly), associated with growth of kernel memory (validated by following output):

-----------------------------------
05-22-13-15-15
-----------------------------------
Page Summary                Pages                MB  %Tot
------------     ----------------  ----------------  ----
Kernel                      99310               775   10%
ZFS File Data               31104               243    3%
Anon                        36342               283    4%
Exec and libs                4090                31    0%
Page cache                  20560               160    2%
Free (cachelist)             3905                30    0%
Free (freelist)            833012              6507   81%

Total                     1028323              8033
Physical                  1008210              7876

-----------------------------------
05-22-13-15-30
-----------------------------------
Page Summary                Pages                MB  %Tot
------------     ----------------  ----------------  ----
Kernel                     150859              1178   15%
ZFS File Data               65092               508    6%
Anon                        68299               533    7%
Exec and libs                9371                73    1%
Page cache                  22618               176    2%
Free (cachelist)            11104                86    1%
Free (freelist)            700980              5476   68%

Total                     1028323              8033
Physical                  1005627              7856
-----------------------------------

The kernel memory utilization has grown 400MB in a space of 15 minutes.

So, running dtrace on streams_dblk_1040 cache shows us this:

$ sudo dtrace -n 'fbt::kmem_cache_alloc:entry /args[0]-&gt;cache_name == "streams_dblk_1040"/ \
 { @[uid,pid,ppid,curpsinfo-&gt;pr_psargs,execname,stack()] = count(); trunc(@,10);}'
dtrace: description 'fbt::kmem_cache_alloc:entry ' matched 1 probe
CPU     ID                    FUNCTION:NAME

        0     2122        1  /usr/local/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a  snmpd
              genunix`allocb+0x94
              ip`snmpcom_req+0x2bc
              ip`ip_wput_nondata+0x7b0
              unix`putnext+0x218
              unix`putnext+0x218
              ip`snmpcom_req+0x37c
              ip`ip_snmpmod_wput+0xe4
              unix`putnext+0x218
              ip`snmpcom_req+0x37c
              ip`ip_snmpmod_wput+0xe4
              unix`putnext+0x218
              genunix`strput+0x1d8
              genunix`strputmsg+0x2d4
              genunix`msgio32+0x354
              genunix`putmsg32+0x98
              unix`syscall_trap32+0xcc
               11
        0     2122        1  /usr/local/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a  snmpd
              genunix`allocb+0x94
              ip`snmp_append_data2+0x70
              ip`tcp_snmp_get+0x5d4
              ip`snmpcom_req+0x350
              ip`ip_snmpmod_wput+0xe4
              unix`putnext+0x218
              ip`snmpcom_req+0x37c
              ip`ip_snmpmod_wput+0xe4
              unix`putnext+0x218
              genunix`strput+0x1d8
              genunix`strputmsg+0x2d4
              genunix`msgio32+0x354
              genunix`putmsg32+0x98
              unix`syscall_trap32+0xcc
               22
        0     2122        1  /usr/local/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a  snmpd
              genunix`allocb+0x94
              ip`snmp_append_data2+0x70
              ip`ip_snmp_get2_v4+0x310
              ip`ire_walk_ill_tables+0x30c
              ip`ire_walk_ipvers+0x64
              ip`ip_snmp_get_mib2_ip_route_media+0x74
              ip`ip_snmp_get+0x298
              ip`snmpcom_req+0x350
              ip`ip_wput_nondata+0x7b0
              unix`putnext+0x218
              unix`putnext+0x218
              ip`snmpcom_req+0x37c
              ip`ip_snmpmod_wput+0xe4
              unix`putnext+0x218
              ip`snmpcom_req+0x37c
              ip`ip_snmpmod_wput+0xe4
              unix`putnext+0x218
              genunix`strput+0x1d8
              genunix`strputmsg+0x2d4
              genunix`msgio32+0x354
               77

This is snmpd. I had already noted that snmpd had an issues (complained during boot up about configuration file entries).

Stopping net-smpd resulted in the kernel memory being released back into the freelist.

The other cache — kmem_alloc_40 shows this:

$ sudo dtrace -n 'fbt::kmem_cache_alloc:entry /args[0]-&gt;cache_name == "kmem_alloc_40"/ \
{ @[uid,pid,ppid,curpsinfo-&gt;pr_psargs,execname,stack()] = count(); trunc(@,10);}'
dtrace: description 'fbt::kmem_cache_alloc:entry ' matched 1 probe
CPU     ID                    FUNCTION:NAME
        0      586        1  /opt/quest/sbin/vasd -p /var/opt/quest/vas/vasd/.vasd.pid  vasd
              genunix`kmem_zalloc+0x28
              zfs`dsl_dir_tempreserve_impl+0x1e0
              zfs`dsl_dir_tempreserve_space+0x128
              zfs`dmu_tx_try_assign+0x220
              zfs`dmu_tx_assign+0xc
              zfs`zfs_write+0x4b8
              genunix`fop_write+0x20
              genunix`write+0x268
              unix`syscall_trap32+0xcc
               39
        0      586        1  /opt/quest/sbin/vasd -p /var/opt/quest/vas/vasd/.vasd.pid  vasd
              genunix`kmem_zalloc+0x28
              zfs`dsl_dir_tempreserve_space+0x68
              zfs`dmu_tx_try_assign+0x220
              zfs`dmu_tx_assign+0xc
              zfs`zfs_write+0x4b8
              genunix`fop_write+0x20
              genunix`write+0x268
              unix`syscall_trap32+0xcc
               39
        0      586        1  /opt/quest/sbin/vasd -p /var/opt/quest/vas/vasd/.vasd.pid  vasd
              genunix`kmem_zalloc+0x28
              zfs`dsl_dir_tempreserve_space+0xd4
              zfs`dmu_tx_try_assign+0x220
              zfs`dmu_tx_assign+0xc
              zfs`zfs_write+0x4b8
              genunix`fop_write+0x20
              genunix`write+0x268
              unix`syscall_trap32+0xcc
               39
        0      586        1  /opt/quest/sbin/vasd -p /var/opt/quest/vas/vasd/.vasd.pid  vasd
              genunix`kmem_zalloc+0x28
              zfs`zfs_get_data+0x80
              zfs`zil_lwb_commit+0x188
              zfs`zil_commit_writer+0xbc
              zfs`zil_commit+0x90
              zfs`zfs_fsync+0xfc
              genunix`fop_fsync+0x14
              genunix`fdsync+0x20
              unix`syscall_trap32+0xcc
               40

Looks like vintela is writing to ZFS…

After shutting down snmpd, it seems like kernel stopped growing like crazy…

$ echo "::memstat"|sudo mdb -k
Page Summary                Pages                MB  %Tot
------------     ----------------  ----------------  ----
Kernel                     151839              1186   15%
ZFS File Data               65746               513    6%
Anon                        58443               456    6%
Exec and libs                6927                54    1%
Page cache                  22475               175    2%
Free (cachelist)            13836               108    1%
Free (freelist)            709057              5539   69%

Total                     1028323              8033
Physical                  1005627              7856
[$:/var/adm (56)]
$ echo "::memstat"|sudo mdb -k
Page Summary                Pages                MB  %Tot
------------     ----------------  ----------------  ----
Kernel                     135583              1059   13%
ZFS File Data               65876               514    6%
Anon                        55253               431    5%
Exec and libs                7202                56    1%
Page cache                  22475               175    2%
Free (cachelist)            13589               106    1%
Free (freelist)            728345              5690   71%

Total                     1028323              8033
Physical                  1005627              7856
[$:/var/adm (57)]
$ echo "::memstat"|sudo mdb -k
Page Summary                Pages                MB  %Tot
------------     ----------------  ----------------  ----
Kernel                     135839              1061   13%
ZFS File Data               65941               515    6%
Anon                        55161               430    5%
Exec and libs                6909                53    1%
Page cache                  22477               175    2%
Free (cachelist)            13890               108    1%
Free (freelist)            728106              5688   71%

Total                     1028323              8033
Physical                  1005627              7856

It’s now hovering around 1000MB, down from ~ 1200MB..

05-24-2013 Revisit

anon_cache                       1162987  1161545
Tracing...If you see more allocs than frees, there is a potential issue...
Check against the cache name that is suspect

CACHE NAME                       ALLOCS   FREES
kmem_alloc_16                    0        204696
kmem_alloc_128                   111705   111703
vn_cache                         182607   0
kmem_alloc_256                   186757   186900
file_cache                       217169   217300
kmem_alloc_40                    242674   242645
zio_cache                        279855   279855
kmem_alloc_1152                  295560   295553
rctl_val_cache                   354759   355428
sfmmu8_cache                     358797   360868
kmem_alloc_96                    370087   370046
anonmap_cache                    380465   380542
kmem_alloc_160                   474039   474385
kmem_alloc_32                    476749   476818
kmem_alloc_8                     588250   587960
kmem_alloc_80                    674765   675200
sfmmu1_cache                     683800   684676
segvn_cache                      785621   785685
kmem_alloc_64                    789370   788307
seg_cache                        839840   839904
anon_cache                       1163105  1161663

Only one stands out — vn_cache. Therefore, run following dtrace command:

$ sudo dtrace -qn 'fbt::kmem_cache_alloc:entry /args[0]-&gt;cache_name == "vn_cache"/  \
{ @[uid,pid,ppid,curpsinfo-&gt;pr_psargs,execname,stack()] = count(); trunc(@,10);} \
profile:::tick-15sec { printa(@); }'

This will show stack trace aggregations of top 10 processes entering kmem_cache_alloc at a 15 second interval. Turns out it is HPOV:

        0     2104        1  /opt/perf/bin/perfd                                 perfd
              genunix`vn_alloc+0xc
              procfs`prgetnode+0x38
              procfs`pr_lookup_procdir+0x94
              procfs`prlookup+0x198
              genunix`fop_lookup+0x28
              genunix`lookuppnvp+0x30c
              genunix`lookuppnat+0x120
              genunix`lookupnameat+0x5c
              genunix`vn_openat+0x168
              genunix`copen+0x260
              unix`syscall_trap32+0xcc
             1087
        0     2104        1  /opt/perf/bin/perfd                                 perfd
              genunix`vn_alloc+0xc
              procfs`prgetnode+0x38
              procfs`prgetnode+0x110
              procfs`pr_lookup_procdir+0x94
              procfs`prlookup+0x198
              genunix`fop_lookup+0x28
              genunix`lookuppnvp+0x30c
              genunix`lookuppnat+0x120
              genunix`lookupnameat+0x5c
              genunix`vn_openat+0x168
              genunix`copen+0x260
              unix`syscall_trap32+0xcc
             1087
        0     2046        1  /opt/perf/bin/scopeux                               scopeux
              genunix`vn_alloc+0xc
              procfs`prgetnode+0x38
              procfs`pr_lookup_procdir+0x94
              procfs`prlookup+0x198
              genunix`fop_lookup+0x28
              genunix`lookuppnvp+0x30c
              genunix`lookuppnat+0x120
              genunix`lookupnameat+0x5c
              genunix`vn_openat+0x168
              genunix`copen+0x260
              unix`syscall_trap32+0xcc
             2168
        0     2046        1  /opt/perf/bin/scopeux                               scopeux
              genunix`vn_alloc+0xc
              procfs`prgetnode+0x38
              procfs`prgetnode+0x110
              procfs`pr_lookup_procdir+0x94
              procfs`prlookup+0x198
              genunix`fop_lookup+0x28
              genunix`lookuppnvp+0x30c
              genunix`lookuppnat+0x120
              genunix`lookupnameat+0x5c
              genunix`vn_openat+0x168
              genunix`copen+0x260
              unix`syscall_trap32+0xcc

Which lines up with the output of the heap/stack growth (hpstckgrow.d) script —

Tracing...Ctrl-C to exit
Tracking processes that are growing their heap size...
aggregation printed at 60s intervals
EXEC     PID      COMMAND                                  COUNT
kstat    23772    /usr/perl5/bin/perl /usr/bin/kstat -n dnlcstats 412
kstat    26262    /usr/perl5/bin/perl /usr/bin/kstat -n dnlcstats 412
kstat    28069    /usr/perl5/bin/perl /usr/bin/kstat -n dnlcstats 412
kstat    647      /usr/perl5/bin/perl /usr/bin/kstat -p unix:::boot_time 1028
kstat    6674     /usr/perl5/bin/perl /usr/bin/kstat -p unix:::boot_time 1028
kstat    24090    /usr/perl5/bin/perl /usr/bin/kstat -p unix:::boot_time 1028
kstat    1410     /usr/perl5/bin/perl /usr/bin/kstat -p unix:::boot_time 1030
facter   395      /opt/puppet/bin/ruby /opt/puppet/bin/facter --puppet --yaml 2106
facter   6561     /opt/puppet/bin/ruby /opt/puppet/bin/facter --puppet --yaml 2106
facter   23793    /opt/puppet/bin/ruby /opt/puppet/bin/facter --puppet --yaml 2107

Tracking processes that are growing their stack size...
aggregation printed at 60s intervals
EXEC     PID      COMMAND                                  COUNT
zstatd   27933    /opt/sun/xvm/lib/zstat/zstatd            1
zstatd   28306    /opt/sun/xvm/lib/zstat/zstatd            1
zstatd   28763    /opt/sun/xvm/lib/zstat/zstatd            1
zstatd   28918    /opt/sun/xvm/lib/zstat/zstatd            1
zstatd   29227    /opt/sun/xvm/lib/zstat/zstatd            1
zstatd   29491    /opt/sun/xvm/lib/zstat/zstatd            1
zstatd   29664    /opt/sun/xvm/lib/zstat/zstatd            1
java     952      /usr/jdk/instances/jdk1.6.0/bin/java -Xmx150m -Xss192k -XX:MinHeapFreeRatio=10  5
scopeux  2046     /opt/perf/bin/scopeux                    126
perfd    2104     /opt/perf/bin/perfd                      1260
Uninstalling and reinstalling the net-snmpd and HP Openview packages ultimately stopped the memory leaks.
Links:
Both the scripts listed above are modifications/adaptations of code from Brendan Gregg’s excellent DTrace book —

Sep 102009
 

Password Vault


The uxpsh application

         &lt;site A&gt;                                                         &lt;site B&gt;
        _______________                                                     ________________
       |   bastion1  |                                                     | bastion 2      |
       |               |                                                   |                |
       |               |                                                   |                |
       |               |                                                   |                |
       |_______________|                                                   |________________|
                    \ _____                                                        _____/
                     |/var |                                                      |/var |
                     |_____|                                                      |_____|
                           \ _______                                      _______ /
                            |/uxadm |=================================&gt;  |/uxadm |
                            |_______|          replicated                |_______|
                                               via ssh tunneled
                                               rsync every day

The password vault tool uses the “Crypt::Simple” perl module (don’t go by the name, it’s got a bunch of stuff happening under the hood) to encrypt anything that is typed into the interface and saves it on a file-system acl’ed back end store.

Only a select group (the System Admins) have ability to access this backend store (as a result the Vault application). The appliction has been written to search, modify, add and delete entries and each action is audited in the backend repository. Using a simply Curses based menu, the app is self-intuitive and requires no training.

About Crypt::Simple

  • The name of the program is used as the key to create an MD5 hash of the string that is being encrypted.
  • FreezeThaw is used to squish all the data into a concise textual representation
  • Compress::Zlib is used to compress this string
  • Crypt::Blowfish in a home-brew CBC mode is used to actually encrypt this string
  • Then the string is processed via Mime::Base64 to actually produce the text that is being displayed.

For instance,

password123 becomes ==&gt; 4vXAfgpKoyEZN67CpgmATZgV4nXirSvhzCWwQSY54GF2Wol0noNCqIujvUXCRVWj

Get the application here:

uxpsh

The Code is here:

#!/opt/perl/bin/perl

#——————————————————————————
# uxpsh — UNIX password shell
# Author — Dwai Lahiri
# Created — 4/13/2004
# Credits to : Steven L. Kunz’s perlmenu demo program(s)
# Note: Even though advisory exclusive write locks are in place,
# have to make sure file doesn’t get clobbered by simultaneous writes
# Modified — 4/27/2004 — DL
# Cleaned up some old declarations, variables, etc – 6/25/04 – DL
# Minor fixes to “cleanup” routine – 6/25/04 – DL
# SCCS Delta 1.3
# $Id: uxpsh,v 1.1 2006/01/16 18:16:02 dlahiri Exp $
#——————————————————————————

#use strict;¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬† #For now, don’t use strict subs
BEGIN { $Curses::OldCurses = 1; }
use lib “/opt/perl/lib/site_perl/5.8.8/sun4-solaris”;
use Curses;¬†¬†¬†¬†¬† #PerlMenu needs “Curses”
use perlmenu;    #Main menu package

use Crypt::Simple;
use File::Copy qw/mv cp/;
require “menuutil.pl”;¬†¬†¬† #For “pause” and “print_nl” routines

my $pwfl = “/var/uxadm/usccpux.txt”;

$SIG{‘INT’} = ‘cleanup';¬†¬†¬† #Set Signal Handler
$| = 1;                     #Flush after every write to stdout

my $window = &initscr();

&menu_curses_application($window);
&menu_quit_routine(“endwin”);

#Default prefs active at start
my $numbered_flag = 1;            #Numbered menus
my $num_pref¬†¬†¬†¬†¬† = “numbered”;
my $gopher_pref¬†¬† = “default”;¬†¬†¬† #Non-gopherlike arrows/scrolling
my $gopher_flag   = 0;
my $mult_pref¬†¬†¬†¬† = “single”;¬†¬†¬†¬† #Single column menus
my $mult_flag     = 0;
my $arrow_pref¬†¬†¬† = “arrow”;¬†¬†¬†¬†¬† #Arrow selection indicator menus
my $arrow_flag    = 1;

my $menu_default_top = 0;              # Storage for mainline top item number.
my $menu_default_row = 0;              # Storage for mainline arrow location.
my $menu_default_col = 0;              # Storage for mainline arrow location.
my $row              = my $col = 0;    # Storage for row/col for menuutil.pl
my $title_cnt = 0;    # To trigger different subtitles/bottom titles
my $default;
my $version = “v0.5″;

@input_data   = ();
@display_data = ();
@protect      = ();
$bell¬†¬†¬†¬†¬†¬†¬†¬† = “\007″;
$default¬†¬†¬†¬†¬† = “”;
my $null = “/dev/null”;
my $src;
my $dest;
my $username = $ENV{LOGNAME};

while (1) {
&menu_init(
$numbered_flag, “UNIX Password Shell Utility $version”,
0, “”, “– WARNING $username! If you don’t have permission to use this application, \n exit immediately!\n Abusers will be prosecuted to the maximum extent of the Law.\n All actions are logged and monitored. “,
“main_menu_help”
);

&menu_paint_file( “/usr/bin/unix_text”, 0 );
&menu_item( “Exit this shell”,¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬† “exit” );
&menu_item( “Search records for a hostname”, “host_pw” );
&menu_item( “host modify”,¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬† “mod_host” );
&menu_item( “host add”,¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬† “add_host” );
&menu_item( “host delete”,¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬† “del_host” );
my $sel =
&menu_display( “”, $menu_default_row, $menu_default_top,
$menu_default_col );
if ( $sel eq “exit” ) { last; }

if ( $sel eq “%EMPTY%” ) {
die “Not enough screen lines to display passwd shell menu\n”;
}
if ( $sel ne “%UP%” ) {

#Note that this assumes the “action_text” is a subroutine name
&$sel();
}
if ( $sel eq “host_pw” )¬† { &host_pw(); }
if ( $sel eq “mod_host” ) { &mod_host(); }
if ( $sel eq “add_host” ) { &add_host(); }
if ( $sel eq “del_host” ) { &del_host(); }
}
endwin;
exit;

sub main_menu_help {
my ( $item_text, $item_tag ) = @_;

&top_title(“Password shell — Help Screen for Specific Menu Items”);
&print_nl( “Selection \”$item_text\””, 2 );
if ( $item_tag eq “exit” ) {
&print_nl( “Selecting this item will immediately exit this program.”,
1 );
}
elsif ( $item_tag eq “host_pw” ) {
&print_nl( “Search password for given host string — returns value only if valid hostname in the repository”,
1 );
}
elsif ( $item_tag eq “mod_host” ) {
print_nl( “Modify an existing password entry.”, 1 );
}
elsif ( $item_tag eq “add_host” ) {
print_nl( “Add a password entry to the encrypted repository.”, 1 );
}
elsif ( $item_tag eq “del_host” ) {
print_nl( “Delete a password entry from the ecrypted repository.”, 1 );
}
pause(“(Press any key to exit help)”);
}

sub host_pw {
my $sel;
while (1) {
my $prow = $row;
my $pcol = $col + 2;

#Init a numbered menu with a title
&menu_init( $numbered_flag,
“Search database for host string entered here” );

#Add item to return to main menu
&menu_item( “Exit”, “exit” );

&menu_item( “Host string search”, “get_host_str” );

$sel =
menu_display( “”, $menu_default_row, $menu_default_top,
$menu_default_col );
if ( ( $sel eq “%UP%” ) || ( $sel eq “exit” ) ) { return; }
if ( $sel eq “get_host_str” ) {
print_nl( ”¬†¬†¬† Enter the hostname you’re looking for”, 1 );
&print_nl( ”¬† Supply a null value to exit.”, 2 );
$prow = $row;
$pcol = $col + 2;
my $hostname = &menu_getstr( $prow, $pcol, “Enter hostname: “,
0, $default, 20, 0 );
last if ( $hostname eq “” );
decreep($hostname);
}
&clear_screen();
}
}

sub mod_host {
my $sel;
while (1) {
my $prow = $row;
my $pcol = $col + 2;

#Init a numbered menu with a title
&menu_init( $numbered_flag,
“Modify a host/password entry in the encrypted file” );

#Add item to return to main menu
&menu_item( “Exit”, “exit” );

&menu_item( “Modify host/passwd entry”, “mod_host_str” );

$sel =
menu_display( “”, $menu_default_row, $menu_default_top,
$menu_default_col );
if ( ( $sel eq “%UP%” ) || ( $sel eq “exit” ) ) { return; }
if ( $sel eq “mod_host_str” ) {
print_nl( ”¬†¬†¬† Enter the hostname you want to modify”, 1 );
&print_nl( ”¬† Supply a null value to exit.”, 2 );
$prow = $row;
$pcol = $col + 2;
my $hostname = &menu_getstr( $prow, $pcol, “Enter hostname: “,
0, $default, 20, 0 );
print_nl( ”¬†¬†¬† Enter the new password”, 1 );
$prow = $row;
$pcol = $col + 2;
my $password = &menu_getstr( $prow, $pcol, “Enter new password: “,
0, $default, 20, 0 );
last if ( $hostname eq “” );
modit( $hostname, $password );
}
&clear_screen();
}
}

sub add_host {
my $sel;
while (1) {
my $prow = $row;
my $pcol = $col + 2;

#Init a numbered menu with a title
&menu_init( $numbered_flag,
“Add a host/password entry in the encrypted repository” );

#Add item to return to main menu
&menu_item( “Exit”, “exit” );

&menu_item( “Add host/passwd entry”, “add_host_str” );

$sel =
menu_display( “”, $menu_default_row, $menu_default_top,
$menu_default_col );
if ( ( $sel eq “%UP%” ) || ( $sel eq “exit” ) ) { return; }
if ( $sel eq “add_host_str” ) {
print_nl( ”¬†¬†¬† Enter the hostname you want to add”, 1 );
&print_nl( ”¬† Supply a null value to exit.”, 2 );
$prow = $row;
$pcol = $col + 2;
my $hostname = &menu_getstr( $prow, $pcol, “Enter hostname: “,
0, $default, 20, 0 );
print_nl( ”¬†¬†¬† Enter the password for the given hostname”, 1 );
$prow = $row;
$pcol = $col + 2;
my $password = &menu_getstr( $prow, $pcol, “Enter password: “,
0, $default, 20, 0 );
last if ( $hostname eq “” );
addit( $hostname, $password );
}
&clear_screen();
}
}

sub del_host {
my $sel;
while (1) {
my $prow = $row;
my $pcol = $col + 2;

#Init a numbered menu with a title
&menu_init( $numbered_flag,
“Delete an existing entry from encrypted repository” );

#Add item to return to main menu
&menu_item( “Exit”, “exit” );

&menu_item( “delete host/passwd entry”, “del_host_str” );

$sel =
menu_display( “”, $menu_default_row, $menu_default_top,
$menu_default_col );
if ( ( $sel eq “%UP%” ) || ( $sel eq “exit” ) ) { return; }
if ( $sel eq “del_host_str” ) {
print_nl( ”¬†¬†¬† Enter the hostname you want to delete”, 1 );
&print_nl( ”¬† Supply a null value to exit.”, 2 );
$prow = $row;
$pcol = $col + 2;
my $hostname = &menu_getstr( $prow, $pcol, “Enter host name: “,
0, $default, 20, 0 );
last if ( $hostname eq “” );
delit($hostname);
}
&clear_screen();
}
}

sub handleit {
my $string = shift;
if ( !&display_entry($string) ) {
&new_line(1);
&pause(
”¬† Login \”$string\” not found – Press any key to continue $bell”);
$default = $string;
}
else { $default = “”; }
}

sub decreep {
require ‘menuutil.pl';
my $host = shift;
my @arr;
chomp $host;
open( SRCHPWFL, “< $pwfl” ) || die “Unable to open $pwfl: $!\n”;
for (<SRCHPWFL>) {
if ( $_ =~ m/^$host/i ) {
@arr = split( ‘:’, $_ );
my $password = decrypt( $arr[1] );
menu_display(“Password for $arr[0] is : $password”);
}
}
close(SRCHPWFL);
}

sub modit {
my ( $host, $password ) = @_;
my @arr;
my $date = qx/date ‘+%m%d%Y%H%M’/;
chomp $date;
$src  = $pwfl;
$dest = $pwfl . “.” . $date;
chomp $dest;
cp( “$src”, “$dest” );
open( MOD1PWFL, “< $dest” ) || menu_display(“Unable to open $dest: $!\n”);
open( MODPWFL,¬† “>> $src” ) || menu_display(“Unable to open $src: $!\n”);
system(“> $src”);¬†¬†¬† #Zero out the actual password file
flock(MODPWFL, 2) or menu_display(“Unable to get an exclusive write lock on $src: $! \n”);

if ( ( !-z $host ) && ( !-z $password ) ) {
my $encrypted = encrypt($password);
for (<MOD1PWFL>) {
print MODPWFL “$_” and next if /^#/;
my @lsplit = split(‘:’, $_);
if ( $lsplit[0] eq $host ) {
$lsplit[1] = $encrypted;
print MODPWFL “# $username Modified $host entry — $date \n”;
print MODPWFL “$host:$lsplit[1]\n”;
}
else {
print MODPWFL “$_”;
}
}
}
close(MOD1PWFL);
close(MODPWFL);
}

sub addit {
my ( $host, $password ) = @_;
my $date = qx/date ‘+%m%d%Y%H%M’/;
chomp $date;
$src  = $pwfl;
$dest = $pwfl . “.” . $date;
chomp $dest;
cp( “$src”, “$dest” );
open(READPWFL, “< $dest”);
open( ADDPWFL, “>> $src” ) || menu_display(“Unable to open $src : $!\n”);
flock(ADDPWFL, 2) or menu_display(“Unable to get an exclusive write lock on: $src \n”);

if ( ( !-z $host ) && ( !-z $password ) ) {
my $encrypted = encrypt($password);
for (<READPWFL>) {
next  if /^#/o;
my @lsplit = split(‘:’,$_);
if ( $lsplit[0]  eq $host ) {
menu_display(“$host already has an entry in : $src \n”);
return 1;
}
}
if ($? != 1) {
print ADDPWFL “# $username added entry for $host – $date \n”;
print ADDPWFL “$host:$encrypted\n”;
}
}
close(ADDPWFL);
}

sub delit {
my $host = shift;
my @arr;
chomp $host;
my $date = qx/date ‘+%m%d%Y%H%M’/;
chomp $date;
$src  = $pwfl;
$dest = $pwfl . “.” . $date;
chomp $dest;
cp( “$src”, “$dest” );
open( DEL1PWFL, “< $dest” ) || menu_display(“Unable to open $dest: $!\n”);
open( DELPWFL,¬† “>> $src” ) || menu_display(“Unable to open $src: $!\n”);
system(“> $src”);¬†¬†¬† #Zero out actual pw file
flock(DELPWFL, 2) or menu_display(“Unable to get an exclusive write lock on : $src \n”);

for (<DEL1PWFL>) {
print DELPWFL “$_” and next¬† if /^#/;
my @lsplit = split(‘:’,$_);
if ( $lsplit[0] ne  $host ) {
print DELPWFL “$_” ;
}
else {
print DELPWFL “# $username deleted entry for $host – $date \n”;
}
}
close(DEL1PWFL);
close(DELPWFL);
}

sub cleanup {
&clear_screen;
wrefresh;
endwin;
exit;
}

sub inwait {
ReadMode(‘cbreak’);
if ( defined( $char = ReadKey(-1) ) ) {
print $char;
}
else {
print “No input waiting\n”;
}
ReadMode(‘normal’);
}

Jan 072009
 

Steps to updating flashimage on Sun M5000 servers:

Download latest flash image

http://www.sun.com/download/products.xml?id=46fc425e

Download to usb drive.

I had to rename the file “[]” were put into the name on download.

I made a directory named images

Moved renamed file (FFXCP1071.tar.gz) into images directory.

(The usb port is on the XSCF card in rear of system)

Load image into system memory:

XSCF>getflashimage file:///media/usb_msd/images/FFXCP1071.tar.gz

Answer: Y (Loads image into memory)

Install image:

XSCF>flashupdate -c update -m xcp -s 1071

Answer: Y