|
Contents > Concepts
3.1.2. Sectors and Clusters
A sector, being the smallest physical storage unit on the disk, is
almost always 512 bytes in size because 512 is a power of 2 (2 to the
power of 9). The number 2 is used because there are two states in the
most basic of computer languages - on and off.
Each disk sector is labelled using the factory track-positioning
data. Sector identification data is written to the area immediately
before the contents of the sector and identifies the starting address
of the sector.
The optimal method of storing a file on a disk is in a contiguous
series, i.e. all data in a stream stored end-to-end in a single line.
As many files are larger than 512 bytes, it is up to the file system
to allocate sectors to store the file's data. For example, if the file
size is 800 bytes, two 512 k sectors are allocated for the file. A
cluster is typically the same size as a sector. These two sectors with
800 bytes of data are called two clusters.
They are called clusters because the space is reserved for the data
contents. This process protects the stored data from being
over-written. Later, if data is appended to the file and its size
grows to 1600 bytes, another two clusters are allocated, storing the
entire file within four clusters.
If contiguous clusters are not available (clusters that are
adjacent to each other on the disk), the second two clusters may be
written elsewhere on the same disk or within the same cylinder or on a
different cylinder - wherever the file system finds two sectors
available. A file stored in this non-contiguous manner is considered
to be fragmented. Fragmentation can slow down system performance if the file system
must direct the drive heads to several different addresses to find all
the data in the file you want to read.
The extra time for the heads to travel to a number of addresses
causes a delay before the entire file is retrieved.
Cluster size can be changed to optimize file storage. A larger
cluster size reduces the potential for fragmentation, but increases
the likelihood that clusters will have unused space. Using clusters
larger than one sector reduces fragmentation, and reduces the amount
of disk space needed to store the information about the used and
unused areas on the disk.
Previous <
Contents > Next
|