File systems are stored on disks. Most disks can be divided up into one or more partitions, with independent file systems on each partition.
Sector 0 of the disk is called the MBR (Master Boot Record) and is used to boot the computer. The end of the MBR contains the partition table. This table gives the starting and ending addresses of each partition.
One of the partitions in the table is marked as active. When the computer is booted, the BIOS reads in and executes the MBR. The first thing the MBR program does is locate the active partition, read in its first block, called the boot block, and execute it.
The program in the boot block loads the operating system contained in that partition.
For uniformity, every partition starts with a boot block, even if it does not contain a bootable operating system. Besides, it might contain one in the future, so reserving a boot block is a good idea anyway.
Other than starting with a boot block, the layout of a disk partition varies strongly from file system to file system. Often the file system will contain some of the items shown in Figure.
The first one is the superblock. It contains all the key parameters about the file system and is read into memory when the computer is booted or the file system is first touched. Typical information in the superblock includes a magic number to identify the file system type, the number of blocks in the file system, and other key administrative information.
Next might come information about free blocks in the file system, for example in the form of a bitmap or a list of pointers.
This might be followed by the i-nodes, an array of data structures, one per file, telling all about the file.
After that might come the root directory, which contains the top of the file system tree.
Finally, the remainder of the disk typically contains all the other directories and files.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.