ZoneType.sh Version 2.0

We just started supporting Solaris 10 in our VMware cluster so I had to update my zone type script to detect if the OS is running there. I’m not sure how I feel about depending on the output of ptrdiag since the interface is labeled “unstable”, but it works for now, and I really don’t see Sun changing the first line of output where the system configuration is listed. Anyhow, when issued with the -v or –vmware flag, the script returns 0 if it’s running on the cluster and 1 if it is not.

Usage:

# zonetype.sh -g or –global
Return 0: The machine is a global zone with 1 or more local zones
Return 1: The machine is not a global zone

# zonetype.sh -l or –local
Return 0: The machine is a local zone
Return 1: The machine is not a not a local zone

# zonetype.sh -v or –vmware
Return 0: The machine is running on a VMware hypervisor
Return 1: The machine is not running in VMware

#! /bin/bash
#
# When issued with the -g or --global flag, this script will return:
# 0 if the machine is a global zone and has one or more local zones. 
# Otherwise, it will return 1
#
# When issued with the -l or --local flag, this script will return:
# 0 if if is a local zone and 1 if it is not
#
# When issued with the -v or --vmware flag, this script will return:
# 0 if it is a vmware host and 1 if not.
#

list=( `/usr/sbin/zoneadm list -civ | awk '{ print $1 }'`)

  case "$1" in
    -g|--global)
        # If the third element in our array is null, set it to 0
        if [ "${list[2]}" == ""  ]; then
        list[2]=0
        fi
        # This is a global zone only if it has one or more local zones.
        if [ ${list[1]} -eq 0 ] && [ ${list[2]} -ge 1 ]; then
        # 1 is returned if we have a global and local zone, 
        # otherwise, we return 0
                exit 0
            else
                exit 1
        fi
              ;;
    -l|--local)
        # If the second element in our array is = or > 1, it is a local zone.
        if [ ${list[1]} -ge 1 ]; then
        # Return 1 if this is a local zone, otherwise return 0.
                exit 0
            else
                exit 1
        fi

              ;;
   -v|--vmware)
        # Don't run our check on local zones... Prtdiag can't run there
        if [ ${list[1]} != 0 ]; then
                exit 1
           else 
                vmhost=( `/usr/sbin/prtdiag | grep System | awk '{ print $5 }'`)
                if [ $vmhost == VMware ]; then
                        #If the host is running on the vmware cluster return 0, 
                        # otherwise, return 1
                        exit 0
                else
                        exit 1
                fi
        fi
              ;;
        *)
        echo "Usage: /local/adm/zonetype.sh {-l | --local | -g | --global | -v | --vmware}"
        exit 1
  esac

World’s Coolest Datacenter

Ever since coming to work at UC Santa Cruz, I have been feeling pretty lucky to work in a well engineered and managed datacenter. So lucky, in fact, that I’ve been cultivating hatred towards me in my former coworkers by regaling them with stories about how wonderfully designed everything is here. The problem with thinking you have it made though, is that someone will always point out some greener grass in another field.

This is exactly what happened when I saw this article about the Pionen datacenter, owned by Bahnhof in Sweden. Located nearly 100 feet beneath the city of Stockholm, this epic datacenter has been compared (fairly I might add) to the secret layer of a James Bond villian. It’s got backup power provided by twin submarine engines, triple-redundant internet backbone connections, and can reportedly stand up to a Hydrogen bomb. We spend so much time and effort trying to make our servers comfortable when designing datacenters, we often forget about the Human element. Even though these guys are literally working in a cave, it’s nice to see that Bahnhof is trying to make its people comfortable as well.

How to Make Gnarly Big Linux Filesystems

At least in RHEL 4, the fdisk command does not support the creation of filesystems larger than 2TB. In order to get around it, you have to use the parted command. I found the basic info here, but this is the long and short of how to cut off a big ol’ slice of disk using parted:

Run parted

# /sbin/parted

It’s interactive, so the following commands are issued within the utility.

1) Make the disk label

(parted) mklabel gpt

2) Create the partition

(parted) mkpart primary 0 -1

3) Verify

(parted) print


Disk geometry for /dev/sda: 0.000-38146.972 megabytes
Disk label type: msdos
Minor    Start       End     Type      Filesystem  Flags
1          0.031    101.975  primary   ext3        boot
2        101.975  38146.530  primary               lvm

4) Exit the GNU Parted command shell

(parted) quit

5) Finally, make the filesystem:

# mkfs.ext3 -m0 -F /dev/sdb1

6)Finally, you don’t want to wait for that big filesystem to fsck from time to time, so make sure it does not get checked unless you run the command yourself:

# tune2fs -c0 -i0 /dev/sdb1

That should just about do it. Remember that only RHEL 4 and higher can support filesystems larger than 2TB. If I remember correctly RHEL 3 can go up to 2TB, RHEL4 can handle 8TB, and RHEL 5 can make a whopping 16TB chunk of disk. Have fun!

Another Used Sun Fire T2000 For Sale

STATUS: Sold
We have another used Sun Fire T2000 server. Since the first one was sold in less than 24 hours, I thought it would be nice to offer this one up to this site’s readers as well. It has never been used in production and is in like-new condition.

  • Sun Fire T2000 Server
  • 8 core 1.0 Ghz UltraSPARC T1 processor
  • 16GB DDR memory (16 1GB DIMMs)
  • 2X 73GB 10,000PRM disk drives
  • 1X DVD-ROM/CDRW drive
  • Serial Number: 0639VB0053
  • Starting Bid: $13,000

If you are interested, or would like any further information, please leave a comment or visit this link. Our university campus policy states that big ticket items like this must be sold using an auction style bidding system. I should add, however, that most items in the surplus system are sold with only one bid, so please don’t let the process discourage you if you are at all interested.

Used Sun Fire T2000 For Sale

STATUS: Sold
The University where I work is currently selling a used Sun Fire T2000 server. Since many of this site’s readers are fellow Solaris administrators, I thought it would be nice to offer it up to them. It has never been used in production and is in like-new condition.

  • Sun Fire T2000 Server
  • 4 core 1.0 Ghz UltraSPARC T1 processor
  • 8GB DDR memory (16 512MB DIMMs)
  • 2X 73GB 10,000PRM disk drives
  • 1X DVD-ROM/CDRW drive
  • Serial Number: 0617NNN1FY
  • Starting Bid: $6,000

If you are interested, or would like any further information, please leave a comment of visit this link. Our campus policy states that big ticket items like this must be sold using an auction style bidding system. I should add, however, that most items in the surplus system are sold with only one bid, so please don’t let the process discourage you if you are at all interested.

Changing Linux Mount Points

If you’re familiar with UNIX, you know that changing mount points is really pretty easy. All you have to do is go into “/etc/fstab”, “/etc/vfstab” (or whatever your flavor of UNIX happens to call its filesystem table) and change the mount directory.

If, for instance, you had a Solaris box, and you wanted to make the disk currently mounted as “/data” be mounted as “/database”, all you would have to do is the following:

# umount /data
# mv /data /database
Change this line in “/etc/vfstab” from something like this:
/dev/dsk/c1d0s6 /dev/rdsk/c1d0s6 /data ufs 1 yes -
to something like this:
/dev/dsk/c1d0s6 /dev/rdsk/c1d0s6 /database ufs 1 yes -
and remount it as “/database”.
# mount /database

With Linux, however, it’s not quite so clear anymore… It’s still easy, but it’s just not so clear what you have to do since they have now taken to mounting filesystems using the volume label. Rather than pointing directly to the disk device, Linux points to the label, and “/etc/fstab” look more like this:

LABEL=/data /data ext3 defaults 1 2

You can always simply change the disk label, but if you don’t care, you can just tell linux where the raw device is, bypassing the need to worry about the label. The easiest way to do this is simply to replace the “LABEL=/data” value to the “/dev” entry of the disk itself. Then, simply change “/data” to “/database” and you’re all set.

Here is an example of what you would do to change the mountpoint of “/data” to /database”:

# umount /data
# mv /data /database
Change this line in “/etc/fstab” from this:
LABEL=/data /data ext3 defaults 1 2
to this:
/dev/sda6 /database ext3 defaults 1 2
and remount it as /database
# mount /database

Remembering to change the example values here with those required for your situation.

Google Analytics is Cool

So after being frustrated yesterday by not having any pretty Google Analytics reports to look at, they finally crunched up some data for me, and this morning I was able to start kicking the tires.

First assessment… WOW! They generate a report for just about anything you could possibly what to know, including things like what major ISP’s your viewers are coming from. My personal favorite is the Geo Map Overlay which uses Google Maps to show what parts of the world your traffic is originating from. I was really surprised to see how many international visitors found their way here. Maybe it’s because I, like the rest of the world, think our President is an uneducated Neanderthal.

Additionally cool is the idea that Google Analytics is a sucker punch to Microsoft. Hey, I love anything that hurts Microsoft. They don’t suck as much as our President, but they’re sure as hell trying.

Some analysts saw the timing of Google’s latest announcement as significant: It came on the heels of a Microsoft (MSFT) manifesto that Web and ad-subsidized services were the future (see BW Online, 11/10/05, “Microsoft: Ozzie’s Online Charge”). “It’s a bit of a slap of the face to Microsoft, reminding them, ‘We’re in this game,'” says Marc Strohlein, vice-president and lead analyst at Outsell, a market research firm.

For my part, my only complaint is that they don’t update update the data often enough, and they seem to have some gaps in the data they’ve collected. For instance, this morning, they thought I had had 400 visits, when in reality I had 1136 just yesterday according to bstat. They have been up and down because of high load over the past few days though, so the discrepancy is understandable. Apparently they have had a whole lot of people signing up since they went public.

Of course, the data will become much more useful over the long term, so it will be interesting to see how people are using the site, and what they like and don’t like.

Yes Al, I already know you hate the political rants.