Allocation is setting aside, or reserving, space for use. On a computer, it is setting aside the space on a hard drive for use to store files. The files can be newly created or those being modified. Each file system supports one or more different allocation methods and many types of allocation methods exist as listed: Multi-Block Allocation Delayed Allocation Persistent Pre-allocation Allocation Groups Allocate on Flush Dynamic Inode Allocation Striped Allocation We’ll cover these various types one by one. Multi-Block Allocation When a file is modified, some file systems write one block of data at a time. When a block is written, the data is passed through the processor before it goes to the hard disk. When one block is being processed at a time, it takes quite a bit of resources. Every time a new process is run, the CPU must be prepared to perform the necessary processing. If one block of data is done every few seconds, then the processor must be set up each time. For multi-block allocation, a group of blocks are processed and written together. The allocation takes less resources since the data is processed all at once and not a little at a time over a longer period. In this case, the processor needs to be initialized for the task once and the data is passed through continuously. Since a larger number of blocks are being written at once, it is better so files are not fragmented. The group of blocks will be written in a contiguous section if available. Otherwise, by writing single blocks at a time, the blocks may not be contiguous and cause fragmentation. Delayed Allocation Before we discuss Delayed Allocation, let’s look at Writeback Time. Data which needs to be written to the harddisk can be saved in RAM or cache. RAM/cache is able to read/write faster than hard drives. At certain intervals, the data is taken from RAM/cache and written to the harddisk. The Writeback Time Interval sets how often the writeback occurs. If there is a loss of power or the system is shut off, the data changes in the RAM/cache are lost since they have not written to disk. NOTE: It is usually best to set the Writeback Time Interval to a lower time frame. The Delayed Allocation is when the data blocks are written at the Writeback Time Interval. There are three advantages to Delayed Allocation: Larger sets of blocks are processed before being written. This reduces the processer utilization by performing the processing all at once, as discussed in Multi-Block Allocation. Reduces fragmentation by allocating a large number of blocks at once which are most likely contiguous. Reduces processor time and disk space for files that are short-term temporary files wich are used and deleted in RAM/cache before they are written. NOTE: For files where the file size is unknown at the time of writing, usually since it is still being modified or created, this is the best method. Persistent Pre-Allocation Similar to Delayed Allocation, the file is in RAM/cache, but the kernel will allocate the space needed on the hard drive. The file is written with all zeroes and should hopefully be contiguous. The method guarantees that the storage space is available for the file. NOTE: For files where the file sizes are known, then this method is the best because the set space can be “reserved”. Keep in mind that if the file is accessed before it is written from RAM/cache, the results will be a file of all bits set to zeroes. Allocation Groups Allocation Groups are not a method of allocating space in the sense as the other methods, but is relevant to this article. On a disk volume, whether it is a whole disk or a logical portion, the Allocation Groups is a section of the volume that maintains its own free block list and journal (if supported). Disk writes can occur in one Allocation Group at a time. If a file system spans multiple disks, then multiple writes can occur in separate Allocation Groups at once. Allocate on Flush Allocate on Flush is the same as Delayed Allocation. When data is taken from RAM/cache to be written, it is termed as a flush. Once flushed, the data is allocated (written) to disk. Dynamic Inode Allocation This allocation type does not deal with written files, but with the management of those written files. On most file systems, there are a set number of Inodes (See Intro to Inodes). Once the Inodes are used up, no more files can be written to the disk until others are removed. With Dynamic Inode Allocation, more Inodes can be created to allow for more files to be saved on the hard drive. For systems with large drives and small files, this can be very important. Striped Allocation Striped Allocation is known as RAID 0 and is covered in the article Intro to RAID.