Parallels blogs my Solaris/Parallels post

The team over at Parallels noticed my Working with Solaris 10 in Parallels Desktop piece over on Coalface, and had a few nice words to say about me. In particular:

For those of you unfamiliar with Martin, he’s a well respected tech journalist who contributes to a number of leading tech magazines and all-around computer guru. He just wrote up a great blog post about Parallels Destkop for Computerworld, titled “Parallels Lowers the Impact of Boot Camp.”

Read the short, but sweet, full post

System Administrators Toolkit: Migrating and moving UNIX directory trees

As an extension of the original filesystem piece, I’ve taken a closer look at the methods available for simply moving around directory trees on the Unix filesystem, including across a network.

Occasionally, you need to copy around an entire UNIX directory tree, either between areas on the same system or between different systems. There are many different methods of achieving this, but not all preserve the right amount of information or are compatible across different systems. This article discusses the various options available for UNIX and how best to make them work.

The article covers cp, tar, cpio and some basic scp examples. Read System Administrators Toolkit: Migrating and moving UNIX directory trees.

Using bash by default

I much prefer to use bash as my main shell, but in Solaris, you are much better off using the default shell, particularly for root, just in case there is a problem and you cannot mount the /usr directory during a boot.OK, it may not happen often (and in fact, the default install is now to have only one partition for the Solaris OS, one for user files and swap), but I figure it is best to err on the side of caution.The best way to do this is to configure your .profile to exec /usr/bin/bash if it is available, but do nothing otherwise, like this:

if [ -x /usr/bin/bash ]then    exec /usr/bin/bashfi

Using exec means that the Bourne shell (sh) will be replaced by bash, so when you logout, you don’t have to logout from two shells.Obviously you can continue to put whatever you like into the standard .profile according to your needs, while using the .bash* init scripts to do your custom bash operations.

Copying multiple files with scp

I keep my .bash init scripts on one machine and copy them over to each machine on which I have a login. There’s various bits of logic in there to ensure that the right PATH and other values are set according to the host and/or platform. I then have a simple line that updates the .ocal .bash scripts from the main box that holds the main copies, so that I can just run:


To update everything. I use scp and, depending on the system, use a preset key or require a password.For copying multiple files there are many solutions; I could just use .bash*, but I’d also get the history and backup files. The typical advice is separate entries:

scp mc@narcissus:.bashrc mc@narcissus:.bash_aliases

This is less than optimal for a number of reasons – the first is that each location is treated individually, and that requires multiple connections and multiple password requirements. You can, though, use normal shell like expansion, just make sure you use quotes to ensure that it isn’t parsed and expanded by the local shell instead of the remote one:

scp mc@narcissus:".bash{rc,_path,_aliases,_vars}" ~

Getting Solaris 10 working in Parallels

I’ve just been sent the latest version of Solaris 6/06 release) and wanted to get it working in a Parallels virtual machine.Not everything is plain sailing, but with a combination of past experience and a few quick configuration changes you can get it working fine. Basic installationThe key to getting the basic installation working fine is to ensure you choose and set the correct options when configuring the disk device. The Solaris Installer will see the virtual disk, but for some reason wont automatically perform the fdisk partition for you. Once you get to the option that shows the disk drives and default partition, make sure you go through the FDISK configuration and create a single partition. This will give Solaris the block device it needs to then create it’s own partition map. NetworkingOnce booted up, you’ll need to get the networking driver that comes with the Parallels boot disk installed. Attach the vmtools.iso disk (on Mac OS X this is located in /Library/Parallels/Tools); it should automount in Solaris. Navigate through to the network/Solaris directory and run the script to install the driver and configure the IP address, netmask and gateway. You’ll need to reboot. Once rebooted, copy /etc/nsswitch.dns to /etc/nsswitch.conf to enable DNS searches for hosts, and then edit /etc/resolv.conf with your domain name (optional) and nameserver information. For example, mine reads:

domain mcslp.prinameserver

X11 configurationThe default X11 configuration will often work fine for the display and keyboard, but the mouse fails to be configured. You need to configure the mouse to use the /dev/kdmouse device and operate as a PS/2, not USB, mouse. You can do this by hand by editing the /etc/X11/.xorg.conf file, or you can create your own, or you can download this file and copy it into /etc/X11/xorg.conf.If you want to go through the process yourself, first run kdmconfig and set it to use run /usr/X11/bin/xorgconfig – you’ll need to go through each step (which involves setting up the mouse, keyboard and display). Select the PS/2 mouse option and give the driver name. Choose an appropriate keyboard layout (I’m using the 102-key international layout and haven’t had any issues yet. For the display driver, configure a multisync monitor (using huge manual horizontal and vertical refresh values) or using the largest of the options provided, and select VESA as the display adaptor type, setting an appropriate amount of video RAM etc. to get the display depth and size you want. All set!That should be everything – you can see a sample of Solaris 10 running in Parallels below.



Stepped execution with cron and at

I had a query from a reader today as a follow up to my System Administrators Toolkit: Time and event management article at developerWorks:

How do I execute a script at a specific interval, for example 28 days, rather than on a specific day or date?

It is the one limitation of cron that it doesn’t support such an interval, although there are some systems (including many Linux installations) that provide an alternative method. There are some solutions to the problem that will work on any platform that uses the cron/at system.One way is to run the script every 7 days, and have it record how many times it’s been called in a file. All you have to do is, in the script, load the current count, work out if this is the fourth time, and run the script accordingly. For example: count=`cat counter`count=`expr $count + 1`if [ $count -eq 4 ]then echo 0 >counter echo 4th time called, going for it # Do everything elseelse echo $count >counterfiI suggest you put the counter file into a usable location, but you get the idea.The other alternative is to use at, rather than cron, and then add a line in the script to execute the script again in 28 days time. For example, using this line at the end of your script: at 9pm + 28 days <myscript .shBecause you are specifying the same time, but a different day, this will execute at the same time every 28 days. If your script takes a long time to process and you run it, for example, at 23:59, put the ‘at’ line at the start of the script, rather than the end, so that the request gets registered on the same day.

System Administrators Toolkit: Migrating and moving UNIX filesystems

I’ve had more than one occasion when I’ve had to move a live filesystem to a new partition or new disk, whether its because I’m short on space on the original partition or through disk failure. I’ve put put my experience of that into my latest developerWorks article on how to move and migrate filesystems.Read System Administrators Toolkit: Migrating and Moving UNIX filesystems.