Debian Squeeze & Broadcom b43 etc

So you like Debian, and why wouldn’t you, it is great after all. Unfortunately, many laptops come from the factory sporting Broadcom-based chipsets. So inevitably I complete a Debian install and Broadcom takes the wind out of my sales. I then trudge over to http://wiki.debian.org/wl#Squeeze and go through the paces. Why? I do it over and over. Well enough is enough, I mean this isn’t a tricky script to write. So for your enjoyment, I have put it all together into a small bash script to simplify things for future installs. First, be sure to add the non-free repo to your /etc/apt/sources.list file.
Then create and run a .sh file containting:

#!/bin/bash
aptitude update
aptitude install module-assistant wireless-tools
m-a a-i broadcom-sta
echo blacklist brcm80211 >> /etc/modprobe.d/broadcom-sta-common.conf
update-initramfs -u -k $(uname -r)
modprobe -r b44 b43 b43legacy ssb brcm80211
modprobe wl
iwconfig

Enjoy!

–himuraken

Crontab Generator Makes Scheduling Even Easier

For those that have never used crontab, it can be a daunting task to schedule a simple script. As with all things, I highly recommend that you learn the meanings of CLI programs and their usage etcetera. With that said, I wanted to check my crontab job against a generator of sorts just to be sure I had it right. If you want a simple click and go on crontab generator, I recommend using the one provided by HTML Basix. Enjoy!

–Himuraken

Convert Thick Virtual Disks to Thin

When working with virtual machines, it is often advantageous to over allocate and under utilize resources. When it comes to virtual hard disks, this is even more common place. On low use or low demand servers, I always use thin provisioning. This saves disk space by only using physical disk space when the guest actually uses the virtual disk. But what about those disks that were created using the thick option, or brought over as thick automatically during a P2V conversion? Time to convert your thick virtual disk to thin.

As always, I recommend backing up all of your data and knowing what you are doing. Test this in a non-production environment.

Converting disks from thick to thin is actually quite easy and can be accomplished using these steps:

1. Log into your ESX host using SSH and cd into the VM directory that contains your virtual disk.

2. Shutdown the VM so that we can get exlusive access to the virtual disk.

3. Run vmkfstools -i yourthickdisk.vmdk -d thin yourthindisk.vmdk

4. Edit the settings for your VM and remove the existing drive. Add a new hard drive and choose the existing drive option.

5. Boot the VM and enjoy.

Note: Dont forget to go back to ESX server and remove the old .vmdk and -flat.vmdk files once you are sure that your VM is operating normally off the thin disk.

–Himuraken

Command Line Scheduling

I am going to go over some of the basic at command usage and some real world examples of its usage.

at – Run without any switches the program will display scheduled items or inform you that there aren’t any scheduled jobs.
at /delete – Using the /delete switch will make the command prompt you to delete all current entries.
at ID /delete – Using the job ID and the delete switch, the program will clear the specified ID/entry without prompting.
at time command – This is the most common way schedule a single task which will run once.
at time /every:X command – Same as above plus a recurring job based on X, which can indicate a day of the week or month.

I use the at command every day since it is a very simple and effective tool. Below are some common scenarios where you might use at

I often perform maintenance such as Windows Updates which require a reboot but I cannot reboot the server to apply the updates. In this fairly common scenario the solution is very easy, a scheduled reboot. To perform a reboot from the command line of a Windows 2003 server you would run “shutdown -r” and press enter. If you wanted to do this at 3:00am you would simply run “at 3:00 shutdown -r“ from the command line. Another one that I use frequently is the scheduled defrag. I use this on all servers and client computers that I come across: “at 3:oo /every:1 defrag c:” which runs a command line defrag of the c: partition at 3:00am on the 1st of every month. You can substitute the 1 for a day such as M,T,W,Th,F,S,Su or any such combination separated by commas.
There countless useful tools that can be executed from the command line and just about all of them can be ran unattended by using the at command. I highly recommend automating your daily tasks such as defrags, reboots, and system cleanups using this command. It is very important to run the command without any switches after doing any work with the command so you can double check for typos. You can also see your scheduled jobs from the GUI by typing tasks in the run dialog and pressing OK.

–himuraken