Thursday, February 23, 2006

My RAID goes poo-poo :-(

So, I lost about 2 TB (2 Terrabytes, for the uninformed) yesterday. Waaaaa!

I am so freakin not happy. I won't go into what I lost, but you can
use your imagination and figure it out.


I was using RAID in Mac OSX (Panther 10.4.x). Yes, I know better.
Software RAID is not the best solution, but hey, I was trying to be

I was adding a drive to the RAID and, as it turns out, the drive I was
adding was bad. Ack! Not only did it not work, but it also blew away
the device map for the RAID layout, thus, now I can't get to the data
that is on the existing layout.

I discovered the diskutil command (man diskutil) and disktool. No joy.
Too far gone.

So alas, I will be rebuiling my RAID in the next few days and
re-populating my "ahem, content". So many off-site beta copies are
gone :-P Guess I need to get to installing my DLT bot and configure
Netbackup, heh.


Mac OS X Hacking Tools

Usefull OS X commands and stuff:

Mac OS X Hacking Tools

What is Mac OS X?

Mac OS X Hacking Tools

Hacking? Tool?

The Jargon File is a popular lexicographic resource amongst hackers (and non-hackers too). Although it might have some subjective definitions I may not agree with, I have conveniently quoted verbatim the definitions of the terms "hacker" and "tool" as a preface to the contents of this page.


[originally, someone who makes furniture with an axe]

1. A person who enjoys exploring the details of programmable systems and how to stretch their capabilities, as opposed to most users, who prefer to learn only the minimum necessary. RFC1392, the Internet Users' Glossary, usefully amplifies this as: A person who delights in having an intimate understanding of the internal workings of a system, computers and computer networks in particular.


1. n.A program used primarily to create, manipulate, modify, or analyze other programs, such as a compiler or an editor or a cross-referencing program. Oppose app, operating system; see also toolchain.



It is eminently debatable whether one (that means me, you or whosoever else) is a "hacker", but such a debate would probably be fruitless anyway, even meaningless. I do enjoy exploring the details of all sorts of things, including operating systems. This page is a compendium of some programs you might come across while tinkering with Mac OS X. Documentation for most of these tools exists, therefore my aim is not to reproduce documentation, but simply to maintain a cache of relevant information. I believe this would be useful to those who are new to Mac OS X, but are interested in exploring the system at a low(er) level. Note that many of the tools listed here are ones that are either new to Mac OS X (as compared to Unix style systems), or are different from their Unix counterparts. In other words, I have avoided listing "standard" Unix/BSD tools. Moreover, do realize that some (like dynamic_pager and various daemons) are not really tools.

The following list has not been fully updated for Panther (10.3.x).



/usr/sbin/KernelEventAgent handles one of the core system services (events such as file systems being mounted and unmounted, low disk space, network connections going down, etc.)


/sbin/SystemStarter is run during system initialization to handle "startup items". See "Mac OS X System Startup" for details.


/usr/sbin/aexml forwards XMLRPC and SOAP requests to the AppleEvent manager for further dispatching. More documentation is available on the Apple Developer Web Site.


/usr/bin/appleping exercises the AppleTalk network by sending packets to a named host.


/usr/sbin/ardbgd is the daemon for the Apple Remote Debugging Service.


/usr/sbin/asr (Apple Software Restore) efficiently copies disk images and volumes, and can also accurately clone volumes.


/usr/sbin/bless is used to set volume bootability characteristics for Macintoshes. The command can be used to select a folder on a mounted volume to act as the blessed system folder, and optionally update Open Firmware to boot from that volume. It can also be used to format and setup a volume for the first time. Finally, it can be used to query the folder(s) that are blessed on a volume. Try the following (non-destructive) commands:

% sudo bless -verbose -info / ... % sudo bless -verbose -plist -info /


/usr/sbin/blued is the Bluetooth daemon.


/usr/sbin/cac_* are scripts related to CAC (Common Access Card) support. A CAC can be thought of as a SmartCard that combines multiple cards (functions) into one. A CAC can enable physical access to buildings and controlled places, enable computer network and system access and serve as the primary platform for the PKI token.


/usr/bin/cmpdylib compares two dynamic shared libraries for compatibility.


/usr/sbin/createhomedir creates and populates local home directories.


ddb is a debugging mechanism that can be compiled into Mac OS X, similar to BSD's kdb. While gdb can be used over Ethernet (through a kernel stub), ddb is compiled into the kernel and is used over a serial line. Most importantly, ddb requires an actual built-in hardware serial line on the debug target. Fortunately, gdb should suffice for almost all debugging needs unless one is trying to debug an Ethernet driver itself, say.

ddb is not present by default on Mac OS X. It must be compiled from source (xnu/osfmk/ddb in the CVS tree).


/usr/bin/defaults is used to access (read, write and delete) Mac OS X user defaults from the command line. For example, the following will print out Desktop background settings (including the pathname for the desktop background image, if any):

% defaults read Background


/usr/sbin/dev_mkdb creates a hash access method database (based on Berkeley DB) in /var/run/dev.db. This database contains the name of all devices under /dev.


/usr/sbin/diskarbitrationd is a daemon that listens for connections from clients, notifies clients of the appearance of disks and filesystems, and governs the mounting of filesystems and claiming of disks amongst clients.


/usr/sbin/disktool is a command line utility for disk arbitration. It can be used to rename, eject, mount or unmount disks and volumes.


/usr/sbin/diskutil is a utility for managing disks and volumes. It can be used to perform operations such as enabling/disabling HFS+ journaling, verifying and repairing permissions, erasing disks (including optical media), partitioning, creating and managing RAID sets etc. You typically need root access to use this utility.


/usr/bin/ditto copies files and directories to a destination directory. ditto can be used to "thin" "fat" (multiple-architecture) exectuables. It can also copy files selectively based on the contents of a BOM ("Bill of Materials"). One of the most useful features of ditto is that it can preserve resource fork and HFS meta-data information when copying files.


/usr/bin/drutil is a command line tool that uses the DiscRecording framework to interact with attached CD/DVD burning devices.


/usr/bin/dscl is the Directory Service command line utility.


/usr/bin/dsperfmonitor is a directory tool for testing plugin performance in Directory Services.


/sbin/dynamic_pager is started during system initialization to manage swap files. See Mac OS X System Startup for details.


/usr/sbin/fdisk displays or changes the DOS partition table found in the bootsector of x86 bootable disks.


/usr/bin/fixPrecomp is a tool for "fixing" precompiled header warnings that occur when headers get out-of-sync with their precompiled versions - after a system update, say.


/usr/bin/fixproc is a Perl script that "fixes" a named process by performing the specified action (which can be check, kill, restart, exist or fix).


/usr/bin/fs_usage presents an ongoing display of system call usage information pertaining to file system activity. By default this includes all system processes except the running fs_usage process, Terminal, telnetd, sshd, rlogind, tcsh, csh and sh.


/usr/bin/fstat identifies open files (including sockets).


/usr/bin/heap lists all the malloc-allocated buffers in the specified process's heap.


/usr/bin/hdiutil uses the DiskImages framework to manipulate disk image files.


/usr/sbin/hlfsd is the home-link file system daemon. It implements a file system containing a symbolic link to a subdirectory within a user's home directory, depending on the user which accessed that link.


/usr/sbin/installer is the Mac OS X system software and package installer tool.


/usr/bin/install_name_tool changes the dynamic shared library install names recorded in a Mach-O binary.


/usr/sbin/ioalloccount displays some accounting of memory allocated by IOKit allocators, including object instances, in the kernel. This is useful for tracking memory leaks.


/usr/sbin/ioclasscount displays the instance count, offset by the number of direct subclasses that have at least one instance allocated, for the classes specified. This is useful for tracking leaks.


/usr/sbin/ioreg displays the IOKit registry. Try ioreg -l, for example, and you can see detailed registry information (including object properties) - such as details of various temperature sensors in the system (on the I2C bus).


/usr/sbin/iostat displays kernel I/O statistics on terminal, disk and cpu operations.


/usr/sbin/ipconfig can be used to get the number of network interfaces active (the ifcount argument), and also to retrieve various options associated with these interfaces. For example, "ipconfig getoption en1 lease_time" prints the DHCP lease time of en1 if applicable. Finally, ipconfig can also be used to set an interface for BOOTP, DHCP etc.


/usr/bin/kdump displays the kernel trace files produced with ktrace in human readable format.


/usr/sbin/kextcache creates or updates kext caches, which are used to speed up kernel extension loading operations and to prepare kexts for inclusion in such media as device ROM.


/sbin/kextload can be used to explicitly load kernel extensions, validate them to see that they can be loaded by other mechanisms, such as kextd, and to generate symbol files for debugging the kext in a running kernel.


/usr/sbin/kextstat displays the status of any kernel extensions currently loaded in the kernel.


/sbin/kextunload is used to terminate and unregister IOKit objects associated with a kernel extension and to unload the code and personalities for that kext.


/usr/sbin/kgmon generates a dump of the operating system's profile buffers for later analysis by gprof.


/usr/bin/ktrace enables kernel trace logging for the specified processes, causing trace data to be logged to a file. Traced kernel operations include system calls, namei translations, signal processing and I/O.


/usr/bin/latency is used for monitoring scheduling and interrupt latency. The tool can also be used to set real time or timeshare scheduling policies.


/usr/bin/ld is the (Mach) object file link editor.


/usr/bin/leaks examines a specified process for malloc-allocated buffers which are not referenced by the program.


/usr/bin/lipo creates or operates on multi-architecture ("fat") files. It can list the architecture types in a fat file, create a single fat file from one or more input files, thin out a single fat file to a specified architecture type, and extract, replace and/or remove architecture types from the input file.


/usr/bin/lockfile can be used to create one or more (conditional) semaphore files, with the provision of waiting for a specified number of seconds and a specified number of retries.


/usr/bin/lsbom interprets the contents of binary bom (bill-of-materials) files. bom is a file system used by the Mac OS X installer to determine which files to install, remove, or upgrade.


/usr/sbin/lsof lists information about files opened by processes.


/usr/bin/lsvfs lists known (currently loaded) virtual file systems.


/usr/sbin/mDNSResponder (Multicast DNS Responder) listens for and responds to DNS-format query packets sent via Multicast to UDP port 5353.


/sbin/mach_init is a daemon that maintains various mappings between service names and the Mach ports that provide access to those services.


/usr/bin/malloc_history inspects a given process and lists the malloc allocations performed by it. It relies on information provided by the standard malloc library when debugging options have been turned on.


/usr/bin/mig (Mach Interface Generator) is used to compile procedural interfaces to Mach's message-based APIs, based on descriptions of those APIs.


/usr/bin/mkbom creates a bom (bill-of-materials) given a directory.


/usr/sbin/mkextunpack extracts the contents of a multikext (mkext) archive.


/usr/sbin/netstat symbolically displays the contents of various network-related data structures.


/usr/sbin/nibindd is a daemon that is responsible for finding, creating and destroying NetInfo servers.


/usr/bin/nibtool is used for printing, verifying and updating nib files.


/usr/bin/nicl is a general-purpose utility for operating on NetInfo databases. Its commands allow one to create, read and manage NetInfo data.


/usr/sbin/nidomain is an interface to nibindd to which it sends all of its requests about the domains served on a given machine. It can also be used to create and destroy NetInfo databases.


/usr/bin/nifind finds a directory in the NetInfo hierarchy.


/usr/bin/nigrep searches for a regular expression in the NetInfo hierarchy.


/usr/bin/niload loads information from standard input into the given NetInfo domain.


/usr/bin/nireport prints tables from the NetInfo hierarchy.


/usr/bin/niutil is used to do arbitrary reads and writes on the given NetInfo domain.


/usr/bin/nmedit is used to change global symbols to local symbols. It differs from strip in that it also changes the symbolic debugging information for the global symbols it changes to static symbols so that the resulting object can still be used with a debugger.


/usr/sbin/notifyd is a daemon that facilitates processes to exchange stateless notification events.


/usr/sbin/nvram allows manipulation of Open Firmware non-volatile RAM variables.


objcopy is part of binutils that you can download, compile and install. This utility copies the contents of an object file to another, using the GNU BFD (Binary File Descriptor) library to access the object files.


objdump is part of binutils. It displays information (including disassembly, if required) about one or more object files.


/usr/bin/open is a command line utility to open a file (or a directory or URL), just as if you had double-clicked the file's icon.


/usr/bin/open-x11 is a wrapper shell script that provides open functionality for X11 applications.


/usr/bin/orbd is the Object Request Broker Daemon. It is a tool to enable clients to transparently locate and invoke persistent objects on servers in the CORBA environment.


/usr/bin/osacompile compiles the given files, or standard input if non are listed, into a single output script.


/usr/bin/osalang prints information about installed OSA (Open Script Architecture) languages.


/usr/bin/osascript executes the given script file, or standard input if none is given. Scripts may be plain text or compiled scripts.


/usr/bin/otool displays specified parts of object files or libraries (similar to ldd on Linux).


/usr/bin/pagestuff displays information about the specified logical pages of a file conforming to the Mach-O executable format.


/bin/pax is a tool for reading, writing, and listing members of an archive file. It is also used to copy directory hierarchies. pax supports various archive formats such as cpio, bcpio, sv4cpio, sv4crc, tar, and ustar.


/usr/bin/pbcopy is used to copy standard input to the pasteboard buffer.


/usr/bin/pbpaste prints the contents of the pasteboard buffer.


/usr/sbin/pcscd is a daemon used to dynamically allocate/deallocate Smart Card reader drivers at runtime and manage connections to the readers. Related utilities include /usr/bin/pcsctest and /usr/bin/pcsctool. These tools are taken from the MUSCLE (Movement for the Use of Smart Cards in a Linux Environment) project, a project to coordinate the development of smart cards and applications under Linux.


/usr/sbin/pdisk is a menu driven program which partitions disks using the standard Apple disk partitioning scheme.


/usr/bin/plutil can be used to check the syntax of property list files, or convert a plist file from one format to another.


/usr/bin/pmset changes and reads power management settings such as idle sleep timing, wake on administrative access, automatic restart on power loss, etc.


/usr/sbin/pstat displays open file entry, swap space utilization, terminal state, and vnode data structures.


/usr/bin/redo_prebinding is used to redo the prebinding of an executable or dynamic library when one of the dependent dynamic library changes. The input file, executable or dynamic library, must have initially been prebound for this program to redo the prebinding.


/usr/bin/say uses the Speech Synthesis manager to convert input text to audible speech and either play it through the sound output device chosen in System Preferences or save it to an AIFF file.


/usr/sbin/screencapture captures the screen (a window selection or a mouse selection) to the clipboard or a file (as PDF).


/usr/sbin/scselect is used to change current network location, or to list defined locations.


/usr/bin/sc_usage displays an ongoing sample of system call and page fault usage statistics for a given process.


/usr/sbin/scutil is a tool to communicate with configd, read and write from/to the configuration data store etc.


/usr/bin/security provides a command line interface to administer Keychains, manipulate keys and certificates, and do most things the Security framework is capable of.


/usr/bin/segedit extracts and/or replaces the named sections from the specified input file and creates an output.


/usr/bin/setregion is the command line utility for setting the DVD drive's "region".


/usr/bin/sips is a command line interface to the Scriptable Image Processing Server. The graphical abilities of Mac OS X are exposed through this image processing service. The SIPS architecture contains tools for performing basic image alterations and support various image formats. The goal is to provide quick, convenient, desktop automation of common image processing operations.


/usr/sbin/slpd is the Service Location Protocol daemon that advertises local services to the network.


/usr/sbin/slp_reg is a tool to register URLs via the Service Location Protocol in order for remote machines to discover locally registered services.


/usr/sbin/softwareupdate is a command line utility to perform software updates under Mac OS X.


/usr/bin/srm securely (by overwriting, renaming, and truncating before unlinking) removes files or directories.


/usr/bin/sw_vers prints the product name (such as Mac OS X), version and build number.


/usr/sbin/sysctl retrieves kernel state and allows processes with appropriate privilege to set kernel state.


/usr/sbin/system_profiler is the command line system profiling utility.


/usr/sbin/tcpdump dumps traffic on a network.


/usr/bin/top displays an ongoing sample of system usage statistics (such as cpu utilization, memory usage etc. for each process).


/usr/sbin/trpt interrogates the buffer of TCP trace records created when a socket is marked for debugging (via setsockopt()) and prints a readable description of these records.


/usr/bin/update_prebinding tries to synchronize prebinding information for libraries and executables when new files are added to a system. Prebinding information is pre-calculated address information for libraries used by a given executable or library. By pre-determining where a function in another library is destined to be placed, the dynamic linker does not have to resolve symbols at application startup time.


/usr/bin/vm_stat displays Mach virtual memory statistics.


/usr/bin/vmmap displays the virtual memory regions allocated in a specified process, indicating how memory is being used, and what the purposes of memory at a given address might be.


/usr/sbin/vpnd is the Mac OS X VPN service daemon.


/usr/bin/xcode* are Xcode related commands.


/usr/bin/xxd creates a hex dump of a given file or standard input. It can also convert a hex dump back to its original binary form.

Tuesday, February 14, 2006

More Veritas stuff

Volume operations

Make a volume

Vxassist -U fsgen -g <group> make <volumename> <size> layout=(raid5,stripe,nolog) [disk disk disk]

Remove a volume/plex/disk

Vxedit -rf -rm <device>

Make a volume with a mirror

Vxassist -g rootdg make vol01 100m layout=nostripe, log nmirror=2

Start a volume

Vxvol init clean <volumename>

Start all volumes in a disk group

Vxrecover -g <group> -sb

Make a mirror

Vxassist -g <group> mirror <volumename>

Add a drl

Vxassist -g <group> addlog <volumename>

Grow a volume to maximum size

Vxassist -g <group> maxgrow <volume> [disk disk disk]

States and fixes


Vxvol (-f) start <volume>


Vxvol (-f) start <volume>


Vxmend fix empty <plex>


Vxplex -f -o rm dis <log plex>

vxassist -g <dg> addlog <volume>

vxvol -g <dg> start <volume>


Detach a plex

Vxplex det <plexname>

Disassociate a plex

Vxplex dis <plexname>

States and fixes


Vxplex (-f) att <volume> <plex>


Vxmend fix clean <plex>

vxmend fix active <plex>

vxplex (-f) att vol <plex>

vxvol (-f) start


Vxmend fix empty <plex>

vxmend fix clean <plex>

vxmend fix active <plex>

vxplex (-f) att vol <plex>



Vxvol -f start <vol>


Vxplex dis <plex>

vxplex (-f) att vol <plex>


Ps -ef | grep vplex (it should be fixing itself, if not)

vxplex dis <plex>

vxplex (-f) att vol <plex>


Ps -ef | grep vxplex

vxplex dis <plex>

vxplex (-f) att vol <plex>



Ps -ef | grep vxplex (should be fixing itself)


Vxvol -f start <vol> (if this doesn't work than the plex is invalid, probably due to size)


(for logging plexes)

vxplex dis <logplex>

vxedit -rm rm <logplex>

vxassist -g <dg> addlog <vol> <disk>

Disk operations

Add a disk to vxvm

Vxdisk add c?t?d? C?t?d?

Display disk info

Vxdisk list <disk>

Rename a disk/vol/plex

Vxedit rename <oldname> <newname>

Activate a hot spare

Vxedit set spare=on <diskname>

Evacuate a disk

Vxevac -g <group> <diskname> <newdiskname>

Remove the disk from it's disk group

Vxdg -g <group> rmdisk <diskname>

Add a disk to a disk group

Creat group and add disk

Vxdg -g <group> adddisk <diskname>=c?t?d?

Vxdg init <newgroup> <diskname>=c?t?d?

Remove a disk from vxvm control

Vxdisk rm c?t?d?

Unset failing subdisk flag

Vxedig -g <group> set failing=off <subdisk>

Disk group Operations

Maxsize available

Vxassist -g <group> maxsize layout=<raid5>, <stripe>,<nolog>

Import a diskgroup

Vxdg import <group>

vxdg -C import <group> (clears locks)

vxdg -C -n <newdgname> import <dgid> (creates a new diskgroup from an oldone, forces new dg name>

Deport a diskgroup

Vxdg deport <group>

Rebuid a diskgroup

Vxprivutil dumpconfig /dev/rdsk/c?t?d?s2 > /tmp/vxconfig

cat /tmp/vxconfig | vxprint -hmvps -D - > /tmp/new.vxconfig

vxmake -g <dg> -d /tmp/new.vxconfig

Created by Aaron M. Hirsch

Saturday, February 11, 2006

Veritas VM Stuff

Veritas VM Basic Setup Tasks

It is assumed that the Veritas software has been installed and that
rootdg has been setup by the installer with a minimum of one disk. If
not, install the software now.

Use the "format" command to display available disks. If necessary,
add new disks to the system and run "drvconfig; devlinks; disks" to
configure the new disks. Do not partition disks to be used by Veritas.

To display disks setup for Veritas, use the command "vxdisk list".

To add more disks to the control of Veritas, use the following command:

The would be c2t0d0, for example, without the slice suffix. The
vxdiskadd script will prompt for necessary information such as the
name of the disk group, whether or not to initialize the new disk,
etc. Rerun the command "vxdisk list" to view the new disk.

To designate an unused disk as a hot-spare disk, use the following command:
vxedit set spare=on

The would be the Veritas name for the disk, such as disk01. Use
"vxdisk list" to confirm that the disk is now a dedicated hot-spare
disk. To remove the disk from the dedicated hot-spare pool, use the
following command:
vxedit set spare=off

By default, Veritas will name disks based on the name of the disk
group. To rename a disk (for example, from disk01 to disk02), use the
following command:
vxedit rename

To place a disk offline (for example, if the disk has become
corrupted), run the following command:
vxdisk offline

The would be c2t0d0, for example, without the slice suffix.

To remove a disk from the diskgroup to which it belongs, run the
following command:
vxdg [-g diskgroup name] rmdisk

To then remove that disk from Veritas control entirely, run the
following command:
vxdisk rm

The same set of commands may be used to move disks from one
diskgroup to another:
vxdg rmdisk
vxdg -g adddisk =

(For example, "vxdg -g testdg adddisk testdg01=c2t0d0".)

Alternatively, you can simply remove the disk from Veritas control
and then reinitialize it with "vxdiskadd". Use "vxdisk list" to
confirm the new affiliation.

Every disk group requires a minimum of one disk. The simplest way to
add a new diskgroup is to run the "vxdiskadd" command on an
unconfigured disk, and when prompted for the name of the diskgroup to
use, enter the desired name of the new diskgroup.

To display information on disk groups, run "vxdg list" or "vxdg list".

To destroy a diskgroup and reuse the disks for other purposes, run
the following command:
vxdg destroy

Failing or failed disks can be removed with the "vxdiskadm" menu
command. To remove a failing disk, select choice 4, "remove a disk for
replacement". To replace the disk later, select choice 5, "replace a
failed or removed disk".

Volume Tips and Tasks
The basic command used to create volumes is "vxassist". The format
is "vxassist make". The length can be specified in units of kilobytes,
megabytes, or gigabytes with the suffixes k, m, or g. By default, new
volumes are created from rootdg. Use "-g" to specify a different

To determine the maximum size that a new volume could be given
particular attributes, use the "vxassist maxsize" command. For
example, to determine the maximum size of a striped volume using
disk01 and disk02:
vxassist maxsize layout=stripe disk01 disk02

Then create the volume using that length. For example: vxassist
make vol01 20g layout=stripe disk01 disk02

By default, the "vxassist" command creates concatenated volumes. For
example, the command "vxassist make newvol 10m" would create a
concatenated volume with the length of 10 MB. To specify the disk(s)
to use, add the disk name(s). For example, "vxassist make newvol 10m

To create striped volumes, add the attribute "layout=stripe". For
exampke, "vxassist make newvol 10g layout=stripe disk01 disk02".

To create RAID-5 volumes, add the attribute "layout=raid5". For
example, "vxassist make newvol 30g layout=raid5".

To create mirrored volumes, add the attribute "layout=mirror". For
example, "vxassist make newvol 10g layout=mirror".

The "vxassist" command can be used to grow or shrink the size of
volumes. Do not shrink the size of volumes below the size of the
filesystem. To grow volumes, run one of the following commands:
vxassist growto
vxassist growby

Similarly, you can shrink the size of volumes:
vxassist shrinkto
vxassist shrinkby

To remove an unneeded volume, unmount any filesystems on the
volume, remove any references to the volume from /etc/vfstab, stop the
volume with "vxvol stop", and then run "vxedit -rf rm" or "vxassist
remove volume".

Existing volumes can be mirrored to add redundancy. To mirror
existing volumes, use the following command:
vxassist mirror

To remove a mirror (more precisely, to remove one of the plexes from
the volume), use the following command:
vxplex -o rm

To stop volumes, use the command "vxvol stop". To stop all volumes,
run the command "vxvol stopall". To restart volumes, use the command
"vxrecover -s" or use the command Veritas will automatically allocate
the necessary space from unused disks. The process may take some time
depending on the size of the volume. When fully synchronized, the
status of the snapshot mirror will change to SNAPDONE. Use the
following command to monitor the progress of the snapshot:
vxtask -l list

2. Detach the snapshot and create the new read-only snapshot volume
with the following command:
vxassist snapshot

The period required to create the snapshot volume is shorter but
it is preferred to limit I/O to the volume during the period required.

3. Clean the contents of the new snapshot volume with the following command:
fsck -y /dev/vx/rdsk/

4. Mount the snapshot volume, perform the backup, unmount the
volume, and then remove the snapshot volume to save space with the
following command: vxedit -rf rm

Disk Group Tips
Diskgroups can be moved from one system to another system. On the
original system, unmount any volumes in the disk group to be deported
and stop them with the command "vxvol stop". Then deport the disk
group with the command "vxdg deport".

Move the disks physically to the new system and either reboot the
system so that Veritas recognizes the new disks, or use the command
"vxdctl enable" to restart vxconfigd.

Import the disks with the command "vxdg import". Then restart all
volumes in the disk group with the command "vxrecover -g -sb".

To rename diskgroups during deport/import, run the deport/import
command with the argument "-n ". After importing the diskgroup, run
the command "vxprint -hrt". The volumes that belong to the imported
disk group may be DISABLED. Run the command "vxinfo "volume name" to
be sure that the volumes are "startable". Then run "vxrecover -s" to
enable each volume. If the disks in question have been moved due to
the crash of the original system, then they will not have been
properly deported and will be locked. To unlock the disks, run the
command "vxdisk clearimport" or "vxdg -C import". Be sure not to run
these commands if the original system has physical access to the disks
since that would allow access to the disks from multiple hosts and
possibly cause data corruption.

How To: Mirror Removal
To remove a mirror from a volume (i.e., to remove one of the plexes
that belongs to the volume), run the following command:
vxplex -o rm dis

Any associated subdisks will then become available for other uses.
To remove the disk from Volume Manager control entirely, run the
following command:
vxdisk rm For example, "vxdisk rm c1t1d0s2".

How To: Volume Deletion
To remove a volume, unmount any filesystems on the volume and run
the following command: vxassist remove volume

How To: Mirror Backup
The following techniques can be used to backup mirrored volumes by
temporarily taking one of the mirrors offline and then reattaching the
mirror to the volume once the backup has been run.

1. Disassociate one of the mirrors from the volume to be backed up:
vxplex dis

2. Create a new, temporary volume using the disassociated plex:
vxmake -g -U gen vol tempvol plex=

3. Start the new volume:
vxvol start tempvol

4. Clean the new volume before mounting:
fsck -y /dev/vx/rdsk//tempvol

5. Mount the new volume and perform the backup

6. Unmount the new volume

7. Stop the new volume:
vxvol stop tempvol

8. Disassociate the plex from the new volume:
vxplex dis

9. Reattach the plex to the original volume:
vxplex att

10. Delete the temporary volume:
vxedit rm tempvol

To display the current Veritas configuration, use the following command:

To monitor the progress of tasks, use the following command:
vxtask -l list

To display information related to plexes, run the following
command: vxprint -lp

How To: Deport/Import
Disk groups can be moved from one system to another with the
deport/import commands. The same technique can be used to rename a
disk group by deporting the disk group with a new name.

1. Unmount any filesystems on the disk group

2. Stop any volumes on the disk group:
vxvol stop

3. Deport the disk group:
vxdg deport

4. Import the disk group:
vxdg import

5. Restart and resynchronize the disk group:
vxrecover -g -sb

6. Remount any filesystems from the disk group

If you have any problems, check the status of volumes on the disk group:

To rename the disk group during deport/import, use the -n argument:
vxdg deport -n


Soltice DiskSuite:

Solstice Disksuite is a free RAID volume manager from Sun Microsystems.
This article describes the method of mirroring a boot drive using
Solstice Disksuite via the command line.

Solstice Disksuite comes bundled with the Solaris 8 operating system.
Install Solstice Disksuite 4.2.1 on Solaris 8
Insert 2 of 2 software for Solaris 8

# CD /cdrom/sol_8_1000_sparc_2/Solaris_8/EA/products/DiskSuite_4.2.1/sparc/Packages

I usually install all the packages even though I do not use the GUI.

# pkgadd -d .

The following packages are available:
1 SUNWlvma Solaris Volume Management API's
(sparc) 1.0,REV=2001.
2 SUNWlvmg Solaris Volume Management Application
(sparc) 1.0,REV=2001.

3 SUNWlvmr Solaris Volume Management (root)
(sparc) 1.0,REV=2001.
4 SUNWmdg Solstice DiskSuite Tool
(sparc) 4.2.1,REV=1999.
5 SUNWmdja Solstice DiskSuite Japanese localization

(sparc) 4.2.1,REV=1999.
6 SUNWmdnr Solstice DiskSuite Log Daemon Configuration Files
(sparc) 4.2.1,REV=1999.
7 SUNWmdnu Solstice DiskSuite Log Daemon

(sparc) 4.2.1,REV=1999.
8 SUNWmdr Solstice DiskSuite Drivers
(sparc) 4.2.1,REV=1999.
9 SUNWmdu Solstice DiskSuite Commands
10 SUNWmdx Solstice DiskSuite Drivers(64-bit)
(sparc) 4.2.1,REV=1999.

Select package(s) you wish to process (or 'all' to process all
packages). (default: all) [?,??,q]: all

Reboot the server after the successful installation.

# init 6

Prepare the drives for SDS

SDS uses metadevice state databases to store information on disk
about the state of your DiskSuite configuration. The metadevice state
database records and tracks changes made to your configuration. These
databases must reside on a dedicated slice(in the case of a boot
drive). I typically leave about 10MB of unused space on the boot drive
when installing Solaris for these databases.

Disksuite has the following rules with respect to the use of
database replicas:

The system will not boot unless more than half of the replicas are
available The system will panic if more than half of the replicas are

If one of your drives fail, and the system is rebooted for any reason
it will not automatically boot in a two disk mirror configuration. You
can disable the feature by setting the following system parameter:

# echo "set md:mirrored_root_flag=1" >> /etc/system

The output from format of my boot disk looks like the following.
Total disk cylinders available: 24620 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 root wm 0 - 283 400.62MB
(284/0/0) 820476
1 var wm 284 - 1701 1.95GB (1418/0/0) 4096602
2 backup wm 0 - 24619 33.92GB (24620/0/0) 71127180
3 swap wu 1702 - 3136
1.98GB (1435/0/0) 4145715
4 unassigned wm 3137 - 3144 11.29MB (8/0/0) 23112
5 unassigned wm 3145 - 5271 2.93GB (2127/0/0) 6144903
6 usr wm 5272 - 11652
8.79GB (6381/0/0) 18434709
7 home wm 11653 - 24619 17.86GB (12967/0/0) 37461663

The partition table of the mirrored drive should be identical to
the boot drive. Copy the partition table of the boot drive to its

# prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2

fmthard: New volume table of contents now in place

In this case c0t0d0s2 is the boot drive and c0t1d0s2 is the mirror.

# metadb -a -f -c2 /dev/dsk/c0t0d0s4 /dev/dsk/c0t1d0s4

Create the mirror for / filesystem
# metainit -f d10 1 1 c0t0d0s0
d10: Concat/Stripe is setup
# metainit d20 1 1 c0t1d0s0
d20: Concat/Stripe is setup
# metainit d30 -m d10
d30: Mirror is setup
# metaroot d30

Create the mirror for all other filesystems
/var filesystem:
# metainit -f d11 1 1 c0t0d0s1
# metainit d21 1 1 c0t1d0s1
# metainit d31 -m d11

Swap filesystem:
# metainit -f d13 1 1 c0t0d0s3
# metainit d23 1 1 c0t1d0s3

# metainit d33 -m d13

/opt filesystem:
# metainit -f d15 1 1 c0t0d0s5
# metainit d25 1 1 c0t1d0s5
# metainit d35 -m d15

/usr filesystem:
# metainit -f d16 1 1 c0t0d0s6
# metainit d26 1 1 c0t1d0s6

# metainit d36 -m d16

/export/home filesystem:
# metainit -f d17 1 1 c0t0d0s7
# metainit d27 1 1 c0t1d0s7
# metainit d37 -m d17

Edit the /etc/vfstab to mount the new mirrors on boot.

Before :
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -

fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c0t0d0s3 - - swap - no -
/dev/md/dsk/d30 /dev/md/rdsk/d30 / ufs 1 no -

/dev/dsk/c0t0d0s6 /dev/rdsk/c0t0d0s6 /usr ufs 1
no -
/dev/dsk/c0t0d0s1 /dev/rdsk/c0t0d0s1 /var ufs 1
no -
/dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /export/home ufs
2 yes -

/dev/dsk/c0t0d0s5 /dev/rdsk/c0t0d0s5 /opt ufs 2
yes -
swap - /tmp tmpfs - yes -

After :
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/md/dsk/d33 - - swap - no -

/dev/md/dsk/d30 /dev/md/rdsk/d30 / ufs 1 no -
/dev/md/dsk/d36 /dev/md/rdsk/d36 /usr ufs 1 no -
/dev/md/dsk/d31 /dev/md/rdsk/d31 /var ufs 1 no -

/dev/md/dsk/d37 /dev/md/rdsk/d37 /export/home ufs 2
yes -
/dev/md/dsk/d35 /dev/md/rdsk/d35 /opt ufs 2 yes -
swap - /tmp tmpfs - yes -

Suppress warning messages
# metainit hsp001 Attach the second submirror to the mirror. This
will cause the data from the boot disk to be synchronized with the
mirrored drive.
# metattach d30 d20
# metattach d31 d21
# metattach d33 d23
# metattach d35 d25
# metattach d36 d26
# metattach d37 d27

you will hear alot of disk thrashing at this point and your i/o
will go through the roof.

Use metastat to track progress

# metastat I like to use this one when i'm watching though. it
looks more impressive
# metastat | grep % ...

Enable the mirror disk to be bootable:
# installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t1d0s0
# ls -l /dev/rdsk/c0t1d0s0
lrwxrwxrwx 1 root root 45 Sep 8 11:25
/dev/rdsk/c0t1d0s0 -> ../../devices/pci@1f,4000/scsi@3/sd@1,0:a,raw
This is the device path that you will use to define the alternate
boot device at the hardware level.
ok nvalias mirror /pci@1f,4000/scsi@3/sd@1,0:a,raw Issue a
"show-disks" at the ok prompt to verify the correct path to the disk.
Use "devalias" at the ok prompt to also give clues as to which device
path to use.

In case of primary boot disk failure, boot from the alternate disk

ok boot mirror