FS Tools



FS Tools is a collection of libraries and few simple commands for manipulating on-disk Unix filesystems from user level. At the moment, only FreeBSD's FFS (both UFS1 and UFS2) are supported, although the intent is to support at least FAT, perahps some other flavors of FFS such as NetBSD's or OS X's, and perhaps EXT2/EXT3 or even HFS.

The original intent was to add UFS2 support for vbackup and Russ Cox has subsequently cribbed some code from fstools to do just this. In practice, however, I have used the tools mostly for recovering broken file systems and for creating disk images (think NetBSD FFS images or OS X dmg's). I haven't gotten around to making the necessary changes either to the tools or to vbackup to merge the two. The most commonly used programs that are currently distributed are:

  • Ffsarchive -- construct a filesystem image from a directory hierarchy
  • Labeldump -- dump disk labels in a human readable format
  • Ffssuper -- find FFS super-blocks in a raw disk device
  • Ffsmkfs -- initialized a file system
  • Fscat, fsgzip -- dump a filesystem, zeroing unused blocks
Fscat and fsgzip are particularly handy for physical backup in conjunction with content addressable storage such as Venti as they zero unused blocks.

Note that the distributed version expects to be unpacked in the same directory as an unpacked and compiled copy of 9unix. Furthermore, the library and tools have only been used in recent memory under FreeBSD 4-STABLE and FreeBSD 5.4. As with anything that touches your filesystem and hasn't been rigorously tested, use at your own risk.