TiVo Media File System
# TiVo Media File System

The MFS or Media File System is a proprietary file system used on TiVo hard drives for fault tolerant real-time recording of live TV.

Although MFS is still not particularly well understood by programmers unaffiliated with the TiVo corporation, enough is known about the file system to be able to do reads and limited writes. Applications exist to manipulate the file system and objects within it. Most of these applications are reverse engineered from software found on the TiVo itself, as many of the early TiVo programs were little more than specialized scripts that manipulated the data.

The MFS file system is organized more like a database, including transaction logging and rollback capabilities. It utilizes multiple partitions on the drive for a complete system. The partitions come in pairs, with one being the "Application" partition, and the other being the "Media" partition. The Media region is invariably quite large, and organized into long continuous blocks of data, with a variable block size that has a minimum of at least 1 megabyte. This is because it is designed to store large sections of video.

Each object in the TiVo file system is assigned an ID, which is internally called the "FSID" (presumably, file system ID). There are (at least) 4 types of objects that MFS supports: Streams (recordings, audio or video), Directory, Database, and Files. All Stream objects are stored in the MFS media regions, while the other types are stored in "application" regions.

The file system itself is implemented entirely in the Linux userspace. The primary reason TiVo devised such a system is because they needed a way to store large continuous sections of data easily in a manner that lent itself well to streaming that data directly to the media decoders in the TiVo devices, without being CPU dependent. Thus, the CPU has very little involvement in playback and recording functionality, simply directing the encoder/decoder chips to stream data directly to the drives via direct memory access while mapping sections of virtual memory onto the drive. The main CPU then orchestrates the entire affair. The result of this is that data stored on the MFS media region is not formatted into normal files, as such, but is a direct data stream that is indexed by the database sections in the MFS application region.

