Catalog File

Catalog file is a main component in Mac operating system. It is used by the file manager to store all the records of the file hierarchy containing files and folders which are stored on your Mac Volume. It is structured in the form of B-Tree, containing header node, index nodes, leaf nodes and map nodes.

All the files and folders in the catalog file are identified by their unique ID called CNID, Catalog Node ID. These CNIDs play a very useful role in accessing and finding the files from the HFS+ Volumes. In case of folders the CNID is folder ID, and for files, then the CNID will be the file ID. The first 16 CNIDs are used by the Mac OS X to store system related files. The CNID contains: The catalog file key the parent folder’s CNID and the name of the file or folder and catalog file data (leaf node) contains records of the files or folders which comprises of following records, explained below:

  • Folder Record: It contains the information about the number of files and folders contained in that folder, folder id, data of creation and modification of the folder, last access date, and Finder information and also the permissions allotted to these folders.
  • File Record: contains the information about the three timestamps like creation, modification and last backup dates, data of the first file extents, pointers associated to the file’s first data and also the resource forks. In additions it also contains information for the File finders like Creator code and type code.
  • File Thread Record: It contains just the name of the file and CNID of its parent directory.
  • Folder Thread Record: It contains the name of the folders and the CNID of its parent folder.
  • (These two Thread records just provides the link between its parent folder and itself)

  • Catalog Thread Record: used to link the CNID to the file or folder using or referencing that CNID

The thread records mainly contain the CNID of its parent file or folder which it references. In order to find or locate a file or a folder using its CNID, first you need to locate the thread record of that file or folder. Using this, you can find its parent folder CNID and also the name. Then, with the help of its parent folder name and ID you can easily locate the file needed.