Contiguous storage allocation of files in disk: In this method of storing files in a disk, files are stored as a sequence adjacent to each other in blocks. Advantage of this scheme is that by using address of first block and the number of blocks a file can be located. Also, by using this method performance is high. Disadvantage of this method is that when the files are removed, the disk becomes fragmented. Contiguous storage allocation of files in disk is generally used in CD-ROMs. Below given figure shows two files File 1 and File 2 stored in the disk. File 1 is using 3 blocks and File 2 is using 5 blocks.
Linked list storage allocation of files in disk: In this method files are stored as a linked list of disk blocks. First word of every block is a pointer to the next block. In this method there is no problem of disk fragmentation. Disadvantage of this method is that random access of files is slow. Also, pointer takes some space.
Linked list storage allocation of files in disk by using FAT (File Allocation Table): In this method of storage allocation, instead of a pointer, a table in memory called file allocation table is used. Advantage of this method is that random access of files is faster. The only disadvantage of this method is that the entire table should always be in the memory. FAT file system is of 3 types: FAT-12, FAT-16, and FAT-32. Here the numbers 12, 16 are the number of bits of disk addresses. However, in FAT-32, 32 is a misnomer. Here only 28 number of bits of disk addresses are used.
Storage of files by using I-nodes: I-node (Index-node) is a data structure used for storing attributes and disk address of a block in memory. By using I-nodes all the blocks of a particular file can be found. Here, only the i-node should be in the memory at all times.