Author Archives: Dan Siemon

UPSs and testing

Today, I decided it was time to test my UPSs out to make sure they were still functioning properly. Like any well designed product UPSs just work. They fade into the background which makes it easy to forget that they may need maintenance too.

Computers can be very sensitive to power conditions. The hardware expects the power to be within a certain tolerance. Peaks or dips in the power can cause unexpected behavior. I don’t know how often bad power conditions result in crashes but it can’t help the stability of your computer. There may also be problems with cutting the power to hard drives. During a clean shutdown a hard drive will spin down and park the head. This cannot happen if the power is suddenly cut off. A good UPS not only provides power during a brownout or blackout it will also do some amount of filtering to ensure a clean power source. On the software side of things modern operating systems use RAM to cache file system operations. This means that the file you just told you word processor to save may not actually be written to the disk immediately. If the power were to drop at just the right moment the file system can be left in a inconsistent state resulting in lost data. For these reasons I view having a UPS on a computer as an absolute requirement.

The description of the file system caching above suggests a problem with testing the run time of an UPS. If a complete power drop can result in a corrupted file system then running the UPS to the point when it shuts down has the potential to be a bad thing. The solution to this problem on a Linux system is to mount the file system as read-only before running the test. If the file system is read only the OS cannot be caching any writes (because they are not allowed) so power loss should be OK (there may still be hardware problems). This can be accomplished by switching to a console (CTRL-ALT-F1 if you are in X) and then running the following commands:

init 1
df (to see the mounted file systems)
umount -r FILESYSTEM (for each file system).

It should now be safe to run test your UPSs until they cut the power. I do not know how to accomplish something similar to this on a Windows system but I expect there is a way. If anyone does know how please comment below.

It turns out my suspicions were warranted as my UPSs clearly need battery replacements. The APC Office 280 that powers my gateway computer, DSL modem and Ethernet hub lasted only a couple of seconds after the power plug was pulled. I have my primary monitor (19″) attached to an APC Back-UPS 300 which lasted only 4 minutes 22 seconds. The only good news is that the APC Back-UPS Pro 280 that powers my work station (not the monitor) lasted 12 minutes 24 seconds. Not stellar but at least it would stay online during a short blackout.

Now, the question becomes what should I replace, the batteries or the whole UPSs? It looks like batteries are going to cost about $45 for each unit. I can get a new Back-UPS CS 350 for about $100. I would hope that the power noise filtering in a more modern UPS would be better but I’m not sure that is worth double the cost. It looks like battery replacement is the way to go.

There are a couple of lessons in this adventure. First, if your UPS is more than a couple of years old take the time to test it. It’s quite likely it is not functioning as well as you think it is. Second, battery technology still sucks.

US Broadcast flag

Bad news. It looks like the Canadian government may be considering the broadcast flag that the MPAA successfully pushed in the US. Can we still head this off?

Michael Geist wrote an article about this for the Toronto Star. Michael Geist’s blog is one to watch if you care about Canadian copyright issues.

Parallel Universes

I am finally getting caught up on some magazine reading that I fell behind on during the school year. Today, I was reading a article called Parallel Universes by Max Tegmark in the May 2003 issue of Scientific American. I am not a physicist so some of this article is over my head but most of it was quite understandable. Reading that there are plausible arguments as to why parallel universes might exist was quite a surprise.

I found a couple of choice quotes that I think are worth sharing:

“But an entire ensemble is often much simpler than one of it’s members. This principle can be stated more formally using the notion of algorithmic information content. The algorithmic information content in a number is, roughly speaking, the length of the shortest computer program that will produce that number as output. For example, consider the set of all integers. Which is simpler, the whole set or just one number? Naively, you might think that a single number is simpler, but the entire set can be generated by quite a trivial computer program, whereas a single number can be hugely long. Therefore, the whole set is actually simpler.”

“The lesson is that complexity increases when we restrict out attention to one particular element in an ensemble, thereby losing the symmetry and simplicity that were inherent in the totality of all the elements taken together.”

These quotes jumped out at me because they touch on what I think is perhaps the most basic aspect of Computer Science and programming, finding the hidden simplicity. Often, there is a gorgeous, simple solution to the problem. It just takes time to get the complexity out of the way.

Statistics Canada

Statistics Canada is the Canadian government agency that generates statistics on an amazing amount of things. I had no idea they were keeping statistics on computer stuff.

This article summarizes some of the information.
The Daily – Computer and peripherals price indexes

Here, you can search the database but it looks like it has a minimal cost attached ($3.00).
Computer price indexes, by type of purchaser, monthly

Linux QoS Library (LQL) Released

It has finally happened. I have gotten a release of the Linux QoS Library (LQL) out the door.

Releasing software is actually a bit of nerve racking process. The worst part is not creating the announcement emails or filling out Freshmeat‘s forms, the worst part is worrying about what has been forgotten.

  • Missing files in the distribution? Hopefully, make distcheck covers that.
  • Bad or broken API documentation, ie spelling errors.
  • Not enough testing – What if it doesn’t work on other systems?
  • Design flaws – It is Free Software after all. Everyone can see your mistakes.

A big part of me would have liked to spend an indefinite amount of time to get a ‘perfect’ release, something I was really 100% happy with. However, that is against the release early, release often strategy that Free Software uses to such great effect. Besides, I would probably never be 100% happy with the code base anyway. Perhaps the single most important reason for this release is to let others know that the project exists.

Announcement
The Linux QoS Library (LQL) provides a GPL licensed, GObject based C API to manipulate the network queueing disciplines, classes and classifiers in the Linux kernel. LQL does not use the TC command as a back-end. Instead, LQL communicates with the Linux kernel via Netlink sockets the same way TC does.

0.5.0 — 2004-08-30

  • Initial public release.
  • I wanted to get 100% API doc coverage and a lot more testing done before I made a public release but I decided to go with the release early, release often strategy.
  • 86% API documentation coverage. A lot of the undocumented API is for the U32 classifier implementation which I am not that fond of. I think this API will change quite a bit.
  • What LQL really needs is much more testing in larger applications.
  • I make absolutely no promises that any of the API will be stable. I expect the API to change as larger programs are built with it and new limitations (and bugs) are found.

Please see http://www.coverfire.com/lql/ for more information.

Download:
http://www.coverfire.com/lql/download/lql-0.5.0.tar.gz

Fundamentalist

I while ago I was listening to an interview involving the IMF‘s economic policies in Argentina. One of the people being interviewed (I don’t remember the name unfortunately) offered a definition of fundamentalists that I thought was insightful. The below is only a paraphrase as it has been several weeks since I heard the interview.

Fundamentalist: A person who believes in a set of rules or ideas so strongly that even after powerful evidence that these rules are failing the person thinks that the only problem is that the rules are not being enforced strongly enough.

Bloom Filters

SlashDot recently posted an article about LOAF. LOAF is an interesting idea. The site is worth looking at for it’s own sake. However, what I found really interesting was the tidbit of computer science behind LOAF called a Bloom Filter.

A Bloom Filter uses multiple hash functions and a large bit array to represent a set. The set cannot be reconstructed from the Bloom Filter. There is a small possibility that the Bloom Filter will return a false positive but a false negative is impossible.

Here are some links with more information:

The original article on Bloom filters:

Communications of the ACM
Volume 13 , Issue 7 (July 1970)
Pages: 422 – 426
Year of Publication: 1970
ISSN:0001-0782

This article is available in the ACM digital library.

Weekend

It was a good weekend. Saturday was Kevin’s (Karen’s brother) Buck & Doe. I had a really good time. I got to be the barbeque guy which is always lots of fun at a big party. I wish I knew how many hamburgers we cooked. Only bad part of the day was the mild sunburn that resulted. You would think I would know better by now. After some post party cleanup Karen and I spent Sunday afternoon doing a few hour motorcycle ride with my parents. Basic route was Sebringville, London, Woodstock and back via Embro Road. Sometimes I miss having my own motorcycle.

Today I received my copy of Mono: A Developers Notebook. I ordered it from Chapters in the middle of last week. I love buying books on the Internet. This book looks like a good quick start guide to Mono and C#. Exactly what I need.

Secure remote backup

Every once in a while I see posts on mailing lists where people wonder about doing remote backups. I figured it may be worth while to describe how I have been doing my home work station backups for the last few years. Hopefully, this will be useful to someone.

I consider a backup system that requires frequent manual attention pretty much useless. Mainly this is because it is hard to maintain proper backup discipline when busy or away. This is especially true of media based backups. Swapping tapes or CDs to make a backup is annoying enough that the backup probably won’t get done as often as it should. Networks allow the backup process to be automated by having each system back itself up regularly and automatically to another host on the network. However, making backups to another host in the same building doesn’t help much when the building burns down. If you have computer equipment at two secure locations with a large pipe between them, automatic off-site backups are pretty easy. Unfortunately, most individuals are not this lucky. However, with the proliferation of broadband it is quite possible that you know someone who has a big enough pipe that you could send backup data to them in off hours.

This remote computer may be owned by your best friend but do you really want to make your backup data available to them? Even if you do trust this person maybe they don’t look after their machine as well as you do, their computer could be cracked etc. Clearly the remote system needs to be considered untrusted. The data is going to have to be encrypted.

My backup script basically does:

  • Create a tarball of all of the data to backup.
  • bzip2 the file to make the transfer shorter.
  • Run GNUPG to encrypt the file to myself.
  • Use SCP to transfer the file to the remote system.

Thus, this requires that you have an OpenPGP key (via GNUPG) and access via SSH (SCP) to the remote host. Transferring the file with some other, less secure method shouldn’t reduce the security of the system too much. The only problem would be if someone sniffed your authentication information and then deleted the files from the remote host. Since the files are encrypted downloading them doesn’t do the bad guy any good.

This system is not suited to backing up your media library. Mostly because of bandwidth limitations but also because incremental backups are not possible. The entire backup is sent every time.

Though the point of this entry was to just put the idea of doing backups this way in out there for Google to index I have made a copy of my backup.sh available. The script is quite simple but should provide a good starting point for anyone interested in taking the implementation further. This particular script is setup to do daily and weekly backups. It has two configuration options that specify plain text files containing lists of directories to exclude from the daily and weekly backups (see man tar for the exclude file format). What I do is exclude everything but frequently changing directories from the daily backup and only exclude media directories from the weekly.

There is one obvious catch-22 with this system. Your GNUPG keys are stored in ~/,gnupg and this directory is backed up and encrypted by these keys. If your computer is lost the only copy of your data you have left is encrypted. You now have no way to decrypt your backup. So, you need to keep a separate backup copy of your GNUPG keys somewhere else. Since you have a pass-phrase on your key (you had better anyway) these files are already encrypted.

In order to make this backup system automatic (and hence useful) it needs to be able to transfer the backup file without user intervention. With SCP this can be accomplished by creating a un-passworded SSH key-pair. This allows the host which holds the keys to login to the remote host without a password, ie without user intervention. Then the SSH_OPTIONS variable in the script can be modified to point SCP to this key. Now you can setup the script as a cron job and get your backups done automatically every night. MD5 sums are used to verify the successful transfer of the backup. The script will also email you if the backup failed.

This script could be made a bit smarter so it would delete old backups from the remote host. It does not do that right now. You’ll have to login to the remote host once in a while to delete old backups. How often you will need to do this depends on how much space the remote host has available.