Resizing a Solaris partition

This was originally worked out when I had to resize a Solaris 10 partition under VMware, but it applies equally to native Solaris installs too!
WARNING: This only really works, if you have one partition. This should be true if you’re using VMware, and for the majority of Solaris installations. Partition, here, is in the true sense of the word: partitions as seen by fdisk, the BIOS and other disk management software, not the slices you mount as /usr, /home, and so on. Those are, errr, slices.
If you’re doing this for a VMware install, power off the virtual machine, and use vmware-vdiskmanager to resize the image file: vmware-vdiskmanager -x 20Gb solaris10_vmware.vmdk.
If the partition you are resizing is the root partition, you need to boot up in “failsafe” mode, or boot from a Solaris CD/DVD and choose the “shell” option at the first menu. You’ll be asked if you want to mount the hard drive install as /a. You do not. But you do want to remember the name of the disk (eg, c1t0d0p0).

Write out the current partition table to disk and edit the file:
# fdisk -W ptbl.tmp && vi ptbl.tmp

At the top of the file, you’ll see the actual current disk geometry, which should look somethign like this:

* Dimensions:
*    512 bytes/sector
*     63 sectors/track
*    255 tracks/cylinder
*   2610 cylinders

The sectors, tracks and cylinders numbers are important – write these down somewhere, and skip to the end of the file.

You’ll see a row of numbers, with words over them like Id, Act, Bhead etc. The two numbers you need to replace, correspond with Ecyl and Numsect.

Ecyl is the ending cylinder on the disk for this partition. The value for it, is the cylinders number that you wrote down in the previous step, MINUS ONE. The minus one is very important. While the total number of cylinders in my example is 2610, the ending cylinder number is actually 2609, because the numbering of cylinders on disk starts at zero, not one. This is the only time you need to worry about this.
You also need to change Numsect, which is the number of sectors on the disk. The value for this, is calculated as: sectors/track x tracks/cylinder x cylinders.
In our example, this is: 63 x 255 x 2610 = 41929650.

Save the file, and exit.

Now update the fdisk partition table on disk:
# fdisk -S ptbl.tmp -I /dev/rdsk/c1t0d0p0
Replace the partition name, with that of your disk. You’ll be presented with a little menu. The table at the top should indicate that 100% of the disk space is now used by the partition(s). Choose option 5, to save and exit fdisk.

Finally, we get to resize the actual partitions! Reboot into multiuser mode.

Look in /etc/vfstab to find the device that is mounted, to the slice you want to grow. In my case, this was the root slice mounted from /dev/dsk/c1t0d0s0.
We need to turn this into a metadevice (think: software raid), to be able to grow it. Don’t worry, this is perfectly (mostly) safe, and won’t hurt your performance (much, as far as I know!).

metainit -f d10 1 1 c1t0d0s0. This creates a metadevice named d10, from the given slice name. The -f causes this to be forced, which is needed if the slice is currently mounted.
Run metastat. This will give you the name of the new metadevice you created. For me, it was called d0.
If you are working on resizing the root filesystem, you need to run metaroot /dev/md/dsk/d0. This will update /etc/vfstab with the correct mount information. Otherwise, you need to update /etc/vfstab manually.

Dynamically loading modules in Python

Have you wanted to load modules, when you didn’t know their name?

I recently came across this problem while refactoring GoogleBot (my IRC bot). I wanted to place loadable modules in a directory, and have them all loaded, without having to know what they are named.

A good fellow called Issac at work helped me with this:

import imp
googlebot_mod_dir = os.path.abspath('modules')
sys.path.append(googlebot_mod_dir)
for module_file in os.listdir(googlebot_mod_dir):
module_name, ext = os.path.splitext(module_file)
if ext == '.py':
module_location = imp.find_module(module_name)
module = imp.load_module(module_name, *module_location)
globals()[module_name] = module

Works like a charm!

Clever advertising

I was standing around Ironforge tonight, about to log out of World of Warcraft, when gnomes started falling from the sky.

“Huh, that’s never happened before”, I thought.

As it happens, the gnomes were falling in a very particular pattern, and when they landed they died, leaving their bodies on the ground in pre-determined spots. Someone decided to do some very clever advertising, see the screenshot, below:

Wowmine advertising

I took several screenshots inside WoW, and then put them together quite easily using the free, open source program “Hugin“. It was pretty easy to use, I recommend it for photo joining (aka stitching).

Heroes relationship flowchart

Heroes is an amazing show, which seems to manage incredible plot twists every week, linking old characters in new way.
Quite often the newly uncovered relationships change the dynamic of the plot and you just have to see what will happen next week 🙂

I thought it was time to create a relationship flow chart, to visualise how all of the characters are linked together so far.
(Warning: If you’re not caught up on the story, some elements in here might be considered spoilers!):

Heroes Relationship Chart

Best burger ever

The following transpired at a Carl’s Jr restaurant a few minutes ago, after I got the urge for a late meal:

Me: Hi, I’d like a Bacon Cheese Six Dollar Burger combo please
Guy: Sure, medium or large? What would you like to drink?
Me: Medium with a coke please.. and can you make that with no mayo?
Guy: Sure. Anything else?

A short pause…

Me: Umm.. can you guys add jalapenos to that?
Guy: Sure.
Me: Great! Umm, how much can you add?
Guy: How much would you like?

A longer, stunned pause…

Guy: How about I put some on top and under the beef… and maybe sneak some in under the cheese too

Wow Carl’s Jr. Wow.

Second Stargate movie on it’s way?

Warning, here be spoilers!

On Friday, August 18th, The Sci-Fi Channel aired the 200th episode of Stargate SG-1. The show itself was fantastic, and a must see for anyone who missed it. I won’t give anything from the first 35 mins of the show away. Well, except to say the Martin Lloyd is back and making a feature length movie about SG-1, and that most of the episode very closely mimics real life events from the production of SG-1.
In the last scenes of the episode we find out that Martin’s movie is cancelled, but the studio wants to continue making the TV series.
In 2003, MGM said SG-1 would end after Season 8, and they would lead into a movie from that. SG-1 obviously did not go away, and the movie was never made. This part of the episode again mics real life.

In the final scenes we have a flash-forward ten years into the future, at the end of the filming of a new Wormhole X-treme episode. Martin answers the phone and then shouts out “Good news everyone, the movie’s back on!”.

The only thing that can be understood from this, is that MGM has decided to finally go ahead with the production of a new Stargate SG-1 movie.
I cannot find any more information about it yet, but going be the rest of the episode it is hard to draw any other possible conclusions. If you find out what’s going on, please let me know!

Phil Gordon comes to Google!

Phil Gordon, WSOP final table, World Poker Tour champion and former host of Celebrity Poker Showdown came to Google on Friday.

We had our annual company picnic at the Shoreline Amphitheater, it was pretty decent. One of the highlights was a 150 person no-limit Texas hold ’em tournament. I don’t know how they pulled it off, but they managed get Phil Gordon to come and host it.

This was especially remarkable as Phil had been playing in the WSOP tournament until 4am the that morning. The winner of the tournament walked away with a chip set signed by Phil. It was certainly a great day.

Our new puppy

Ginger went to sleep about a week ago 🙁
Brandy and the kids were incredibly sad, so now we have a new puppy in our house!

You can read about her in Brandy’s blog, here.

Posts navigation

1 2 3 4 5 6 7 8