Thursday, 31 August 2006

Experiments with Monad

I've been using the Unix shell for years and working on a Windows box is always a frustrating experience in comparison. However, in the last week, I've downloaded an RC for Monad - or Powershell as Microsoft are officially calling it.

My first impressions? Monad is the best thing I've used this year!

There are a couple of things about it that I like: The logical naming of commands (or cmdlets as they are known). This takes the form of a verb-noun, for example, get-process, sort-object etc.

The second thing is that Monad passes objects instead of strings.

Imagine the output of the "ps" command. A set of tabulated data including process name, parent PID, PID etc. This can be passed to other commands, but it's all in the form of a string. The output of a the get-process cmdlet is an object, where the methods can be executed, or properties pulled out.

An example - to get the process name, PID and number of file handles of a machine, sorted by the number of file handles would be: get-process | sort-object handle

Very logical, very simple, very powerful.

It's taken a long, long time, but Microsoft appear to have matched (exceeded?) the Unix shell.

As an aside, the O'Reilly book on Monad is very easy to read, especially if you have an understanding of Unix shells.

Monday, 28 August 2006

How to do Linux backups

My "professional OS of choice" is Solaris for most tasks, and the standard method for filesystem backup is ufsdump.

Linux is a bit of a different story, with Linus Torvalds once saying that dump is deprecated. The main problem of dumping a mounted read/write filesystem is that the contents can change during the backup and the dump program has no knowledge of what is currently in the disk cache.

Hmm, what to do then... Maybe tar or [cringe] cpio?

The method I've used and prefer is to still use dump, but to take advantage of LVM snapshots to provide consistency. I've got this working with Ext3 with no problems, but my main Suse 10.1 install is having problems taking snapshots consistently. I am managing to take normal xfsdumps of my [mostly] idle filesystems which are written out to external firewire drive.

Backups are one of those things we all agree is a good idea, but most of us fail to put into practice (for our personal machines anyway). Having a dump of a filesystem on an external disk gives a little peace of mind.