Dealing with Defrag

Monday, October 31 2005 @ 10:01 AM EST

Contributed by: MattG

For most of you, defragmentation has become a regular practice in the administration of your Xsan volume. At some point, either capture files, or more commonly, render files are becoming so fragmented across the breadth of the storage that their playback predictably yields dropped frames.

The solution, of course, is to run the snfsdefrag utilitity, found in /Library/Filesystems/Xsan/bin, or to use the handy Xsanity Defrag program, Xsanity's cocoa wrapper of the same utility, in order to address the issue. [Ed. Note: Our Xsanity Defrag is getting old and creaky, and we do not currently recommend it!]

The snfsdefrag utility, used in its simplest form, gathers all the fragments of a given file (called “extents” by the utility) and places them in a section of the free space of the storage in one continuous chunk. The “virgin” territory that it usually seeks out in order to do this is the “far end” of the storage pool, which would usually not fill up until the storage pool itself reached its maximum capacity.

Using the utility on files that otherwise would not playback reliably is a fix that obviously needs to happen in order to deliver a tape, or have a client viewing of a sequence go without a hitch. So, the short-term benefit is impactful and necessary.

However, what has started to become clear is that, after a volume lifespan of just a few months and beyond, fragmentation on a volume that has had a fair share of snfsdefrag sessions seems to go up exponentially. This is caused by a simple and powerful phenomenon: as the fragmented files are transported to the new area of the storage pool, the fragmented areas they leave behind are tagged as free space. When a new file is written to the storage, these “pockmarked” areas of free space are used first, and as we use snfsdefrag more and more, it means that there are more and more tiny areas of free space that are used for new files. Therefore, the possibility of having unplayable fragmented files increases exponentially. Even entire volume defrags leave the “shadows” of these areas of free space, and new captures and renders seem to be written into the same fragments as the did the previous files.

We have reported here at Xsanity that free space pockmarking was a result of not isolating file system metadata to its own storage pool, which is still true. Unfortunately, the phenomenon of using snfsdefrag on the volume contributes a unique, although similar, issue of fragmented free space.

What we need with Xsan is an optimization function, which would essentially reassemble all of these pieces of fragmented free space back into continuous free space, so that new files could be written as single chunks as much as possible.

For those of you who go back on the Mac OS to the time when Norton Utilities was a staple of your administration toolkit, you’ll recall that the SpeedDisk program did exactly what we need for Xsan: it would de-fragment files, but as an additional step, it would also optimize free space as well.

Until Apple addresses this issue by creating an optimization function within the utility, or creating a separate optimization binary, we need to use the snfsdefrag utility as sparingly as possible, in order to prevent premature over-fragmentation of the storage free space.

Here are some tips for using snfsdefrag appropriately…

0 comments



http://www.xsanity.com/article.php?story=20051031100153656