30 October 2010

Fix a Broken chmod, or How to chmod chmod

So here's the setup.  You've logged into one of your servers to update
permissions on a file only to see this:

        server [0] /bin/chmod +x /opt/somefile

28 October 2010

Reassociating a Failed Disk in Veritas

Recently we had a situation wherein Vertias Volume Manager (VxVM)
marked a disk as 'failed' while additionally presenting the disk
available for use though unconfigured.  The weird part was that VxVM
continued to allow use of the volume until the volume was stopped.

21 October 2010

Removing / Recovering an Open File (Solaris)

While working with filesystems, one will inevitably have to deal with a
file that is quickly growing and becoming unmanageable.  Unfortunately,
this situation normally becomes evident because the space of a volume
has been nearly exhausted.  If retention is necessary, you could set up

19 October 2010

Fun with FACLs

Quick, think of a way to give a specific user (jdoe) access to a
particular set of files which are owned by a different user (ivan)
and group (moskau).  Depending of what you are trying to accomplish,
I can immediately think of 7 ways:

Creating a Mirrored Volume with Geom (FreeBSD)

INTRO

While it's not uncommon to find a Solaris host with some sort of RAID
configuration in place, within some environments, RAID configurations

Solaris Devpath Enumeration

The purpose of this doc is show how to physically identify and enumerate
your disk devices on a Sun branded box.  The reasons to do this may
include identifying a disk for replacement, determining the bus it is
attached to, I/O balancing, etc.  Of note, this doc is only valid with Sun

ZFS Pool and FS Creation

Volume and file system management are traditionally separate affairs,
being created and maintained individually of one another.  With Sun's
ZFS, the line between the two become blurred.  As a brief understanding,
a 'zpool' can be generically considered a volume, comprised of multiple

Option 82 Decoding

When looking at DHCP leases, one sometimes may need to be able to
decode the option 82 (op82) string passed to the DHCP server.  In
the examples below, the op82 string is provided as the
'relay-agent-remote-id''.  The value provided, however, isn't

Rebuilding a Solaris Package

Have you ever needed to rebuild a package already installed on a Solaris
host?  Though it may seem to be a rare case, I've had to do this several
times in the past and have yet to find any clear information on it.
A recent instance was where a primary host had a piece of software

Breaking and Syncing a SVM Root Mirror (Solaris)

INTRO

The information detailed below is to assist with proactive planning for
the potential demise and recovery of a host back to the state it was

Breaking and Syncing a Hardware Root Mirror (Solaris)

INTRO

The information detailed below is to assist with proactive planning for
the potential demise and recovery of a host back to the state it was

Solaris HWADDRs from OBP

Occasionally, it's useful to know the hwaddr or MAC addr of an interface
without actually booting a box, such as when you are setting up a
jumpstart config for said box.  On Sun Sparc based machines, this
information can be obtained within the OpenBoot (OB) environment.

Static Routes in Solaris

This tip may seem somewhat trivial as we all know that to retain static
routes in Solaris, you simply create an init script such as the following:

        adler [0] ls -l /etc/rc2.d/S76route

IPMP and 802.1q on Linux

Described herein is the practice of using IPMP (IP MultiPathing) and VLAN
tagged (802.1q trunking) interfaces layered together for the purpose of
port considerations (read: consolidation) and HA (high availability).
The following points should be noted relevant to the host used in the

Process Environments

When working on a host, it is sometimes of value to know the environmental
settings, such as PATH, that a process is currently using.  Fortunately,
there a way of obtaining this information for Solaris, Linux, and FreeBSD.
The following is an example for cron from a Solaris x86 box (though sparc

Recovering from a corrupted ext3 journal

Occasionally, an EXT3 volume's journal will become corrupted.  When
this occurs, Linux will proactively remount the volume in question as
read-only in attempt to stave off further data corruption, loss, etc.
When the volume is remounted r/o, lines similar to the following can be

Package Builds in Linux

This document details how to create a package on Linux.  Only the creation
of a simple package is detailed in this doc.  For more elaborate packages,
see the relevant man pages.

Package Builds in FreeBSD

This document details how to create a package on FreeBSD.  Only the
creation of a simple package is detailed in this doc.  For more elaborate
packages, see the relevant man pages.

18 October 2010

Package Builds in Solaris

This document details how to create a package on Solaris.  Only the
creation of a simple package is detailed in this doc.  For more elaborate
packages, see the relevant man pages.

Network Ports and Processes

Looking at a host, there are times when it may be indeterminable
what process may be holding a particular port open.  Perhaps because
there is no entry for the port in /etc/services, thus netstat, etc,
will not display a recognizable name.  The reason may be that the port

Strange Filenames

Inevitably, while working on a server, one will come across a file with a
strange name that seemingly cannot be easily operated upon.  Some examples
of commonplace files tend to be "!" and "@", wherein the "strange" file
was created while working perhaps in vi.  Other examples may be "--", "*",

Simple Pattern Replacements

Managing data within a file sometimes requires that all instances of a
specific word / phrase be replaced with that of another.  This could be
something along the lines of a file from one host is copied to another,
thus the hostname contained in the file must be updated to reflect the

Solaris Management Facility

With the advent of Solaris 10, Sun introduced a new mechanism to manage
the running of services, the services management facility (smf(5)).
This is important to note as it impacts the startup of services
traditionally handled via the various rcX.d directories.  In short, while

Package File Ownership

Once a system is built and begins to be used, undoubtedly, more files
are added to the system.  These files may be logs, user / application
created files, files that are part of a package, or those compiled
from source.  When poking around a system, one may stumble across a file

File Times

Occasionally it may be necessary to determine the various times of a file.
These times break down to access (when the file was last accessed),
modification (time of last modification), and inode (time of last
modification of the inode (mode / permission changes, etc.).  FreeBSD,

Epoch Time

Have you ever needed a way to determine UNIX (Epoch) Time, or perhaps its
counterpart in 24 hour format?

via perl:

Disk Cloning in FreeBSD

Disk Cloning in FreeBSD:

A few assumptions:
        master disk:  da0

Base Conversions

Every now and then, it may be necessary to do base conversions on numbers.
While some may be readily able to read 0x17 in hexadecimal as 23 in
decimal as 10111 in binary as 27 in octal, there are those who may not.
A simple example of how this information may be of use would be in

Determining Partition Tables

This tip deals somewhat with Solaris, though moreso with FreeBSD.
On a Solaris host, to quickly determine how a hard disk may be carved up,
one can simply run prtvtoc against the device:

Disk Cloning in Solaris

Disk Cloning in Solaris:

A few assumptions:
        master disk:  c0t0d0

17 October 2010

VLAN Tagged Interfaces (FreeBSD)

In order to make use of VLAN tagged interfaces in FreeBSD, kernel support
must be added, thus requiring a rebuild of the kernel.  Also, you must
have an interface capable of handling VLAN tagging (can be determined
by the man page of the interface driver, ex: man bge).  Kernel support

VLAN Tagged Interfaces (Solaris)

In order to use VLAN tagged interfaces in Solaris, one simply needs to
have an interface capable of handling VLAN tagging (can be determined by
the man page of the interface driver, ex: man bge, as well as man dladm).
Providing an interface supportive of VLAN tagging, one may configure the

For what purpose?

As a UNIX engineer for the past 10 years, I've asked more than a few
questions along the way.  If I couldn't find someone with an answer, I'd
scrounge around trying to dig up an answer online or available docs. 
At the same time, I'd work by trial and error attempting to resolve my