Wednesday, March 29, 2006

Solaris Infrequently Asked and Obscure Questions

VCS Stuff (What to do after a crash)

If you've had a Veritas Cluster Server node crash and see this:

VCS CRITICAL V-16-1-11306 Did not receive cluster membership,
manual intervention may be needed for seeding

Try this:

# gabconfig -x

This will re-seed the control port, and should bring the box back up
into the cluster. Check your logs: /var/VRTSvcs/log, and don't forget

Solaris VCS 4.0 User Guide:
Soalris VCS 4.0 Install Guide:

More VCS Simulator Notes

For Veritas Cluster Server Simulator.

I had to do a few things, to get it working right, after configuring
the simulated cluster:

Set your variables:
C:\Program Files\VERITAS\VCS Simulator\bin>set VCS_SIM_PORT=14153
C:\Program Files\VERITAS\VCS Simulator\bin>set VCS_SIM_WAC_PORT=-1

To check the state of the simulated cluster:
C:\Program Files\VERITAS\VCS Simulator\bin>hasim -sys -state

This will clear "Stale Admin Wait" errors, from the GUI, when you try
to launch it:
- hasim -sys -force {systemname} :
C:\Program Files\VERITAS\VCS Simulator\bin> hasim -sys -force psprdp_sys1

Then launch the GUI. If all the nodes are down, click the middle tab
on top of the left pane and any nodes that have a "?" over it's icon,
right click, select up. Then go back to the first tab that looks like
blocks (That Q-Bert looking icon, remember that game?) and online
everything that is down.

That should be it! Have phun.

Monday, March 27, 2006

VCS Simulator

I am currently testing Veritas Cluster Server simulator, and setting
up a copy of our Production clusters on my Windows desktop.

After installing the simulator, open a command window and set up the
config for the cluster by running:

hasim -setupclus <name> -simport <port>

Then copy the .cf files from /etc/VRTSvcs/conf/config on the cluster,
to $SIMROOT/VCS Simulator/<name>/conf/config.

Afterwards, run:

hasim -start <system> -clus <name>

Where <system> is a system in the cluster named <cluster> that you
created before. You can then start up the VCS Cluster Monitor, and
point it to the port that you specified when creating the cluster on
the desktop.

This should have brought up that system in the cluster, and you can
then start up the other systems in the simulator. From this point you
can test failing over, adding new systems and resources, and just test
it all out without the hassle of having the hardware duplicated.

You can download the simulator for free (Registration required):

Wednesday, March 22, 2006

Look for cams in google

Put this in the serach box, in google:


have phun ;-)

Now this is frealin kewl!

Interactive upgrade site

Friday, March 17, 2006

Happy Saint Patrick's Day!!

You may know this as performed by Metallica (I think Thin Lizzy did it, too), but it's originally an Irish Folk tune (Irish / English dringing song, 17th Century).


Whiskey In The Jar Lyrics (Metallica Rendition)

As I was going over the Cork and Kerry mountains
I saw Captain Farrell and his money he was counting
I first produced my pistol and then produced my rapier
I said "stand and deliver or the devil he may take you"

I took all of his money and it was a pretty penny
I took all of his money, yeah, and I brought it home to Molly
She swore that she loved me, no, never would she leave me
But the devil take that woman, yeah, for you know she tricked me

Musha rain dum-a-do-dum-a-da
Whack for my daddy-o
Whack for my daddy-o
There's whiskey in the jar-o

Being drunk and weary I went to Molly's chamber
Taking Molly with me, but I never knew the danger
For about six or maybe seven, yeah, in walked Captain Farrell
I jumped up, fired my pistols, and I shot him with both barrels,

Musha rain dum-a-do-dum-a-da, yeah-yeah
Whack for my daddy-o
Whack for my daddy-o
There's whiskey in the jar-o

Now some men like the fishing and some men like the fowling
And some men like to hear, to hear the cannonball a-roaring
Me I like sleeping, especially in my Molly's chamber
But here I am in prison, here I am with a ball and chain, yeah

Musha rain dum-a-do-dum-a-da, yeah-yeah
Whack for my daddy-o
Whack for my daddy-o
There's whiskey in the jar-o, yeah

Whiskey in the jar-o, yeah

Musha rain dum-a-do-dum-a-da
Musha rain dum-a-do-dum-a-da, hey
Musha rain dum-a-do-dum-a-da
Musha rain dum-a-do-dum-a-da, yeah
Original Lyrics:
I was a-goin’ over gilgarra mountain
I met with captain farrell, and his money he was countin’.
First I drew my pistols and then I drew my rapier,
Sayin’ stand and deliver, for I am your bold deceiver.
Musha ringum duram da,
Whack fol the daddy-o,
Whack fol the daddy-o,
There’s whiskey in the jar.
He counted out his money and it made a pretty penny;
I put it in my pocket to take home to ’ jenny.
She sighed and swore she loved me and never would deceive me,
But the devil take the women, for they always lie so easy!
Musha ringum duram da
I went into me chamber all for to take a slumber,
To dream of gold and girls, and of course it was no wonder:
Me jenny took me charges and she filled them up with water,
Called on captain farrell to get ready for the slaughter.
Musha ringum duram da
Next mornin’ early, before I rose for travel,
Up came a band of footmen and likewise captain farrell.
I goes to draw my pistol, for she’d stole away my rapier,
But I couldn’t shoot for water, so a prisoner I was taken
Musha ringum duram da
They put me into jail with a judge all a-writin’:
For robbin’ colonel farrell on gilgarra mountain.
But they didn’t take me fists and I knocked the jailer down
And bid me a farewell to this tight-fisted town.

Musha ringum duram da
I’d like to find me brother, the one who’s in the army;
I don’t know where he’s stationed, be it cork or in killarney.
Together we’d go roamin’ o’er the mountains of kilkenny,
And I swear he’d treat me fairer than my darlin’ sportin’ jenny!

Musha ringum duram da
There’s some that takes delight in the carriages and rollin’,
Some that takes delight in the hurley or the bollin’,
But I takes delight in the juice of the barley,
Courtin’ pretty maids in the mornin’, o so early!
Musha ringum duram da

Like to know more about Irish traditional music?

Thursday, March 16, 2006

VCS Cheat Sheet


VCS Cheat Sheet


VCS is built on three components: LLT, GAB, and VCS itself. LLT
handles kernel-to-kernel communication over the LAN heartbeat links,
GAB handles shared disk communication and messaging between cluster
members, and VCS handles the management of services.

Once cluster members can communicate via LLT and GAB, VCS is started.
In the VCS configuration, each Cluster contains systems, Service
Groups, and Resources. Service Groups contain a list of systems
belonging to that group, a list of systems on which the Group should
be started, and Resources. A Resource is something controlled or
monitored by VCS, like network interfaces, logical IP's, mount point,
physical/logical disks, processes, files, etc. Each resource
corresponds to a VCS agent which actually handles VCS control over the

VCS configuration can be set either statically through a configuration
file, dynamically through the CLI, or both. LLT and GAB configurations
are primarily set through configuration files.


VCS configuration is fairly simple. The three configurations to worry
about are LLT, GAB, and VCS resources.

LLT configuration requires two files: /etc/llttab and /etc/llthosts.
llttab contains information on node-id, cluster membership, and
heartbeat links. It should look like this:

# llttab -- low-latency transport configuration file

# this sets our node ID, must be unique in cluster
set-node 0

# set the heartbeat links
link hme1 /dev/hme:1 - ether - -
# link-lowpri is for public networks
link-lowpri hme0 /dev/hme:0 - ether - -

# set cluster number, must be unique
set-cluster 0


The "link" directive should only be used for private links.
"link-lowpri" is better suited to public networks used for heartbeats,
as it uses less bandwidth. VCS requires at least two heartbeat signals
(although one of these can be a communication disk) to function
without complaints.

The "set-cluster" directive tells LLT which cluster to listen to. The
llttab needs to end in "start" to tell LLT to actually run.

The second file is /etc/llthosts. This file is just like /etc/hosts,
except instead of IP->hostnames, it does llt node numbers (as set in
set-node). You need this file for VCS to start. It should look like

0 daldev05
1 daldev06

GAB requires only one configuration file, /etc/gabtab. This file lists
the number of nodes in the cluster and also, if there are any
communication disks in the system, configuration for them. Ex:

/sbin/gabconfig -c -n2

tells GAB to start GAB with 2 hosts in the cluster. To specify VCS
communication disks:

/sbin/gabdisk -a /dev/dsk/cXtXdXs2 -s 16 -p a
/sbin/gabdisk -a /dev/dsk/cXtXdXs2 -s 144 -p h
/sbin/gabdisk -a /dev/dsk/cYtYdYs2 -s 16 -p a
/sbin/gabdisk -a /dev/dsk/cYtYdYs2 -s 144 -p h

-a specifies the disk, -s specifies the start block for each
communication region, and -p specifies the port to use, "a" being the
GAB seed port and "h" the VCS port. The ports are the same as the
network ports used by LLT and GAB, but are simulated on a disk.

The VCS configuration file(s) are in /etc/VRTSvcs/conf/config. The two
most important files are and I like to set $VCSCONF
to that directory to make my life easier. contains the actual
VCS configuration for Clusters, Groups, and Resources, while
contains C-like prototypes for each possible Resource.

The VCS configurationis very similar to the C language, but all you
are doing is defining variables. Comments are "//" (if you try to use
#'s, you'll be unhappy with the result), and you can use "include"
statements if you want to break up your configuration to make it more
readable. One file you must include is

In, you need to specify a Cluster definition:

cluster iMS ( )

You can specify variables within this cluster definition, but for the
most part, the defaults are acceptible. Cluster variables include
maximum number of groups per cluster, link monitoring, log size,
maximum number of resources, maximum number of types, and a list of
user names for the GUI that you will never use and shouldn't install.

You then need to specify the systems in the cluster:

system daldev05 ( )
system daldev06 ( )

These systems must be in /etc/llthosts for VCS to start.

You can also specify SNMP settings for VCS:

snmp vcs (
Enabled = 1
IPAddr =
TrapList = { 1 = "A new system has joined the VCS Cluster",
2 = "An existing system has changed its state",
3 = "A service group has changed its state",
4 = "One or more heartbeat links has gone down",
5 = "An HA service has done a manual restart",
6 = "An HA service has been manually idled",
7 = "An HA service has been successfully started" }

IPAddr is the IP address of the trap listener. Enabled defaults to 0,
so you need to include this if you want VCS to send traps. You can
also specify a list of numerical traps; listed above are the VCS
default traps.

Each cluster can have multiple Service Group definitions. The most
basic Service Group looks like this:

group iMS5a (
SystemList = { daldev05, daldev06 }
AutoStartList = { daldev05 }

You can also set the following variables (not a complete list):

* FailOverPolicy - you can set which policy is used to determine
which system to fail over to, choose from Priority (numerically based
on node-id), Load (system with the lowest system load gets failover),
or RoundRobin (system with the least number of active services is
* ManualOps - whether VCS allows manual (CLI) operation on this Group
* Parallel - indicats if the service group is parallel or failover

Inside each Service Group you need to define Resources. These are the
nuts and bolts of VCS. A full description of the bundled Resources can
be found in the Install Guide and a full description of the
configuration language can be found in the User's Guide.

Here are a couple of Resource examples:

NIC networka (
Device = hme0
NetworkType = ether

IP logical_IPa (
Device = hme0
Address = ""

The first line begins with a Resource type (e.g. NIC or IP) and then a
globally unique name for that particular resource. Inside the paren
block, you can set the variables for each resource.

Once you have set up resources, you need to build a resource
dependancy tree for the group. The syntax is "child_resource requires
parent_resource." A dependancy tree for the above resources would look
like this:

logical_IPa requires networka

The dependancy tree tells VCS which resources need to be started
before other resources can be activated. In this case, VCS knows that
the NIC hme0 has to be working before resource logical_IPa can be
started. This works well with things like volumes and volumegroups;
without a dependancy tree, VCS could try to mount a volume before
importing the volume group. VCS deactivates all VCS controlled
resources when it shuts down, so all virtual interfaces (resource type
IP) are unplumbed and volumes are unmounted/exported at VCS shutdown.

Once the configuration is buld, you can verify it by running
/opt/VRTSvcs/bin/hacf -verify and then you can start VCS by running

Commands and Tasks

Here are some important commands in VCS. They are in /opt/VRTSvcs/bin
unless otherwise noted. It's a good idea to set your PATH to include
that directory.

Manpages for these commands are all installed in /opt/VRTS/man.

* hastart starts VCS using the current seeded configuration.
* hastop stops VCS. -all stops it on all VCS nodes in the cluster,
-force keeps the service groups up but stops VCS, and -local stop VCS
on the current node, and -sys systemname stop VCS on a remote system.
* hastatus shows VCS status for all nodes, groups, and resources.
It waits for new VCS status, so it runs forever unless you run it with
the -summary option.
* /sbin/lltstat shows network statistics (for only the local host)
much like netstat -s. Using the -nvv option shows detailed information
on all hosts on the network segment, even if they aren't members of
the cluster.
* /sbin/gabconfig sets the GAB configuration just like in
/etc/gabtab. /sbin/gabconfig -a show current GAB port status. Output
should look like this:

daldev05 # /sbin/gabconfig -a
GAB Port Memberships
Port a gen f6c90005 membership 01
Port h gen 3aab0005 membership 01

The last digits in each line are the node IDs of the cluster
members. Any mention of "jeopardy" ports means there's a problem with
that node in the cluster.
* haclus displays information about the VCS cluster. It's not
particularly useful because there are other, more detailed tools you
can use:
* hasys controls information about VCS systems. hasys -display
shows each host in the cluster and it's current status. You can also
set this to add, delete, or modify existing systems in the cluster.
* hagrp controls Service Groups. It can offline, online (or swing)
groups from host to host. This is one of the most useful VCS tools.
* hares controls Resources. This is the finest granular tool for
VCS, as it can add, remove, or modify individual resources and
resource attributes.

Here are some useful things you can do with VCS:

Activate VCS: run "hastart" on one system. All members of the cluster
will use the seeded configuration. All the resources come up.

Swing a whole Group administratively:

Assuming the system you're running GroupA on is sysa, and you want to
swing it to sysb

hagrp -switch GroupA -to sysb

Turn off a particular resource (say, ResourceA on sysa):

hares -offline ResourceA -sys sysa

In a failover Group, you can only online the resource on system on
which the group is online, so if ResourceA is a member of GroupA, you
can only bring ResourceA online on the system that is running GroupA.
To online a resource:

hares -online ResourceA -sys sysa

If you get a fault on any resource or group, you need to clear the
Fault on a system before you can bring that resource/group up on it.
To clear faults:

hagrp -clear GroupA
hares -clear ResourceA


Here are some tricks for VCS:

VCS likes to have complete control of all its resources. It brings up
all its own virtual interfaces, so don't bother to do that in your
init scripts. VCS also likes to have complete control of all the
Veritas volumes and groups, so you shouldn't mount them at boot. VCS
will fail to mount a volume unless it is responsible for importing the
Volume Group; if you import the VG and then start VCS, it will fail
after about 5 minutes and drop the volume without cleaning the FS. So
make sure all VCS-controlled VG's are exported before starting VCS.

Resource and Group names have no scope in VCS, so each must be a
unique identifier or VCS will fail to load your new configuration.
There is no equivalent to perl's my or local. VCS is also very case
sensitive, so all Types, Groups, Resources, and Systems must be the
same every time. To make matters worse, most of the VCS bundled types
use random capitalization to try to fool you. Copy and paste is your

Make sure to create your Resource Dependancy Tree before your start
VCS or you could fuck up your whole cluster.

The default time-out for LLT/GAB communication is 15 seconds. If VCS
detects a system is down on all communcations channels for 15 seconds,
it fails all of that system's resource groups over to a new system.

If you use Veritas VM, VCS can't manage volumes in rootdg, so what I
do is encapsulate the root disk into rootdg and create new volume in
their own VCS managed VG. Don't put VCS and non-VCS volumes in the
same VG.

Don't let VCS manage non-virtual interfaces. I did this in testing,
and if you fail a real interface, VCS will unplumb it, fail it over to
a virtual on the fail-over system. Then when you try to swing it back,
it will fail.

Notes on how the configuration is loaded

Because VCS doesn't have any determination of primary/slave for the
cluster, VCS needs to determine who has the valid configuration for
the cluster. As far as I can tell (because of course it's not
documented), this is how it works: When VCS starts, GAB waits a
predetermined timeout for the number of systems in /etc/gabtab to join
the cluster. At this point, all the systems in the cluster compare
local configurations, and the system with the newest config tries to
load it. If it's invalid, it pulls down the second newest valid
config. If it is valid, all the systems in VCS load that config.

Veritas Volume Manager Cheat Sheet


Veritas Volume Manager Cheat Sheet:

The Setup: an Oracle database supporting an application called ABC,
and given the following:

Assuming that we need to create filesystems intended for Oracle and:

we are using a SID of 'ABC'

we have nine disks, c0t0d1 through c0t0d9

we will be creating six volumes: /u01/oradata/ABC ( 4gb ),
/u02/oradata/ABC (4gb ), /u03/oradata/ABC (8gb ), /u04/oradata/ABC (
4gb ), /u01/app/oracle/product/8.0.5_ABC ( 4gb ), and /u01/admin/ABC (
4gb ).

We added these disks to Volume Manager Control during installation
with vxinstall, or later with vxdiskadd(1m). Both vxinstall and
vxdiskadd can add either initialize a previously unused disk, or
'encapsulate' a disk already containing data, but not under Volume
Manager control.

we could take the following steps to set up our filesystems.
Adding an EMC disk to Veritas

Use the inq utility to see if you have SCSI visibility to the disk

Use vxdisk -o alldgs list to see if Veritas has seen the disk

if not, try the following, and then repeat the previous step:


vxdctl initdmp

vxdctl enable

Creating a Disk Group in Volume Manager:

Create a vxvm disk group for the Oracle SID using vxdg(1m). It's
important that all of the disks/filesystems necessary for the ABC
database to run are included in the disk group, otherwise the database
could not be moved to another system.

The easiest way to do this is to use vxdiskadd
vxdiskadd c0t0d0 c0t0d1 c0t0d2 . . .

Doing it the hard way:
vxdg init ABCdg ABCdg01=c0t0d1

This would create a disk group called ABCdg containing one physical
disk, c0t0d1, which will be referred to by it's name within vxvm,
ABCdg01. You cannot initiate a disk group without specifying at least
one disk as a member of the group. You should not include any disks
destined to be part of an Oracle Database in the default vxvm group,
rootdg. This allows you to use the vxdg 'deport' and 'import' commands
to migrate an entire vxvm disk group to another host.

Now that we've create the disk group for our database, we can add the
rest of our disks to it:

vxdg -g ABCdg adddisk ABCdg02=c0t0d2

vxdg -g ABCdg adddisk ABCdg09=c0t0d9

Creating Volumes With vxassist

vxassist(1m) is a vxvm command that acts as a front-end to other vxvm
commands, much as newfs(1m) acts as a simpler-to-use front-end to
mkfs(1m). Using vxassist with it's -v flag will display the actual
vxvm commands used during volume construction. vxassist also
front-ends vxfs commands and normal UNIX utilities during volume
construction. An example of this is using a single vxassist command to
set up a volume. Using vxassist simplifies many vxvm tasks, but you
should pay careful attention to the defaults you will inherit when
setting up volumes using this tool. Understanding the contents of the
/etc/default/vxassist file is important, especially when striping

To make our 8gb /u03/oradata/ABC volume, we could use the following
command line:

vxassist -g ABCdg make ABC01 8g

Breaking it down into it's component parts:


-g ABCdg # this volume will belong to the ABCdg disk group

make # tells vxassist that we are creating a new volume

ABC01 # name the volume

8g # specify the size of the volume

Here we create the other five volumes:

vxassist -g ABCdg make ABC02 8g

vxassist -g ABCdg make ABC03 8g

vxassist -g ABCdg make ABC04 8g

vxassist -g ABCdg make ABC05 8g

vxassist -g ABCdg make ABC06 8g

Creating a File System:

We now lay filesystems down on our newly created volumes. We assume
here that you've agreed with the Oracle DBA's to use a block size of
8192 for our filesystems. Not specifying a block size allow Veritas to
dynamically assign one for you based upon the size of the volume. Our
volumes would default to 1024 for a block size on our 4 GB volumes,
and 2048 for our 8GB volume. We will specify the largefiles option,
because the mkfs_vxfs(1m) command uses nolargefiles as a default,
unlike mkfs_ufs(1m) on Solaris 2.6 or greater, which uses largefiles
as a default. If we forgot to do so, we could use fsadm (
fsadm_vxfs(1m) ) to set the largefiles bit on. fsadm can also query a
mounted filesystem for the current setting of this flag. Be certain
that whatever flags you set during file system creation or
modification are reflect in vfstab, or the resulting file system may
be un-mount-able.

mkfs -F vxfs -o bsize=8192,largefiles /dev/vx/rdsk/ABCdg/ABC01

Mounting a File System:

Creating and mounting filesystems go hand in hand. You must be certain
that any special flags set at creation time are reflected in
/etc/vfstab, or on the command line if there is no entry in vfstab for
your filesystem.

mount -F vxfs -o largefiles /dev/vx/dsk/ABCdg/ABC01 /u03/oradata/ABC

Resizing a mounted volume and file system:

/etc/vx/bin/vxresize -g rootdg -F vxfs archive 16g

Recovering disks under VM control:

(if you want to live dangerously, try looking at


* Do a vxprint -g mydg first to see what disks your volumes lie on!
* Do a vxdisk list and save it
* Do an inq -et and save it!
* You may wish to review moving a volume off of a particluar disk

1) comment the volume(s) you're destroying out of vfstab

2) umount the volume

3) stop it:
vxvol stop volume01

4) remove it:
vxedit -rf rm volume01

5) remove the disk(s) the volume was on from the disk group ( up to
the last disk )
vxdg -g mydg rmdisk dmdiskname01

6) Remove the the disk(s) from VXVM control
vxdisk rm c1t1d51s2

7) If you wish do get rid of the disk group ( in order to recover the
last disk ), you must destroy the disk group:
vxdg destroy mydg

8) remove the last disk
vxdisk rm c2t7d9s2

9) If you're removing the disks from the EMC port, be sure to clean up:
vxdctl enable
vxdctl initdmp

10) Freak out and realize you whacked the wrong thing, use /root/eotw
to recover.

Renaming a VM Disk:

Since names like "ABCdg10" are not as descriptive as they could be,
you can rename it to something more useful.

vxedit rename ABCdg10 ABCdg_hot_spare

Using long disk names can be more descriptive, but will make using
vxva trickier, as it will truncate your disk name somewhat if it is
too long.

Moving a Disk Group to Another System:

1) umount the disks:

umount /u01/app/oracle/product/8.0.5_ABC

umount /u01/admin/ABC

umount /u01/oradata/ABC

umount /u02/oradata/ABC

umount /u03/oradata/ABC

umount /u04/oradata/ABC

2) Stop the volumes:

vxvol -g ABCdg stopall

3) deport the disk group from one system:

vxdg deport ABCdg

4) import them on another system:

vxdg import ABCdg

5) Start all of the volumes on the new system and resync mirrors in
the background:

vxrecover -g ABCdg -sb

6) mount the filesystems

mount /u01/app/oracle/product/8.0.5_ABC

mount /u01/admin/ABC

mount /u01/oradata/ABC

mount /u02/oradata/ABC

mount /u03/oradata/ABC

mount /u04/oradata/ABC

This procedure assumes that the second system can see the disks, and
also that you have commented the file systems out of vfstab on the old

Rename a Disk Group

dfwns19 # df -k | grep reports
/dev/vx/dsk/reportsdg/ncr01 /u01/app/oracle/admin/REPORTS
/dev/vx/dsk/reportsdg/ncr02 /u01/app/oracle/product/8.0.5REPORTS
/dev/vx/dsk/reportsdg/ncr03 /u01/oradata/REPORTS
/dev/vx/dsk/reportsdg/ncr04 /u02/oradata/REPORTS
/dev/vx/dsk/reportsdg/ncr05 /u03/oradata/REPORTS
/dev/vx/dsk/reportsdg/ncr06 /u04/oradata/REPORTS
/dev/vx/dsk/reportsdg/ncr07 /u11/oraarch/REPORTS

dfwns19 # umount /u01/app/oracle/admin/REPORTS
dfwns19 # umount /u01/app/oracle/product/8.0.5REPORTS
dfwns19 # umount /u01/oradata/REPORTS
dfwns19 # umount /u02/oradata/REPORTS
dfwns19 # umount /u03/oradata/REPORTS
dfwns19 # umount /u04/oradata/REPORTS
dfwns19 # umount /u11/oraarch/REPORTS

dfwns19 # vxvol -g reportsdg stopall

dfwns19 # vxdg deport reportsdg

dfwns19 # vxdg -n nclproddg import reportsdg

dfwns19 # vxdg list
Mirroring and then breaking mirrors

# make an sd from your dm ( use the -g, or it won't work. The book is wrong )
# sdname dmname,start_offset,sd_length
vxmake -g dwproddg sd dwprodd15-01 dwprodd15,0,8389440

# create a plex from your sd
vxmake -g dwproddg plex dw01-02 sd=dwprodd15-01

# attach the plex to your volume
vxplex -g dwproddg att dw01 dw01-02

# watch it silver ( check out the pause and slow options. badass )
dfwora03 # vxtask -l list
Task: 162 RUNNING
Operation: PLXATT Vol dw01 0.0
Started: Tue Dec 05 03:47:29 2000
Throttle: 0
Progress: 18.33% 1537352 of 8388608 Blocks
Work time: 1 minute, 26 seconds (06:23 remaining)

# more than one sd per plex for plexen > one dm
vxmake -g dwproddg sd dwprodd17-01 dwprodd17,0,8833920
vxmake -g dwproddg sd dwprodd18-01 dwprodd18,0,7944000
vxmake -g dwproddg plex dw03-02 sd=dwprodd17-01,dwprodd18-01
vxplex -g dwproddg att dw03 dw03-02

# now for the scary part. dis-associating the plexes and sd's
vxplex -o rm dis dw01-01
# zap the dm from the dg
vxdg -g dwproddg rmdisk dwprodd01
# nuke the da
vxdisk rm c2t2d13s2

nclproddg enabled 949356971.2501.dfwns19

Renaming a disk group and volume

bansecdbdg -> secproddg used as an example

# Unmount all volumes in the bansecdbdg disk group.
# Stop all volumes
vxvol -g bansecdbdg stopall

# Deport bansecdbdg
vxdg deport bansecdbdg

# Import bansecdbdg using the -n option
vxdg -n secproddg import bansecdbdg

# Recover the disk group by the new dg name
vxrecover -g secproddg -sb

# Rename each volume
vxedit -g secproddg rename bansecdb01 sec01
vxedit -g secproddg rename bansecdb02 sec02
vxedit -g secproddg rename bansecdb08 sec08

# Update vfstab, your mount points and remount the volumes

Resizing a disk, while specifying the disk

# Resize volume u11, and only use disk dev20dg23
# x requires the volume to grow (i.e. does not let you specify a
# smaller than existing volume size), and b backgrounds the
# task (according to the tech)
./vxresize -F vxfs -bx -g dev20dg u11 16g dev20dg23

Moving a volume off of a particluar disk

# Move u11 off of dm dev20dg20
vxassist -g dev20dg move u11 !dev20dg20

VVR Cheat Sheet


1) Creating a replicated volume on two hosts, hostA and hostB

Before configuring, you need to make sure two scripts have been run
from /etc/rc2.d: S94vxnm-host_infod and S94vxnm-vxnetd. VVR will not
work if these scripts don't get run AFTER VVR licenses have been
instralled. So if you install VVR licenses and don't reboot
immediately after, run these scripts to get VVR to work.

Before the Primary can be set up, the Secondary must be configured.

First, use vxassist to create your datavolumes. Make sure to specify
the logtype as DCM (Data Change Map, which keeps track of data changes
if the Storage Replicator log fills up) if your replicated volumes are

vxassist -g diskgroupB make sampleB 4g layout=log logtype=dcm

Then create the SRL (Storage Replicator Log) for the volume. Carefully
decide how big you want this to be, based on available bandwidth
between your hosts and how fast your writes happen.

See pages 18-25 of the SRVM Configuration Notes for detailed
(excruciatingly) notes on selecting your SRL size.

vxassist -g diskgroupB make srlB 500m

Next make the rlink object:

vxmake -g diskgroupB rlink rlinkB remote_host=hostA
remote_dg=diskgroupA remote_rlink=rlinkA local_host=hostB
synchronous=[off|override|fail] srlprot=dcm

Use synchronous=off only if you can stand to lose some data.
Otherwise, set synchronize=override or synchronize=fail. override runs
as synchronous (writes aren't committed until they reach the
secondary) until the link dies, then it switches to asynchronous,
storing pending writes to the secondary in the SRL. When the link
comes back, it resyncs the secondary and switches back to Synchronous
mode. synchronize=fail fails new updates to the primary in the case of
a downed link.

In any of the above cases, you'll lose data if the link fails and,
before the secondary can catch up to the primary, there is a failure
of the primary data volume. This is why it's important to have both
redundant disks and redundant network paths.

Now make the RVG, where you put together the datavolume, the SRL, and the rlink:

vxmake -g diskgroupB rvg rvgB rlink=rlinkB datavol=sampleB srl=srlB

Attach the rlink to the rvg:

vxrlink -g diskgroupB att rlinkB

Start the RVG on the Secondary:

vxrvg -g diskgroupB start rvgB

Now work begins on the primary. As with the Secondary, make data
volumes, an SRL, and an rlink:

vxassist -g diskgroupA make sampleA 4g layout=log logtype=dcm

vxassist -g diskgroupA make srlA 500m

vxmake -g diskgroupA rlink rlinkA remote_host=hostB
remote_dg=diskgroupB remote_rlink=rlinkB local_host=hostA
synchronous=[off|override|fail] srlprot=dcm

Make the RVG for the primary. Only the last option is different:

vxmake -g diskgroupA rvg rvgA rlink=rlinkA datavol=sampleA srl=srlA primary=true

Now go back to the secondary. When we created the secondary,
brain-dead Veritas figured the volume on the Seconday and the Primary
would have the same name, but when we set this up, we wanted to have
the Primary datavolume named sampleA and the Secondary datavolume be
sampleB. So we need to tell the Secondary that the Primary is sampleA:

vxedit -g diskgroupB set primary_datavol=sampleA sampleB

Now you can attach the rlink to the RVG and start the RVG. On the Primary:

vxrlink -g diskgroupA att rlinkA

You should see output like this:

vxvm:vxrlink: INFO: Secondary data volumes detected with rvg rvgB as parent:
vxvm:vxrlink: INFO: sampleB: len=8388608 primary_datavol=sampleA

Finally, start I/O on the Primary:

vxrvg -g diskgroupA start rvgA

2) Removing a VVR volume

First, detach the rlinks on the Primary and then the Secondary:

vxrlink -g diskgroupA det rlinkA
vxrlink -g diskgroupB det rlinkB

Then stop the RVG on the primary and then the secondary:

vxrvg -g diskgroupA stop rvgA
vxrvg -g diskgroupB stop rvgB

On the primary, stop the datavolumes:

vxvol -g disgroupA stop sampleA

If you want to keep the datavolumes, you need to disassociate them from the RVG:

vxvol -g diskgroupA dis sampleA
vxvol -g diskgroupB dis sampleB

Finally, on both the Primary and the Secondary, remove everything:

vxedit -rf rm rvgA
vxedit -rf rm rvgB

3) Growing/Shrinking a Volume or SRL
This is exactly the same as in regular Veritas. However, VVR doesn't
sync the volume changes. To grow a volume, you first need to grow the
secondary, then the primary. To shrink a volume, first the primary and
then the secondary. You always need to make sure the Secondary is
larger than or as large as the Primary, or you will get a
configuration error from VVR.

You may need to grow an SRL if your pipe shrinks (more likely if your
pipe gets busier) or the amount of data you are sending increases. See
pages 18-25 of the SRVM Configuration Notes for detailed
(excruciatingly) notes on selecting your SRL size.

To grow an SRL, you must first stop the RVG and disassociate the SRL
from the RVG:

vxrvg stop rvgA
vxrlink det rlinkA
vxvol dis srlA

From this point, you can grow your SRL (which is now just an ordinary volume):

vxassist growto srlA 2gb

Once your SRL has been successfully grown, reassociate it with the
RVG, reattach the RLINK, and start the RVG:

vxvol aslog rvgA srlA
vxrlink -f att rlinkA
vxvg start rvgA

4) Getting info out of VVR once it's set up

You can get get useful stats out of the vxrlink command:

vxrlink [-i interval] stats rlinkA

Output should look similar to netstat. If you run without an interval,
you can see cumulative statistics. With an interval, you get the stats
that hit during the interval.

# vxrlink -i 5 rlinkA

Messages Errors Flow Control
-------- ------ ------------
# Blocks RT(usec) Timeout Stream Memory Delays NW Bytes NW Delay
28 0 512 0 0 0 0 5000 1
0 0 512 0 0 0 0 5000 1
0 0 512 0 0 0 0 5000 1
0 0 512 0 0 0 0 5000 1
0 0 512 0 0 0 0 5000 1
0 0 512 0 0 0 0 5000 1
0 0 512 0 0 0 0 5000 1
10 0 2110 0 0 0 0 5000 1
256 0 22766 0 0 0 0 5000 1
468 0 15417 18 0 0 0 5000 4
18 0 7818 0 0 0 0 5000 4
0 0 7818 0 0 0 0 5000 4
0 0 7818 0 0 0 0 5000 4

* # is the number of messages transmitted
* Blocks is the number of 512-byte blocks transmitted
* RT(usec) is the average round-trip per message (the size of the
messages affects the RT) in microseconds
* Timeout is the number of timeouts or lost packets; this can be
affected by the time-out value of the RLINK.
* Stream is the number of stream errors that occur when the RLINK
attemps to send messages faster than the network can handle.
* Memory is the number of memory errors that occur when the
secondary has insufficient buffer space to handle incoming messages.
You can tune this by changing voliomem_max_nmcompool_sz on the
* Delays, NW Bytes, and NW Delay are internal flow control
parameters that indicate how fast the RLINK is attempting to send.

The sample output is from a Secondary system, so there are no Blocks

You can use vxrlink to check the status of an rlink and SRL:

vxrlink -g diskgroupA status rlinkA

Output should look like this:

Rlink rlinkA has 8 outstanding writes, occupying 520 Kbytes (1%) on the SRL

If there are no outstanding writes and the SRL has been fully played,
you will see this message:

Rlink rlinkA is up to date

You can only use this command on the primary. Trying it on the
secondary will just result in Veritas yelling at you.

vxprint can also give you some useful info, and it comes with some shortcuts.

vxprint -Pl
vxprint -Vl

The first command lists all the RLINKs on the system. The second lists
all the RVGs.

You can use this info to check VVR settings and some basic status.
Check the flags for the RLINK to make sure that both systems are
connected and consistent, the IPs and ports are set right, etc.

In the output for an RVG, you can see listed in the flags line if an
RVG is set as the Primary of Secondary node.
5) Changing the Synchronous/Asynchronous setting

to set the synchronous variable for an RLINK, do the following:

vxedit set synchronous=[off|override|fail] rlinkA

6) Failing Over from a Primary

There are two situations where you would have to fail from a primary.
The first is in preparation for an outage of the Primary, in which
case you can happily turn off your app, switch the Primary to a
Secondary, switch the Secondary to a Primary, and start this up again.

The second case is when your Primary goes down in flames and you need
to get your Secondary up as a Primary.

If your primary is still functioning:

First, you'll need to turn off your applications, umount any
filesystems on from your datavolumes, and stop the rvg:

/etc/rc3.d/S99start-app stop
umount /filesysA
vxrvg stop rvgA

If you can't umount your filesystems because of running apps, DON'T go
any further! You'll make your life harder in the future, and you might
lose data.

Once you've stopped the RVG, you need to detach the rlink,
disassociate the SRL volume (you can't edit the PRIMARY RVG attribute
while an SRL is associated), change PRIMARY to false, and bring
everything back up:

vxrlink det rlinkA
vxvol dis srlA
vxedit set primary=false rvgA
vxvol aslog rvgA srlA
vxrvg start rvgA
vxrlink -f att rlinkA

Now go to work on the Old Secondary to bring it up as the new Primary.

First you need to stop the RVG, detach the rlink, disassociate the
SRL, and turn the PRIMARY attribute on:

vxrvg stop rvgB
vxrlink det rlinkB
vxvol dis srlB
vxedit set primary=true rvgB

Veritas recommends that you use vxedit to reinitialize some values on
the RLINK to make sure you're still cool:

vxedit set remote_host=hostA local_host=hostB remote_dg=diskgroupA
remote_rlink=rlinkA rlinkB

Before you can attach the rlink, you need to change the
PRIMARY_DATAVOL attribute on both hosts to point the the Veritas
volume name of the NEW Primary:

On the new primary (e.g. hostB):
vxedit set primary_datavol=sampleB sampleB
On the new secondary (e.g. hostA):
vxedit set primary_datavol=sampleB sampleA

Now that you have that, go back to the new Primary, attach the RLINK,
and start the RVG:

vxrlink -f att rlinkB
vxrvg start rvgB

The vxrlink command should show normal output as described in section 1 above.

If the Primary is down:

First you'll need to bring up the secondary as a primary. If your
secondary datavolume is inconsistent (this is only likely if an SRL
overflow occurred and the secondary was not resynchronized before the
Primary went down) you will need to disassociate the volumes from the
RVG, fsck them if they contain filesystems, and reassociate them with
VVR. If your volumes are consistent, the task is much easier:

On the secondary, first stop the RVG, detach the RLINK, and
disassociate the SRL:

vxrvg stop rvgB
vxrlink det rlinkB
vxvol dis srlB

Make the Secondary the new Primary:

vxedit -g diskgroupB set primary=true rvgB

Now reassociate the SRL and change the primary_datavol:

vxvol aslog rvgB srlB
vxedit set primary_datavol=sampleB sampleB

If the old Primary is still down, all you need to do is start the RVG
to be able to use the datavolumes:

vxrvg start rvgB

This will allow you to keep the volumes in VVR so that once you manage
to resurrect the former Primary, you can make the necessary VVR
commands to set it up as a secondary so it can resynchronize from the
backup system. Once it has resynchronized, you can use the process
listed at the beginning of section 6 (above) to fail from the Old
Secondary/New Primary back to the original configuration.

Here's now to resynchronize the old Primary once you bring it back up:

The RVG and RLINK should be stopped and detached. If not, stop and detach:

vxrvg stop rvgA
vxrlink det rlinkA

Disassociate the SRL and make the system a secondary:

vxvol dis srlA
vxedit set primary=false rvgA

Reassociate the SRL, change the primary_datavol attribute:

vxvol aslog rvgA srlA
vxedit set primary_datavol=sampleB sampleA

Attach the RLINK and then start the RVG:

vxrlink -f att rlinkA
vxrvg start rvgA

This won't do much, as the RLINK on hostB (the Primary) should still
be detached, preventing the Secondary from connecting. Now go back to
the Primary to turn the RLINK on:

vxedit set remote_host=hostA local_host=hostB remote_dg=diskgroupA
vxrlink -a att rlinkB

Giving the -a flag to vxrlink tells it to run in autosync mode. This
will automatically resync the secondary datavolumes from the Primary.
If the Primary is being updated faster than the Secondary can be
synced, the Secondary will never become synced, so this method is only
appropriate for certain implementations.

Once synchronization is complete, follow the instructions above (the
beginning of section 6) to transfer the Primary role back to the
original Primary system.

Thursday, March 09, 2006

Unix/Solaris: One-Liners

Unix/Solaris: One-Liners

Listed here are a bunch of unix commands.

--> change file date stamp
touch –t 199906042020 filename

--> move partitions
ufsdump 0f - /dev/rdsk/c0t0s0s0 | (cd /home; ufsrestore xv -)

--> lay down file system with 1% minfree and inode density
newfs –m1 –i81920 /dev/rdsk/c0t0d0s0

--> check file system
fsck /dev/rdsk/c0t0d0s0

Q: starting sybase
login as sybase, run: ./install/RUN_SYBASE

Q: logging in as sybase sa
isql -U sa <password>

--> dump a partition and pipe to gzip. Watch > 2GB limit
ufsdump 0f - /home | gzip - >/tmp/home.dump.gz

--> rewind offline a tape
mt –f /dev/rmt/0 rewoffl

--> only allow 300MB for user /tmp access
swap - /tmp tmpfs – yes SIZE=300M

--> verbose interactive restore
ufsrestore –ivf /dev/rmt/1

--> remove a printer from a class
lpadmin –p level5-line1 –r level5-line

--> truss a command
truss –-f -–o /tmp/log.txt

--> [DB] feed a script into sybase
isql –Urfe_xfer -Uuser -Ppassword -isqlscript >>blah.txt

--> make a printer class
lpadmin –p level5-line1 –c level5-line

--> remove level2-line2 printer from printer class level2-line
lpadmin -p level2-line2 -r level2-line

--> add level2-line3 to printer class
lpadmin -c level2-line -p level2-line3

--> [DB] how to change your password in isql
sp_password password, password-new

--> move a directory
tar cf - ./games | (cd /tmp; tar xvBpf - )

--> [DB] run a sybase script, and dump to file

--> move a directory to another server
tar cf - ./games | rsh brucey cd /tmp\; tar xvBpf -

--> check for SUID SGID files
ncheck -F ufs -s /dev/dsk/c3t0d0s

-- remove core files
find / -name core –exec rm –f {} \; -o –fstype nfs –prune

--> rebuild man pages
catman –w –M man-page-directory or /usr/lib/makewhatis

--> vi command to show special characters
: set list

--> adding an account
useradd -u 120 –g dls -d /apps/dls –s /bin/ksh -c "comment" -m dls

--> create a mysql database
mysqladmin -uroot -ppassword create ebs

--> starting mysql database
/etc/rc.d/init.d/mysql.server start

--> Invoke CPAN module install
perl –MCPAN –eshell

--> dump to zip
ufsdump 0f - /filesystem | /opt/local/gzip - > /tmp/dump.gz

--> shutdown mysql databse
/usr/local/bin/mysqladmin shutdown -ppassword
/etc/rc.d/init.d/mysql.server stop

--> test the loading of a module
PERL_DL_DEBUG=255 perl -e 'use CGI;'

--> shows open files
fuser –cu /

--> Writing a Daemon:
1. edit /etc/services
add service and port.
2. edit /etc/inetd.conf
add in: edwardd stream tcp nowait root /bin/sh /bin/sh
3. kill –HUP inetd.conf

--> how to mount a file system
mount /dev/dsk/c3t0d0s4 /apps/data/easysoft/DEVT

--> look at sar log
sar –f /var/adm/sa/sa24

--> write file checksums and size
cksum filename

--> show storage array info
ssaadm display /dev/rdsk/c1t5d2s0
--> show all disks on device d
luxadm display d

--> examine for a specific OS finerprint
nmap –sS -p 80 -O -v <host> = examine OS

--> show print jobs
/usr/ucb/lpq –Plevel6

--> Scan for known ports. log it. do OS scan.
nmap –sS -F -o foo.log -v -O =

--> show status of printer
/usr/ucb/lpc status

--> make a swap file:
dd if=/dev/zero of=swapfile bs=1024 count=65535
mkswap ./swapfile
chmod 600 ./swapfile
swapon ./swapfile

--> show open files for process
lsof –p PID

--> show open files for all TCP connections
lsof –iTCP

--> show open files for internet address
lsof -iTCP@

--> as above
lsof -i @

--> examine tcp ports
lsof -iTCP@sarah:1-50000

--> show open files for user.
lsof –u username

--> show processes that has the file in use.
lsof /apps/cms/ECMS-Server

--> show open files and retry every 5 seconds
lsof –p process-id –r 5

--> mount a floppy
mount -t vfat /dev/fd0 /mnt/floppy

--> check here for debugging processes and errno.h for errors

--> scp a whole directory, preserve mods
sudo scp -prv devel webadmin@

--> take processor 2 and 3 offline.
psradm -f 2 3
--> show processor stats verbose.
psrinfo –v

--> how to skip grant tables in mysql (over ride security)
/usr/local/libexec/mysqld -Sg

--> how to feed in an SQL program
mysql <create_table.sql

--> rm all files in directories
find . -type f -exec rm {} \;

--> dump packets to a capture file
sudo snoop –o /tmp/tcp.txt cp

--> backup one liner
tar cvf - /home/ebs | gzip - > ebs.tar.gz

--> Look at selected packets in capture file
sudo snoop -i /tmp/tcp.txt

--> unzip and pipe to tar
gzip -dc <kmysql-1_1_6_tar.gz | tar xvf -

--> watch packets from two servers.
snoop sarah brucey

--> enable ip masquerading
/sbin/ipchains -P forward DENY
/sbin/ipchains -A forward -s -j MASQ

-> view su log file
cat /var/adm/sulog

--> establish a default router or gateway.
echo "" > /etc/defaultrouter
echo " sagacity" >> /etc/hosts
change /etc/nsswitch.conf so that hosts has files, dns
edit resolv.conf put in
search .

--> turn off automounter on /export/home.
vi /etc/auto_master, comment out /export/home

--> configuration file for sudoers

--> building ssh-1.2.27 on x86Solaris2.6 needed a few things:
/usr/openwin/bin in path
/usr/xpg4/bin in path
declare AR="/usr/xpg4/bin/ar"
declare NM_PATH="/usr/xpg4/bin/nm"

--> snoop network packets and get size and time stamp entries.
snoop -S -ta empa1

--> access perl CPAN
perl -MCPAN -e shell
install DBI

--> search for no password entries and lock all accounts.
for i in `passwd –sa | grep NP | awk '{print $1'`
echo "locking $i"
passwd –l $i

--> delete from a tar
tar --delete -f fs_backup_Sunday.tar home/ebs/tmp

--> Example on backing up files to tape. Must specify non rewinding,
else you will over-write the files.
for file in `ls`
echo "sending $file to tape..."
echo `date`
tar cvpf /dev/rmt/0n $file

--> making/adding a partition.
1. use fdisk to make a parition.
2. mkfs -t ext2 -c /dev/hda11
3. mount -t ext2 /dev/hda11 /opt2
4. update /etc/fstab

--> rebuild the windex file
catman –w –M /usr/share/man

--> execute tar on remote host sarah and send tarball to standard output,
which becomes standard input for tar xvf – and the file gets dumped locally,
in this case on crawl. you have to cd to dir before tar or else you
will include path in tar
ssh maggie "cd $DIRNAME; tar cvf - $BASENAME" | (cd $TPATH; tar xvf - )

--> dump a remote filesystem and send it to local tape drive.
ssh -–x $fw /usr/sbin/ufsdump 0cf - $fs | dd obs=63k of=$TAPE

--> encrypt filename 1 and output to 1.crypt file
crypt < 1 > 1.crypt ; rm 1

--> decrypt filename 1.crypt and stdout to screen
crypt < 1.crypt

--> send a file to tape
tar cvpf /dev/rmt/0 filename

--> quicker way to search and replace in vi
: %s/existing/new/g

--> shows where and which shared library files an application uses.
ldd binary

--> shell script stuff:
# repeat a command 100 times
while [ $x -gt 0 ]

--> Something very important to remember about partitions
It is important to note that Cylinder 0 contains the disklabel, which
contains the partition table. A normal filesystem can be placed
starting at Cylinder 0, since it will not touch the disklabel.
If you lay down a raw device, for a database, over Cylinder 0,
then you will completely lose all your partitions. You will then
have to restore the disklabel, and backup from tape if you happen to do this.

--> move a partition
find . |cpio -pdm /apps

--> cron structure
min hour day-of-month month weekday command

--> PatchDiag Tool. Get patches from:
patchdiag.xref is available at:
/opt/local/bin/patchdiag -x /opt/local/lib/patchdiag.xref > patchdiag.`uname -n`

--> command showing system parameters

--> Get Ambient Temperature of Server
/usr/platform/SUNW,Ultra-4/sbin/prtdiag -v

--> good ps formatting showing percent cpu first.
ps -edf -o pcpu,pid,user,arg

--> full details on ps
/usr/bin/ps –A -o user,pid,pcpu,pmem,vsz,rss,tty,s,stime,time,args

--> chown the hidden files as well.
find . -print -exec chown -R sextone:staff {} \;

--> The nsradmin command is a command-line based administrative
program for the NetWorker system. Normally nsradmin monitors
and modifies NetWorker resources over the network.

--> Spray a server
-c number of packets
-d delay in microseconds
-l pakcet size in bytes
/usr/sbin/spray -c 1 –d 20 -l 4096 maggie

--> Turn on bold.
bold=`tput smso`
offbold=`tput rmso`
echo "${bold}You must be the \"root\" user to run this script.${offbold}"

--> good way to send a dir to tape
tar cf /dev/rmt/0n directory

--> example of bringing up an interface
ifconfig hme0:1 inet up

--> show all connections
netstat –f inet

--> rpcinfo makes an RPC call to an RPC server and reports
what it finds.
rpcinfo -b 390109 2 | sort -u

--> rewind a tape fast
< /dev/rmt/0

--> show loaded modules

--> find world readable files and dirs
find / -type d –perm -2 –print
find . -type f –perm -2 -print

--> adding in a boot alias, eg:
boot sarahroot1 –s
nvalias sarahroot1 /sbus@1f,0/sunw,fas@e,8800000/sd@9,0:a

--> clever way to archive
tar cvf - `find . –print` >/tmp/dumpfile.tar
tar xvf - </tmp/dumpfile.tar

--> tee to a file
echo "Start Date/Time: `date`" | tee -a $LOG_FILE

--> read a snoop file
snoop -i anz-telnet.snoop

--> write a snoop log (this will count the number of connections,
which is pretty neat).
snoop –osnoop.log sarah

--> set default run level. 5 for gui.

--> show all exported filesystems
showmount -e crawl

--> shows all configurable variables for tcp interface.
sudo ndd -get /dev/tcp
- ?
sudo ndd -get /dev/tcp tcp_conn_req_max_q
ndd /dev/arp \?
ndd /dev/ip \?
ndd /dev/tcp \?
ndd /dev/udp \?
ndd /dev/icmp \?

--> set sticky bit on group files, only the owner can change the mode.
--> the +l is mandatory file and record locking while a program
--> is accessing that file.
chmod g+s,+l file

--> print duplex landscape 4 qudrant printing
mpage –t –l –4

--> install a patch
installpatch .

--> check to see if a patch has been installed
showrev –p |grep package name

--> unzip, untar in a /tmp directory
zcat 104708-16.tar.gz | ( cd /tmp; sudo tar xvf - )

--> check out revision level on ssa controller
/usr/sbin/ssaadm display controller

--> unzip and untar a file without having to create an intermediate tar file
sudo gzip -dc /tmp/270599/post-EOD.tar.gz |tar xvf -

--> selectively extract from a tar archive
tar xvf /tmp/iona.tar ./iona/.sh_history

--> send a bunch of files to tape
tar cf /tmp/rules.tar ruleb* objects.C *.W

--> examine section 5 of man
man -s 5 signal

--> shows signals and definitions of structures, eg sigaction

--> location of the limits file on solaris

--> send an attachment via email from command prompt
uuencode file.tar.gz file.tar.gz | mailx –s "backup" root@crawl

--> zero a file
cat /dev/null > isam.log

--> good way to restore from cdrom a binary file
zcat < /cdrom/cdrom0/Solaris_2.6/Product/SUNWcsu/install/reloc.cpio.Z |
cpio –idm usr/lib/fs/ufs/ufsrestore

--> running su as a user then ssh
su - dls-PROD -c "/opt/local/bin/ssh drp-stagger \"cd /tmp; /bin/ls\" "

--> verify a newfs format
sudo newfs –Nv /dev/md/dsk/d96

--> making lost_found. must be 8192 bytes in size.
mkdir ./lost+found;chown root ./lost+found; chgrp root ./lost+found
;chmod 700 ./lost+found'; cd ./lost+found
nofiles=0 ; while [ "$nofiles" -le 650 ] ; do ; /usr/ucb/touch
$nofiles ; nofiles=`expr $nofiles + 1` ; done

--> execute lynx
lynx -cfg /usr/lib/lynx.cfg

--> sed search example
sed '/Sep\ 25/!d; /castill/!d' /var/log/syslo

-->should only be used at the EEPROM
boot –r
--> should be used at single user mode
reboot -- -r
--> should be used in multiuser mode
touch /reconfigure

--> performing a remote dump

|cpio -oc |gzip -c
|ssh brucey -l chaup dd obs=18k of=/dev/rmt/0n

- to extract -
cd /ssa/emphasys/sybase/dump
dd ibs=18k if=<TAPE DEVICE>|gunzip -c |cpio –idc

--> boot block located here.
/usr/platform/`uname –i`/lib/fs/ufs

--> getting a server on the network
add hosts entry for IP address
clear configs: ifconfig pe0 unplumb
ifconfig pe0 netmask up
route add default 1
verify the routing table: netstat –rn
add resolv.conf entry: domain nameserver
edit /etc/nsswitch.conf change hosts to files, dns

lesson here is to unplumb interface, and let ifconfig setup the routing.
if you specify an ip address and a netmask it will manage
the routing and the broadcasting.

--> find all, files associated with PID 22240
/usr/proc/bin/pfiles 22240
find file based on inode
find –i number
"ncheck –i number

--> good redirection example
./a.out </etc/termcap | (sleep 10; cat) >trash

--> synchronize files from one server to another. This is useful for
synchronizing database dump files, binary files, etc. This is
definitely a powerful tool.

rsync -avz -e ssh --rsync-path="/usr/local/bin/rsync" `pwd`

--> Example Awk Script

# run with awk -f/tmp/1.awk /etc/group

BEGIN { FS = ":" }
{ print $1 | "sort" }
{ nlines++ }
END { print nlines }

--> awk example.
awk '/#/ {print "Got a comment"}' /etc/hosts

--> delete every 2nd field in file
awk '{$2= ""; print}' datafile >

--> awk average/standard deviation program

x1 += $1
x2 += $1*$1

x1 = x1/NR
x2 = x2/NR
sigma = sqrt(x2 - x1*x1)
if (NR > 1) std_err = sigma/sqrt(NR - 1)
print "Number of points = " NR
print "Mean = " x1
print "Standard Deviation = " sigma
print "Standard Error = " std_err


Tuesday, March 07, 2006

Old software

Hate the "newest feature set" in your favorite software's upgrade?
Can't find the previous version on the provider's site (Thanks Yahoo
and Apple! :-( )

Well then, check for it, here: