VirtualBox and VHDs

When I first read that Sun’s xVM VirtualBox included Microsoft VHD format support, I booted up an existing Windows VHD I had and started through the fixup process – second boot of the VHD and it was pretty much corrupted.  I just tried again with version 2.1.0 and had the same problem (luckily against a copy of the original VHD). Somehow I haven’t had the issue on my Linux VHDs – go figure!

The issue has been visible for a while – see:

I hope that this is addressed - when compared with VirtualPC 2007, VirtualBox seems to run images with better performance and of course the Sun PUEL release has USB support.


IP Accounting script for RouterTech firmware

I modded my D-LINK DSL G604T last year with the RouterTech custom firmware (2.3 version). I did this primarily to mess around with IP Accounting, as our ISP doesn’t provide any realtime accounting information and we’re on a 30GB monthly cap.

Unfortunately I found that on enabling IP Accounting, the logs stored in /proc/net/ipt_account/mynetwork get wiped on router reboot.

I created the following script to save out the populated IP Accounting rows to a minix file system that is mounted using the persistent RT_cmd approach  (e.g. setenv RT_cmd_3 mount -t minix -o sync /dev/mtdblock/5 /nvram) available with the RouterTech firmware.  Note that the script assumes that IP Accounting is enabled.

# Remember to chmod a+x this file
# Might need to run “gzip < /proc/net/ipt_account/mynetwork >
#/nvram/ipta.gz” manually to seed
gunzip < /nvram/ipta.gz | while read iptaline; \
do echo $iptaline > /proc/net/ipt_account/mynetwork; done
echo “*/5 * * * * gzip < /proc/net/ipt_account/mynetwork > /nvram/ipta.gz” \
>> /var/spool/cron/crontabs/root
echo “1,6,11,16,21,26,31,36,41,46,51,56 * * * * umount /nvram” \
>> /var/spool/cron/crontabs/root
echo “2,7,12,17,22,27,32,37,42,47,52,57 * * * * mount -t minix -o \
sync /dev/mtdblock/5 /nvram” >> /var/spool/cron/crontabs/root
kill `ps afx | grep ‘[/ ]crond’ | sed -e ‘s/^ *//’ -e ‘s/ .*//’`
crond -b&

The script is named in the /nvram mount point so it gets executed on boot and reloads the IP Accounting state. The script saves and compresses only the relevant IP Account rows to the minix file system every 5 minutes and umounts and mounts the minixfilesystem, using cron, during the following 2 minutes after the save to ensure that the information is saved if a pull-the-plug reboot results in the minix file system not being shut down correctly (sync didn’t work in my usage) and losing the saved state. If you’re working on the file system with this executing, make sure to disable the script so it doesn’t pull the rug from under you. At the end of the script I kill crond and start it again - I found that crond could take quite a while to see the crontabs changes otherwise.

Finally, as I have no error checking in the state reload,  I recommend running ”gzip < /proc/net/ipt_account/mynetwork > /nvram/ipta.gz” to seed the process.


Water quality

With the recent report compiled by Consumer about the water quality of New Zealand beaches, the Surfrider Foundation’s Beach Manifesto has relevance beyond us surfers:

  • Beach access would be free and uninterrupted
  • You could surf or swim after it rains without the fear of getting sick
  • Sand would flow freely to form surf breaks and beaches, and not be captured by dams, blocked by groins, or walled up behind seawalls and riprap
  • There would be no net loss of surfing areas
  • Advances in technology would be used to make information readily available to the public
  • Beach access sites would be inventoried

Locally we have Surfbreak Protection Society (which seems to have been responsible for getting the jet ski lane removed from Lyall Bay) which might be a good starting point for continued action…


Simple suspend tool

Diomidis Spinellis, the author of Code Reading and (my personal favourite) Code Quality, has a blog that often has some pretty interesting reads. I stumbled across this entry which provides a code listing for a simple suspend tool that you can schedule with the Windows scheduler (likely after a scheduled task has completed that had awakened the machine from a suspended state).