Archive for the ‘Technical’ Category

I Did Not Know: pbzip2

Posted on February 4th, 2010 in Technical | Comments Off

I just learned about pbzip2, which lets your multicore computer use more than one core when using the bzip2 compression algorithm.

On my Mac Pro at work, I installed it with MacPorts (`sudo port install pbzip2`).  It is this kind of awesome:


$ ls -lh original.tar
-rw-r--r-- 1 jmcmurry staff 2.4G Feb 4 13:47 original.tar
$ time bzip2 -k -v original.tar
original.tar: 36.215:1, 0.221 bits/byte, 97.24% saved, 2604288000 in, 71911733 out.

real 13m3.313s
user 12m50.536s
sys 0m3.773s
$ mv original.tar.bz2 bzip2.tar.bz2
$ time pbzip2 -k -v original.tar
Parallel BZIP2 v1.0.5 - by: Jeff Gilchrist [http://compression.ca]
[Jan. 08, 2009] (uses libbzip2 by Julian Seward)

# CPUs: 8
BWT Block Size: 900k
File Block Size: 900k
-------------------------------------------
File #: 1 of 1
Input Name: original.tar
Output Name: original.tar.bz2

Input Size: 2604288000 bytes
Compressing data...
-------------------------------------------

Wall Clock: 119.369207 seconds

real 1m59.612s
user 14m39.090s
sys 0m44.840s

Sweet. 6.57x faster by adding a “p” to my command line.

The resulting compressed .bz2 files aren’t exactly the same according to md5 (the pbzip2 output is a little larger, which makes sense due to the splitting of the work), but when they decompress, they’re both identical to the original .tar file.

See also: mgzip.

Mac OS X 10.6 Automator Services: Awesome

Posted on September 14th, 2009 in Technical | Comments Off

I’ve been enjoying how Automator in Mac OS X 10.6 lets you easily create services for simple little annoying things.  I expect it’ll take about three times longer to write about what I just did than it did to actually do it.

I’m always writing emails containing computer hostnames, and sometimes I want to include the full DNS name and IP address in those emails.  That’s especially handy when you’re writing about firewall rules, as I just was.

I created this simple Automator Service workflow in about 60 seconds.

When I select some text in a text editor and run this Service (context click, select the Service name), this happens:

“foo” -> “foo.domain.com [192.168.1.200]”

A few notes:

  1. “Get Specific Text” is grayed out because it’s disabled.  As you’ll find when writing Automator Services, you have to have some dummy text available to substitute for the selected text when developing your workflow.  You just disable this when you save the Service.  Easy, but confusing if you don’t know what’s going on.
  2. Be sure to check “Replaces selected text” at the top.  That means whatever you have selected in your text editing window will be replaced with the output of this script.
  3. Be sure to change “Pass input” in the “Run Shell Script” task to “as arguments”.  That makes $1 become your selected text.
  4. There is zero error checking.  You will probably blow up your computer and the Internet.

It actually took much longer to write this post, especially because WordPress didn’t want to create an image link for me.  Thanks, WordPress!

Solaris 10 u6 has no “-u” on “zfs receive”

Posted on April 30th, 2009 in Technical | Comments Off

Despite what you might read at docs.sun.com, Solaris 10 update 6 doesn’t have a “-u” option for `zfs receive`.

jmcmurry@lemon $ cat /etc/release
Solaris 10 10/08 s10s_u6wos_07b SPARC
Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 27 October 2008
jmcmurry@lemon $ zfs receive -u
invalid option 'u'

This could’ve been brought to my attention before I decide to create my ZFS export streams recursively.  One at a time, I’d have been fine.  What seemed to be an awesome way to retrofit a metadata slice for an SVM volume into a whole disk ZFS root install turned out to be a miserable trail of heartache and pain.

But I can take it; I am a Unix guy.

UPDATE: “-u” seems to be in Solaris 10 update 7, but even there, it’s not in the man page for zfs(1M). Thanks so much for updating the docs without indicating that the “recover your root storage” function only works on the OS release that you made available for download today.

/grrr

Moving a Solaris 10 zone

Posted on March 19th, 2009 in Technical | Comments Off

Today I wanted to move a Solaris 9 zone running on a Solaris 10 test server to a new ZFS dataset within the same ZFS pool with compression enabled. This container is an archive of an environment we don’t use very much, normally leave shut down, and intend to delete fairly soon, but since it’s a flash archive of a Solaris 9 machine, it takes up a lot of space on the test system’s local disks.

First I created the new dataset:

# zfs create rpool/zones
# zfs set mountpoint=/zones rpool/zones
# zfs create rpool/zones/foo
# zfs set compression=on rpool/zones/foo

I thought I should halt the zone, update the zonepath property for the zone, move the files to the new place, and start up the zone.  Nope:

zonecfg:foo> set zonepath=/zones/foo
Zone foo already installed; set zonepath not allowed.

Great, now I’m going to have to search through a bunch of docs and maybe remove the zone and redo it all and why can’t they make this easy for me, argh.

Well, they did:

# zoneadm -z foo move /zones/foo

I like a lot of the changes in Solaris 10, especially the usage and man pages for things like zfs(1M). These commands tend to do the annoying things for you and the man pages have lots of examples. Nice.

And hey:

# zfs get compressratio rpool/zones/foo
NAME PROPERTY VALUE SOURCE
rpool/zones/foo compressratio 1.44x -

AT&T 3G in Austin

Posted on March 18th, 2009 in Technical | Comments Off

All the hipsters showed up in Austin and their iPhone 3G onslaught made the AT&T 3G network kinda sorry.  They’re going to add capacity so you can TwitterBookSpaceFlickr some more.

Fact is, I was in Austin not long ago, a solo pseudo-hipster with only one iPhone 3G, and the AT&T 3G network was already kinda sorry.  I’ll be back in a few days for the real music experience, and I hope AT&T leaves all the trailers and duct tape and hamsters running on exercise wheels in place so I can reap the benefits.

It’s a shame that Steve has been in Austin for two SXSW happenings and I haven’t insisted that we go.  I definitely think it would be a lot of fun.  It’s obviously an educational experience.