ZFS Corruption Persists in Unlinked Files

This article explains how zfs errors can sometimes persist even after the files containing the offending blocks have been deleted, and presents an easy way of removing corruption.

Most solaris sysadmins will be familiar with the following situation. A zpool gives errors about failed checksums and enters a degraded state: Continue reading

Simple Locking Wrapper for VI

This post presents a quick way to add file locking to the vi editor.

The vi editor is found on pretty much every unix system, which means it is often used by system administrators to update configuration files. Unfortunately vi does not lock the file being edited. This can lead to two or more people inadvertently editing the same file at the same time. Edits can become duplicated, confused or lost entirely, perhaps leaving the file in a non-working state.

Editing Critical Files

It is bad enough in the case of small files such as yum.conf or ntp.conf. More serious are files like /etc/fstab, where a simple syntax error could lead to an unbootable system. Worst of all are network-wide resources like DNS zone files. A mistake here could mess up more than one machine. Continue reading

HP-UX fasdm fails with vx_nospace

HP-UX file systems can be extended with a combination of the lvextend and fsadm commands. It’s well known procedure that has been in widespread use for several years, allowing online file system extensions, ie. the file system can be extended while it is mounted and busy. The file system type must be of type “vxfs” and enclosed in an LVM logical volume.

Occasional difficulties can occur if the file system is 100% full. I recently encountered the following vx_nospace error when trying to extend a file system from 9 Gb to 59 Gb under HP-UX 11.31. Continue reading

Root Password Recovery on a Sparc LDOM

If the root password for a Unix system is lost or forgotten, it can be very difficult to regain root access and perform further administration work. Often it will be impossible. You could be lucky – there might be a user account with sudo access, or even a root shell still open on the system somewhere, for example on the system console. If the system is x86, you might be able to boot it from a live CD and restore root access by doctoring the root disk. Otherwise, with most systems (physical and virtual), it will often be a case of rebuilding the system from scratch.

Solaris is a bit different. It has long been possible with Solaris to regain root access by booting the physical system from a Solaris installation CD, mounting the original root disk and removing the root password string from the relevant file, usually /etc/shadow. The same technique works, surprisingly, with SPARC virtual systems, aka LDOMs. Proceed as follows. Continue reading

Fast Installation of AIX on to IBM LPARs

An LPAR, or logical partition, is an IBM virtual machine. LPARs run on a variety of IMB hardware and provide strong isolation between partitions. This article describes a method for quickly building LPARs running AIX on IBM pSeries hardware

AIX can be installed onto an LAPR using the distribution CDs (or rather, since this is a virtual machine, the ISO image files derived from those physical CDs). There are, however, two drawbacks with this:

  • it does not include site specific customizations. If a piece of software like Apache or ssh is required on the LPAR, it must be installed separately – a pain if you have many LPARs to build.
  • it is a slow process. AIX is supplied spread over several CDs. The administrator must swap CDs several times during the installation. This means hanging around and typing commands needed to mount and dismount the cd ISO images on the target LPAR, something that will have to be done several times during the installation.

Continue reading

Solaris Disk EFI Headers

“format” is the Solaris tool used to initialize disks. Format can sometimes have a problem with disks that bear an EFI disk label. In which case, replacing the EFI label with a more traditional VTOC disk label can help.

The problem appears when an attempt is made to label the disk using format. The label operation fails with “Current disk is unformatted”. Many other format options fail with the same message. Newfs will not recognise the disk and it is therefore impossible to create a file system. Continue reading

HPVM Mass Production with hpvmclone

This post is about cloning HP-UX virtual machines, or HPVMs.

Once you have built an HPVM, the hpvmclone command can be used to produce many more.  hpvmclone does not create a copy of the HPVM, it just creates a copy of the configuration.  The data copy is done manually, for example with the dd command.

Basic HPVM Cloning

The following procedure is a simplified version of that found on Juanma’s Blog, in the section “Method 1”. Continue reading

Copying Directories with SSH

Copying data is something every administrator does.  A single file or directory file can be copied with a single command.  Moving information from one system to another needs a bit more work, but it needn’t be a pain.

The ssh command can be used to copy data from one Unix system to another.    Here is an example for HP-UX, but it works on Linux too.  A directory, called /var/opt/ignite, is copied from the system “pluto” to another machine called “jupiter”. Continue reading