Monitoring disk space in linux

Recently I ran into a situation where I need to monitor disk space on a couple servers while a code fix was being made. I needed to stop and start services when the disks got too full.

To do this I used a bash one liner loop to output information from the df command:

while :; do df; sleep 10; done

Sleeping for 10 seconds as to not thrash the disk horribly bad.

The disk free command gives you output similar to the following:

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 8256952 4582112 3255412 59% /
udev 3806520 8 3806512 1% /dev
tmpfs 762928 180 762748 1% /run
none 5120 0 5120 0% /run/lock
none 3814624 0 3814624 0% /run/shm
/dev/xvdc 41276736 180236 38999760 1% /mnt

And thats it, you get to loop over the command you want until you hit ctrl-c to exit the loop.

Mad Railers – October 2011

Last night I had the opportunity to present again to the Mad Railers group here in Madison. My talk was titled “Writing, for love and money”. I took others along the journey I had while working on Web Development Recipes and some tips I learned from Brian Hogan, who is one of my co-authors and mentor over the years.

Some of my main points where:

Overall the main key to success is to work at it every day, because with practice we can all get better. So give it a go and if you need a boost check out PragProWriMo and start writing that book!

Ruby Koans

Recently after doing a Code Retreat with Cory Haines I found myself really wanting to work on my Ruby fu.  I was inspired by the idea of practicing my trade everyday in some simple exercises that  allow me to focus on parts of the language to really learn it well.

So I decided to pick up the Ruby Koans which I was introduced to a year or so ago but never thought I needed that.  I always figured I could just keep learning by using Ruby for my projects, but then I realized that I was just using the same few parts of the language to build my apps.

Following the craftsman analogy, I was using the same saw and hammer because they are comfortable.  I didn’t take the time to learn about the pneumatic framing nailer because I already had a way to pound in nails, but boy does it make building things easier.

So if you are new to Ruby or have been using it for awhile I really recommend you find some exercises to keep your skills sharp and explore new parts of the language. I really think the Ruby Koans are perfect for this, I see them being easy to get started and with enough substance that even seasoned developers will pick up new things.