Minix (Mini-UNIX) File System

J

Jarret W. Buse

Guest
Minix (Mini-UNIX) File System

Before we discuss the Minix File System, let’s discuss Minix a little.

NOTE: The Minix mascot is a raccoon.

In 1987, Andrew Tanenbaum wrote a book titled, Operating Systems: Design and Implementation. To be an example, he wrote an operating system called Minix (mini-UNIX). Minix is open source and was the inspiration for Linux.

Minix has gone through four releases: 1.0, 1.5, 2.0 and 3.0. The latest release at this time is 3.2.1 released on February 21, 2013.

Originally, Linux kernels were developed on a Minix system so Linux needed to support the Minix File System.

For the file system, each version has different maximum values as shown:

Code:
Minix Version            1                2                3
Max Volume Size        64 MB            1 GB (65 MB)        2 TB
Max File Size            64 MB            64 MB            64 MB


With each version, there are six sections within the Minix File System:

Blank Block – first block is reserved for boot code information
Super Block – second block stores the Super Block, or information about the Minix File System
Inode Map – section made up of bits, where one bit represents one inode. Tracks used and unused inodes. A ‘1’ is used to represent a used block and a ‘0’ is for a free block
Zone Map – section made up of bits to track used and unused zones
  • Inode Table – manages file and device information
Data Zone – majority of volume which contains files and directories

The Super Block contains the following:
  • Number of nodes on the volume
  • Number of zones on the volume
  • Number of inode bit map blocks which depends on the volume size
  • Number of zone bit map blocks which depends on the volume size
  • Maximum file size
  • Magic number
  • First data zone address
Inodes are each 64 bytes and contain the following:
  • Attributes – File type
  • Number of links – Count of blocks used for the file
  • User id – ID of owner
  • Group id – ID of owner’s group
  • File Size – Size of file in bytes
  • Access Time – Time of last access
  • Modification Time – Time of last modification
  • Status Change Time – Time of last status change
  • Zone 0 – Pointer to first block
  • Zone 1 – Pointer to second block
  • Zone 2 – Pointer to third block
  • Zone 3 – Pointer to fourth block
  • Zone 4 – Pointer to fifth block
  • Zone 5 – Pointer to sixth block
  • Zone 6 – Pointer to seventh block
  • Indirect zone - – Pointer to second zone
  • Double Indirect zone – Pointer to Third and Fourth Zone
  • Unused
Each file entry is then made up of two bytes for the inode number and fourteen bytes for the file name. Because of the limited 14 bytes for the file name, a file name consists of only fourteen characters. Directory entries allow for a 60 byte field. This means directories can be sixty characters. You must be aware that there is a limit to the number of inodes. Each inode points to a file, so the limitation results in a limited number of files allowed on a Minix volume. The maximum number of inodes is 65,535.

Zones are located within the inodes and zones can be thought of as pointers to addressed blocks. The first seven zones (Zone 0-6) list the pointers, or addresses, of the first seven blocks where the file is located. If the file is larger and requires more blocks, there is an eighth zone. The eighth zone points to a block which contains another eight zones. The first seven zones (Zone 0-6) work like the original first seven zones. The eighth zone point to another block which that block has pointers to other blocks. The maximum number of blocks per file is from the various zones as follows:

First Zone 7
Second Zone 512
Third Zone 512
Fourth Zone 512

The breakdown of this creates 7 blocks, from this 512 more blocks, then 512 more blocks. The Fourth Zone is 512 pointers from each of the Third Zone’s 512 blocks. To determine the maximum, we first multiply the Third and Fourth Zone (512 x 512) then add the First and Second Zone (7 + 512). Total, this makes (512 x 512) + (7 + 512) equaling 262,657 addressable blocks. With each block being 1 KB, or 1,024 bytes, this makes a rough total of 262 MB. The file size of 262 MB is theoretical since the Minix File System uses unsigned short integers to hold the block address. Unsigned short integers can only hold values from 0 to 65,535. The limitation means that a file can only be contained in a maximum of 65,535 blocks. Since each block is 1 KB, or 1,024 bytes, the maximum file size is 64 MB. The unsigned short integer is the cause of file size limit in Minix.

The Inode Table stores the Inode information. The information included is the file permissions, size, file type, number of links, etc. The main thing missing is the file name itself.

Minix does not support compression or encryption.
 

Attachments

  • slide.jpg
    slide.jpg
    14.5 KB · Views: 57,912

Members online


Top