Blocks and Clusters

It is obvious from our earlier discussion that we could identify any area on a disk by specifying its track and sector coordinates. However, this is not a particularly good idea, as it means giving applications direct access to the disk hardware and poses security risks, eg: if users can write directly to a track and sector address, what is there to stop them from writing to any address, including one already in use by someone else?

It is better to devise a logical file structure for the disk, and allow users and applications to interact with this via the File Management System. One common way of doing this is to group a number of storage areas together into blocks or clusters of a larger size. (MS-DOS refers to them as file allocation units, as you’ll see if you scan a disk using the Scandisk or Checkdisk utilities.)

These blocks are usually made up from contiguous areas on the disk, as this maximizes speed of access. They are typically 1, 2, 4, 8 or 16 kilobytes in size. Larger capacity hard disks have a larger block size. Files are stored in units of blocks, rather than sectors, and these blocks are identified to the file system by a number, from 0 up to the total number of blocks on the disk.

We have already encountered directories or folders, when we looked at organising our files. Information about each directory, including the root, is stored in a table, held on disk and maintained by the file system. Each entry in the table (a directory entry) relates to a single file or folder.

Each entry contains the name of a file or folder and information about its status,  eg: whether it is read-only, or can be modified or deleted, which users are allowed to access it (on a multi-user or network system), and whether it has any special status, eg: is it an operating system file, or is it hidden from users.

An entry also contains information relating to the size of the file and its location on the disk. There are several different ways of doing this, depending on the method used for allocating and keeping track of free disk space. In MS-DOS and Windows, each directory entry contains the number of the cluster which holds the start of the file’s data. If the file is smaller than the cluster size for the disk, then this cluster will contain the whole file, and no other information needs to be stored.

Next: Large Files