Tuesday, December 25, 2007

Bit rot, or maintaining a healthy Windows installation

My computer network at home has grown quite big (for a home). I have 2 massive storage servers (3 TB per server in protected usable storage - 2 RAID5 arrays with 4 500GB disks in each, per server), 1 backup server with 2TB more, 2 Media Center PCs (I have no DVD players), 1 game computer, 4 personal computers (mostly laptops) belonging to the family members, a Small Business Server 2003 "to rule them all", a game computer, and another PC running the phone system for the household.

That's 12 computers overall, 3 running Windows Server, 3 Windows MCE 2005, a few XP laptops, and in one instance (the game computer, because Halo 2 PC requires Vista) a dual boot between XP and Vista.

Over the years I tried to introduce Linux a few times, but never managed to integrate it in a usable way (that is, assign it a meaningful task). When I'm done with my current project (writing a Project Gutenberg proxy that automatically converts books into a SONY Reader format), I will try it again.

Except for the 4 servers that have to be separate because you just can't cram enough hard drives into one case (there are 9 hard drives per server), I could probably have consolidated the rest into less equipment.

The reason they are separate is because over my almost 15 years of using NT, I learned one lesson - Windows computers become slower and less reliable over a period of time. The reason - constant installation and uninstallation of software, and consequent fragmentation of the registry and other vital system files that normal disk defragmentation cannot touch, because it does not defragment open files.

An attendant problem is that software installation and uninstallation is often done as an after-thought - either in a very short time right before the software is to ship, and people discover that nobody thought about the installer, or by developers who are less competent and therefore cannot be assigned to a "real" feature.

Uninstaller gets even less love, because it's an after-after thought. This unfortunate trend results in piles of garbage in your system's registry - leftovers from software long gone. Most commercial installers do track the registry settings that are created during the installation process, so they can be removed during uninstallation. But most software creates registry entries in the process of its normal operation, and about that the installer has no way of knowing.

Case in point - install Visual Studio 2005, run it once, then uninstall it. Then search your registry for "Visual Studio". I have not yet done this experiment with 2008, maybe they have cleaned up their act by now, but I somehow doubt it.

Registry is both a file that grows, and thus gets fragmented, and also a file-system-like data structure, that can get fragmented (unbalanced) internally.

The first problem can be solved with this wonderful tool by Mark Russinovich.

The second I don't think is solvable at all, short of maybe booting into WinPE, mounting the hive, and then copying the data from the hive into a different hive. But don't try this at home because some of the data in the hive, such as info fields, the regedit cannot access. If you actually do do this, you will end up with an unbootable system.

So I used to reinstall Windows by reformat approximately yearly because by the end of the year the PC would be noticeably slower. This phenomenon is widely known as the "bit rot".

Then I tried a different usage pattern, that turned out to be very successful - partitioning of the tasks across many computers. This way you pre-install everything you need for a specific computing task on a single machine, and then leave this machine doing this task - and nothing else.

For example, my file servers have Windows Server 2003 installed on them, and nothing else. No Office. No codecs. The data lives on disks that are separate from OS. So the image on these boxes does not change much day to day, and the performance today is exactly the same as it was a year ago (yes, I did measure :-)).

The same is true for Media Center computers, and most other machines in my household - they are single-purpose boxes. When I need to deploy a new application, I just go out and buy another box. You can usually build a generic PC from Fry's sale component for ~$200, without the monitor.

I install the OS, update, defragment, install all the supporting apps, defragment, then leave the box to run its task. The only things that change after that are Windows updates, and infrequent updates to this one application (e. g. my MCEs occasionally get their codecs refreshed, when I discover that they no longer play newer files).

Of course, I still install new things to try them out, but I do it on my laptop (or in a VM, if it looks really scary). Because all of the usual computer tasks have been farmed out to the rest of the network, my laptop doesn't run a lot - XP, Office 2007, Visual Studio 2008, VMWare, Adobe Reader, SONY Reader, X server, GnuWin32, SlickEdit, a couple of media conversion programs, and a pack of codecs. Reinstalling it is a matter of hours, and it's the only machine in the house that I will be redoing periodically.


dzembu said...

That is a wonderfully Era of high technology we are living in :-) Marketing should love that : when I deploy a new application I buy a new PC for that ... :-)

rewired said...

To consolidate your storage servers (to some degree), you could leverage ZFS, and Norco 4020 case. Having 20 hot swap bays in the case it's self, plus a real file system that can leverage all of that storage is an amazing thing.

You could update/consolidate your current file servers with new drives for a reasonable cost per gig, as well as consolidate and lower your power usage. 5x 1500 gbB drives, in a raidz (software raid 5, without the write-hole bug), would double your storage capacity, and you would still theoretically have the ability to drop in 3 more sets just like that