Cloning a VMWare Server VM

I recently had a need to make a bunch of clones of a vmware virtual image on my vmware server. After doing a few by hand, I got tired of it and wrote a little script to do it for me. The script assumes that there’s a working set of virtual image files in a directory named “vm-template” and that the virtual machine name defined in the template is also “vm-template.” You can change these values by changing the SOURCE_DIR and SOURCE_NAME variables at the top of the file (or you could modify the script to set these variables using passed arguments). Whatever image you wind up using to do the cloning, you should make sure it isn’t running in order to avoid unpredictable results when doing the copy.

To use the script, just run it, passing the desired new virtual image name as an argument. A directory will be created using that name (so avoid spaces or weird characters; escaping them might also be ok). Files from the image to be cloned will then be copied into the new directory. The SOURCE_NAME value in the source image’s .vmx file will be replaced with the name you pass as an argument, and all files will be renamed to use the argument’s name rather than the SOURCE_DIR name. To clarify: Typically, your source image will live in a directory named (for example) “vm-template” and will be full of files named (for example) “vm-template.vmx,” “vm-template.vmdk,” etc. The script renames any such matching files to use the argument passed, and it changes references to those names within the .vmx file to point to the renamed file.

If your source image is large, it could take a few minutes to copy the files. The rest of the process goes quickly. Once you’re done, if you’re using vmware server, you’ll want to pick the option to add a new machine to the inventory. Then browse to the new file. When you boot it up, you should see (I’m using the web console here) a warning asking you whether you copied or moved the image. This is because we didn’t do anything to change the guid that identifies the image. Tell vmware server that you copied it, and it should make any necessary adjustments and boot your image.

Once it’s booted, you’ll need to make adjustments such as changing the hostname and applying any patches or updates that may have landed since you created the source image.

The script I used follows.

#!/bin/bash

SOURCE_DIR="vm-template"
SOURCE_NAME="vm-template"

DEST_NAME=$1

if [ -z $DEST_NAME ]; then
    echo
    echo "Please specify a VM name as the sole argument"
    echo
    exit 1
fi

if [ -e $DEST_NAME ]; then
    echo
    echo "$DEST_NAME already exists. Please specify another."
    echo
    exit 2
fi

echo

mkdir $DEST_NAME
echo "Copying source files to $DEST_NAME directory"
echo
cp -R $SOURCE_DIR/* $DEST_NAME/

cd $DEST_NAME
for file in `ls |grep $SOURCE_NAME`; do
    new=`echo $file | sed 's/'$SOURCE_NAME'/'$DEST_NAME'/'`
    mv $file $new
done

perl -pi -e 's/'$SOURCE_NAME'/'$DEST_NAME'/g' *.vmx
rm -rf *.lck

Happy B.C. Day

It turns out that I’m in Victoria, British Columbia for work this week. When I planned the trip (at the last minute), I didn’t know that Monday was a Canadian holiday. As one of my American coworkers is here as well, it’s really not that big a deal; we’ll work in peace without all the usual water cooler chatter about moose and that most riveting sport curling (ok, so hockey is probably the more obvious sport choice, but curling dominated the TV when I was last in town).

I learned today that B.C. Day isn’t just a laze-around-the-house holiday but is one that Victoria, at least, does up right. Tonight, the symphony was playing from a barge in the harbor, and tomorrow, Vancouver resident (or native?) Sarah Machlachlan is the headliner for a free concert. I was tired this evening (still on Eastern time) but had thought about walking down to the harbor to hear the symphony. When I read online that they traditionally play the 1812 Overture as part of the event, the deal was sealed (it’s a rousing tune that always makes my barnacled old ticker stir a little). So walk down there I did, and I really enjoyed it.

It’s just a block from my hotel down to the harbor area. If you follow the road around the perimeter of the harbor, you pass The Empress, a venerable old (I think very old) hotel with walls covered in something green (ivy or something of that ilk). I think a coworker told me during my last visit that the hotel is slowly sinking into the ground. Then you keep walking around until you get to the Parliament building, which is hard to miss because it is outlined in white lights (like some houses at Christmas). The barge or whatever the symphony was arranged on was basically a straight shot out the front door of the Parliament. There were people lining the streets, sitting on the harbor shore, and filling the lawns of those two neat old buildings.

By the time I got down there, it was starting to get a little dusky, and it was neat to watch the tangle of boat masts swaying in the breeze (I won’t be so fanciful as to suggest that they were dancing to the music, though for a moment I was tempted). The weird thing is that as I approached, the song I heard was “Home on the Range,” and it was followed by “Clementine” and then by a song I recognized and that I heard them announce with “Appalachian” in the title. These all seemed distinctly American to me, so I amused myself for a minute thinking about what a nice welcome party Victoria had thrown me.

I wandered around listening to the music and watching people and generally enjoying the atmosphere. People were dancing to the music and smiling unself-consciously and really having fun, and it was fun to be part of it.

The rendition of the 1812 Overture wasn’t the best I’ve ever heard, but then half the sound was no doubt carried away by the 100 yards between the symphony and me, so maybe I’m not being fair. Toward the end of the song, when cannonfire is appropriate, fireworks were shot off in the harbor, and the pealing of bells could be heard from a belltower sort of between The Empress and the Parliament, and that was a neat addition.

As the concert wrapped up, people started heading back toward downtown (where my hotel is), and I floated with them. A drum and bagpipe group (complete with kilts and big furry hats) was marching in the street and started playing Amazing Grace as I walked away. Just a couple of blocks down from my hotel on the main drag, a percussion group had set up and was playing some really neat, lively stuff that had more people dancing in the street.

It was a neat night, well worth venturing out in spite of my tiredness, and I can’t help hoping that some of tomorrow’s festivities are evening ones so that I can attend.

Stage

For a long time at my day job, one of our big web site issues has been the staging of database-driven content. Particularly if you’re editing Drupal pages that have a lot of markup in them, publishing a node can be sort of scary, as it goes live instantly with any bugs you’ve introduced. In theory, Drupal’s preview feature can be used to view your changes before you commit to them, but this too is scary, as the content isn’t rendered exactly as it will be once published. Further, using vanilla Drupal with its preview function to stage content requires that you roll out changes one by one. If you want to group changes for a mass rollout, the best you can do is wrap your changes in html comments and uncomment them one by one during deployment, hoping you don’t fat-finger anything in the process. I’ve always thought this would be a pretty difficult problem to solve, but yesterday, I came up with what feels like a satisfactory method for staging content.

The new stage module addresses both safety-netted staging of individual content and management of change sets.

It works by tapping into Drupal’s revision system, which already allows you to track changes to content over time and to revert to older content. For specified types of content, any additions or edits are published using the normal Drupal workflow, but on publish, the revision number is pinned at its last blessed point. You can edit or add any number of documents, and they all remain pinned at their pre-edit revision until you roll the whole batch of changes forward. When you roll a batch forward, all the revision numbers are brought to their most recent and pinned there until the next deployment. In the administration section, you identify staging and production servers. If you view an affected node from one of the specified staging hosts, you see the latest copy; if you view it from a production host, you see the pinned version.

This workflow is ideal for environments in which fairly frequent milestones are deployed. Because of Drupal’s handy dandy revision system, you can compare versions of the content across pushes to see what’s changed.

The module is hot off the presses this morning and so is probably still buggy and feature-poor, but it’s a start.

Flock Eco Edition

Word seems to be getting out that we’re releasing an eco edition of the Flock browser for Earth Day. I haven’t tried it myself yet (we’re doing final QA on the build to make sure it’s in good enough shape to release), but I do know that it comes with all sorts of green-related links and feeds built in (it’s not clear to me whether these will be dumped in along with your existing ones if you’re already a Flock user; back up your profile first just in case) and that it has a green theme (complete with a recycle button in place of the reload button, which is kind of nifty).

Flock makes money when people use the search widgets built into the browser to search through Yahoo, and we’re opting to donate 10% of the money we make through this edition of the browser to some green cause (to be determined later by user voting). It kind of makes me think of the free rice game: Play a fun little game and give rice to starving people just by playing. Keep your search engine set to Yahoo and use our product to actually do your searching and save trees at the same time. Who knows? It could be your search for Paris Hilton that enables an ecologist to rescue a baby panda from the clutches of a poacher bent on selling its organs to a far eastern natural medicine dealer.

Travel Sounds

This is the sound me trying to swipe the wrong part of my virgin passport through the bar code reader (to be fair, there were two barcodes).

This is the sound of me negotiating the single-row seat with a couple split across the aisle of my small plane out of Knoxville.

This is the sound of me sprinting a half mile through the Houston airport to try to make a connection I’m sure I’ve missed (luckily, it was delayed by a few minutes so I made it).

I make no sound on the flight from Houston to Seattle because I’m wedged in the middle seat and have to sit upright and still as a statue for 5 hours to keep from bothering my neighboring passengers.

At first, there is no sound at midnight in Seattle. Then there’s a periodic annoying cell phone ring. Then the sound of a janitor unfurling garbage bags. A gaggle of would-be passengers cheers when their tardy plane arrives, and they commiserate good-naturedly when they learn there’s icy fog at their destination and they may have to turn around and come back when they finally get there. Now I’m nearly alone in the airport. Two gate workers talk about a new boyfriend, and then they leave, and then I am alone, the shops long closed, my stomach gurgling. This is the sound of me crinkling open some crackers and trail mix, slitting open a vacuum-sealed spread of little beef sausages, peeling back the foil lid of a tub of parmesan cheese spread. These I got on the first leg of my trip (Continental’s pretzel upgrade, I thought, though I received the bounty only on my trip’s first leg) and thought to save for the long, shopless night in Seattle. This is the sound of my reaction to the cheese. The other things were ok. This is the sound of my finding a bench to lie down on and rolling my jacket up under my neck and looping my leg through my backpack’s straps. This is the sound of me sitting up to read instead. And finally, the sound of the nothingness of a nap.

Interrupted by the pock-pock-pock of sudden herds of flight attendants going staccato to their early gates. This is the sound of an empty airport bathroom, and the quiet of another little nap. This is the sound of more pock-pock-pocking flight attendants, and then some laughter, pairs and trios of people beginning to stream into my terminal. Morning has broken.

This is the sound of the cappuccino machines at Starbucks and of my ordering a chocolate chip muffin. This is the sound of a Mt. Dew I’ve paid to clunk from its machine, another bribe to the caffeine gods so that they may keep my eyes wide and my brainwave somewhere north of flat for the workday that starts in 4 hours.

Google Docs

I’m usually pretty leery of using online services that I don’t administer for things that matter to me. For example, I’ve resisted a number of times using Google’s calendar for work purposes because there’s potentially sensitive information being posted to the calendar. So not only do I not have control over leaks of the data, but I don’t have control over backups, uptime of the service, etc., and this seems a lot of liability for something I need to make sure I’ve got access to. (Honestly, though, I think the smart folk over at Google are probably generally more competent than I am to guarantee uptime, backups, etc. — comparative benefits packages would suggest as much, at least.)

I’m very satisfied with one aspect of Google’s online service, however, and I’m consistently able to put aside my paranoia to use Google Docs for collaboration. Now I’d never store an important sensitive prose/text document there, but for planning server maintenance, the spreadsheet application is hard to beat. You share a document with everybody who’s involved, and everybody can view and edit the document at the same time. This past weekend, I was tasked with taking another shot at setting up replication between some mysql servers. We’ve set this up in the past but have lost confidence in the validity of the replication. So a coworker and I made another go of it this weekend. In preparation, I made a punch list of our steps, from putting up downtime pages and blocking access to the database at the firewall to pasting in commands for dumping data and resetting meta-data. I was able to color-code the steps by server so that it was easy to tell at a glance on what hardware to perform a step. And then as we went through the steps, we could update columns describing who performed a step and when. Of course, we’re coordinating this in a chat window as we’re doing the work, but it’s neat to watch the spreadsheet being updated interactively as we go, and this method provides a really simple, nice way to collaborate and keep a record of the process. Since the data’s not terribly sensitive (provided you don’t put passwords in), hosting it elsewhere doesn’t give me the heebie jeebies, and it’s nice to have a centralized repository of past maintenance events to build on for future maintenance. If there were a version you could download and install on your own hardware, I’d do it in a heartbeat and even use the apps for sensitive data, but then how would Google watch your every move and deliver search results based on the documents you create?

Blogged with the Flock Browser

Flock

For nearly three years now, I’ve worked for a company called Flock. For nearly three years, we’ve been working toward releasing a 1.0 version of our product. And yesterday, we finally did it, amid much less fanfare than I might have expected (not even a company blog post). Starting as far back as version 0.5 just under two years ago, I’ve been using Flock as my primary web browser (that’s what we make, a web browser built on the same platform that drives Firefox), so I’ve been around to see all the changes the product has gone through.

Our first public beta was released to much hype with subsequent fizzle. It had a neat skin, a photo viewer/uploader, a rudimentary blog authoring tool, and something we called the shelf, and that was it, besides the basic browser functions. Although we had many early enthusiasts (some of whom are still with us), reactions tended to be along the lines of “this is what the hubbub is all about?”

In June 2006, we released version 0.7 of the browser and saw lots of downloads and a lot of press (I worked 20-hour days for a week to keep the new web site from dying under the strain of our traffic). We were thinking at the time that we’d have a 1.0 version by the end of the year, but change was in the air, and after some executive turnover, the end of the year had come and we didn’t have a 1.0. In the first couple of months of this year, I feel like we really hit our stride and started executing. We pushed a 0.9 version with subsequent updates that got tolerable reviews, and our 1.0 beta releases over the past few weeks have been met with the customary skepticism, but for the first time, a lot of that skepticism is beginning to turn over. People are posting that though they found our product either not compelling or too buggy in the past, they’re loving it now. And plenty of newcomers are saying that they’re addicted.

I’m going to do a little sidebar here on the social web. I’ve always been pretty cold to it. What need do I have to send to Twitter every half hour an update about what I’m doing, or to read in real-time that my social-web-addicted buddies are going out for coffee or sitting through a dull meeting? Do I really want to read another “20 Questions” type post on MySpace? Basically, I don’t often have time or the compulsion to fool around on social networking sites. I spend my day working on the computer and so don’t typically like to spend much time playing on it. A year or so ago, I signed up with MySpace and Facebook basically because my work compelled me to. It was another way for Flock employees to consume our own dogfood, so to speak, and to network with users of these sites who were interested in Flock. But there wasn’t much personal value to me in signing up on these sites. I had a profile but I didn’t use the sites with any regularity.

The latest version of Flock has changed this because it brings the social web to me. The nifty services sidebar notifies me when I have new messages or pokes in Facebook, and it lets me drag content from the web to friends’ avatars to share it with them. I can find individual friends within my network more easily than by using Facebook itself because I can type part of a name in a textbox embedded in my browser to filter my friend list. I can see updated statuses easily, and an icon lights up for friends who have uploaded new media. When I click a person’s media icon, a media bar appears and is populated with thumbnails of their media that I can scan at a glance, clicking through to actually view only the things that interest me. Probably the best thing is that Flock tells me when there are updates so that I engage only when I have a good reason to rather than having to remember and bother to visit Facebook to look for updates. Since I’ve been using Flock 1.0, I’ve been engaging with people in my network, sending messages I wouldn’t have sent and viewing photos I wouldn’t have bothered to view. Flock 1.0 for me is like the Reader’s Digest of the social web. I’d never go out of my way to read a full-length bio of Meredith Baxter-Birney, but if I’m sitting on the can and have read all the jokes in my Reader’s Digest, I might thumb through the RD condensed interview with her, and I might even enjoy it a little.

That’s the main thing that differentiates Flock 1.0 from previous versions for me. I’ve long been a fan of the built-in feed aggregation, and it was Flock’s Flickr uploader (which also works with Piczo, Photobucket, and I believe Facebook) that prompted me a year ago to buy a Flickr Pro account. It previously hadn’t been worthwhile because, as a Linux user, I had no painless way of uploading photos in bulk. Flock also has built-in del.icio.us integration, the aforementioned shelf (now called the web clipboard, basically a little drag/drop area that lets you store dragged items for later use in blog posts), the blog editor, and all the goodness that comes with Firefox 2.0’s underlying engine.

I’m an employee of the company, of course, and so I have a vested interest in our success. But I really really do like the product and would use it for the built-in feed reader even if I weren’t an employee. (I’m not only the president of the hair club for men…) I suspect that there are plenty of people for whom Flock provides no benefit that Firefox doesn’t. If you don’t upload photos or read news feeds or belong to social networks, Flock’s probably not for you unless you just think it looks pretty. I wouldn’t necessarily recommend it for my dad, but I probably would for my sister and most of my friends. If you do do any of those things, why not give Flock a shot and let me (or our talented support staff) know what you think?