iXBT Labs - Computer Hardware in Detail






Data storage on hard discs
Part 1

1. Introduction

A hard disc (also known as winchester) is a device where you store your data most often. The first hard drive released in America in the early 70s had a capacity of 30 MBytes per each working surface. At the same time, a well known in America magazine rifle of O. Winchester had a caliber equal to 0.30; maybe the first winchester was rumbling as a submachine gun, or it smelled like gunpowder, I don't know, but since that time hard discs were called winchesters.

Failures during the operation of a computer, viruses, power supply hold-ups, program errors - all these things can damage the data stored on your hard disc. But it doesn't always mean losses of data, that is why it is useful to know how data are kept on your hard disc so that you can restore them. For example, in case of damage of the boot area by a virus, it isn't necessary to format the whole disc (!), you can restore just the damaged part and continue working with all your precious data.

On the on hand, my aim is to tell you:

  1. about principles of data recording on a hard disc;
  2. about placing and booting of an operating system;
  3. how to partition your hard disc in order to use several operating systems.

On the other hand, I want to make you ready for the second part of my article where I will tell you about programs called boot managers. To understand how these programs operate you are to have basic knowledge in such things as MBR, Partitions etc.

2. Hard disc layout

A ÍDD (Hard Disk Drive) has the following arrangement of its components: on a spindle connected with an electric motor there is a block of several platters above the surfaces of which there are heads for reading/writing information. The heads have a form of a wing. During the operation they are "flying" above the discs' surfaces in an air flow created due to rotation of these discs. It is obvious that a lifting force depends on the air pressure on the heads, which, in its turn, depends on the atmosphere pressure. That is why some manufactures specify the ceiling of exploitation, for example, 3,000 m. A platter is divided into tracks which consist of sectors. Two tracks equidistant from the center and located on different sides of a platter make a cylinder.

3. Data storage

A hard disc, like any other block device, stores information in fixed portions called blocks. A block is the least data portion with its own unique address on a hard disc. In order to read or to record the required data into the required place it is necessary to set a block's address as a parameter of an operation given to a controller of a hard disc. A block's size is standard for all hard discs for a long time already - 512 bytes.

Unfortunately, users often mix up such concepts as "sector", "cluster" and "block". In fact there is practically no difference between a block and a sector. One is a logic concept, the other is topologic. A cluster is several sectors considered as a single whole by an operating system. Why is a simple work with sectors unsatisfactory? Clusters appeared because the FAT table' size is limited, and a disc was growing in its size. In case of the FAT16 for a 512 MBytes disc a cluster measures 8 KBytes, up to 1 GBytes - 16 KBytes, up to 2 GBytes - 32 KBytes etc.

To specify a block address uniquely it is necessary to give all three parameters (a number of a cylinder, a number of a sector on a track and a number of a head). Such an addressing way is widely adopted and called CHS (cylinder, head, sector). Exactly this method was first realized in the BIOS, that is why later it got some restrictions. The matter was that the BIOS operated maximum with 63 sectors, 1024 cylinders and 255 heads. But hard discs at that time had no more than 16 heads because of a complexity of the production. That is why the maximum capacity of a HDD available for addressing was 1024*16*63*512 = 504 MBytes.

With time manufacturers started production of HDDs of a larger size. The number of cylinders exceeded 1024, the maximum acceptable number from the standpoint of old BIOS'es. But the addressed part of the discs was still equal to 504 MBytes provided that it was addressed by means of the BIOS. That restriction was taken off with time by establishment of a so called mechanism of address translation (a bit later on it).

Problems caused by the finiteness of the BIOS, as far as a physical geometry of discs is concerned, brought about a new method of addressing of blocks on a disc. The method is quite simple. Blocks on a disc are defined by one parameter - an LBA (logical block addressing). An LBA is connected with its CHS address:

lba = (cyl*HEADS + head)*SECTORS + (sector-1);

The logical addressing in controllers of hard discs gave a possibility to BIOS'es to realize address translation. The idea of the method is the following: with increasing of the HEADS parameter in the formula above the number of cylinders might be lower in order to address the same number of blocks. But then it is necessary to use more heads. And this was convenient since the heads used were only 16 out of 255. That is why BIOS'es started "converting" surplus cylinders into heads. It allowed to use the digit capacity of heads entirely. So, the disc space for the BIOS became equal to 8 GBytes.

Now I should speak a bit about the Large Mode. This mode is intended for hard discs up to 1 GBytes. In the Large Mode the number of logic heads is increased up to 32, and the number of logical cylinders is halved. Addressing to logical heads 0..F is translated into even physical cylinders, and addressing to heads 10..1F - into odd ones. A hard disc partitioned in the LBA mode is incompatible with the Large mode, and vice versa.

The further increase of the addressed disc space was impossible with usage of previous BIOS services, since all parameters are enabled entirely (63 sectors, 1024 cylinders and 255 heads). So, a new extended BIOS interface was developed in order to allow for very big block addresses. But this interface was incompatible with the previous one, and old operating systems, such as DOS, which used old BIOS interfaces, couldn't exceed 8 GBytes. Practically all modern systems do not now use the BIOS, they are utilizing their own drivers for working with discs. But note that before using their own drivers the systems first have to load them. That is why at the initial stage any system uses BIOS. It brings about restrictions for placing many systems beyond 8 GBytes, since they can't boot from there, but they do read and write data (for example, the DOS which works with a disc via the BIOS).

4. Partitions

Now we will look at how operating systems are placed on hard discs. For this purpose a disc address space of blocks is divided into partitions. Partitions are similar to a whole disc in the fact that they consist of adjacent block. So, for description of a partition it is necessary to specify the beginning of a partition and its length in blocks. A hard disc can contain 4 primary partitions.

During booting of a computer, the BIOS loads the first sector of a head partition (a boot sector) according to the address 0000h:7C00h and delivers the control to it. In the beginning of this sector there is a boot code which reads the partition table and defines an active partition. And then the sequence of operations repeats. I.e. it loads a boot sector of this partition according to the same address and passes over the control.

Partitions contain a file system which is a system of block marking for file storage. After creation of a file system on a partition and after files of an operating system are placed here, the partition becomes a boot one. A boot partition has in its first block a small program for booting of an operating system. But for booting of a definite system it is necessary to start its boot program from the first block. A bit later I will tell you about it in depth.

Partitions with file systems mustn't overlap, because different file systems have a different idea on how files are to be placed, but when files are put on the same physical disc space, the file systems conflict. But a conflict arises not at once, and only after placing files where partitions overlap.

Overlapping of partitions is not dangerous. You should only prevent placing several file systems on crossed partitions. Partitioning doesn't mean creation of file systems. But an attempt to create an empty file system (i.e. formatting) on one of overlapping partitions can cause errors in a file system of another partition. All I have said concerns all operating systems, and not the most popular ones.

A disc is partitioned on a program level. I.e. you can created an arbitrary configuration of partitions. Information on a disc partitioning is kept in the first block of a hard disc called the Master Boot Record (MBR)).

5. MBR

The MBR is the main means of booting from a hard disc supported by the BIOS. Let's look at the contents of the boot area:

Everything that is located at the address 01BEh-01FDh is called a partition table. It has 4 partitions. But only one of them can be marked as active, it means that a boot program must load into the memory the first sector of exactly this partition and deliver the control to it. The last two bytes of the MBR must contain a figure 0xAA55. According to this signature the BIOS checks whether the first block was loaded successfully. This signature allows to define whether all lines of data can transfer both zeros and ones.

The boot program looks through a partition table, chooses an active partition, loads its first block and delivers the control to it.

Let's look at a partition descriptor:

Offset Description
initial booting marker
sector and cylinder
system description
sector and cylinder
sectors' offset
number of sectors in a partition

* 0001h-0003h beginning of the partition
** 0005h-0007h end of the partition

From the disc partitions' standstill the most popular operating system is MS-DOS. It takes two of four partitions for its own use: Primary DOS partition, Extended DOS partition. The former is a usual DOS disc C:. The second one is a container of logical discs. They are located there as a chain of subpartitions called D:, E:, ... Logical discs can have file systems different from the DOS. But as a rule, foreign file systems are connected with the presence of another operating system. It should be placed in its own partition (not the extended DOS), but the partition table is too small for it.

Another important thing to be noted is that when the DOS is installed on a blank hard disc, you have no alternative in choosing OSs for booting. That is why a boot code looks simple, it doesn't need to ask a user what system he wants to boot. If you want to have several operating systems, then you need a program allowing to choose a system for booting.

6. Conclusion

I hope the information given here on the layout of a hard disc, MBR and PT is clear for you. And it will be enough for a petty repair of your data storage device. The next article will deal with programs called Boot Managers and principles of their operation.

Write a comment below. No registration needed!

Article navigation:

blog comments powered by Disqus

  Most Popular Reviews More    RSS  

AMD Phenom II X4 955, Phenom II X4 960T, Phenom II X6 1075T, and Intel Pentium G2120, Core i3-3220, Core i5-3330 Processors

Comparing old, cheap solutions from AMD with new, budget offerings from Intel.
February 1, 2013 · Processor Roundups

Inno3D GeForce GTX 670 iChill, Inno3D GeForce GTX 660 Ti Graphics Cards

A couple of mid-range adapters with original cooling systems.
January 30, 2013 · Video cards: NVIDIA GPUs

Creative Sound Blaster X-Fi Surround 5.1

An external X-Fi solution in tests.
September 9, 2008 · Sound Cards

AMD FX-8350 Processor

The first worthwhile Piledriver CPU.
September 11, 2012 · Processors: AMD

Consumed Power, Energy Consumption: Ivy Bridge vs. Sandy Bridge

Trying out the new method.
September 18, 2012 · Processors: Intel
  Latest Reviews More    RSS  

i3DSpeed, September 2013

Retested all graphics cards with the new drivers.
Oct 18, 2013 · 3Digests

i3DSpeed, August 2013

Added new benchmarks: BioShock Infinite and Metro: Last Light.
Sep 06, 2013 · 3Digests

i3DSpeed, July 2013

Added the test results of NVIDIA GeForce GTX 760 and AMD Radeon HD 7730.
Aug 05, 2013 · 3Digests

Gainward GeForce GTX 650 Ti BOOST 2GB Golden Sample Graphics Card

An excellent hybrid of GeForce GTX 650 Ti and GeForce GTX 660.
Jun 24, 2013 · Video cards: NVIDIA GPUs

i3DSpeed, May 2013

Added the test results of NVIDIA GeForce GTX 770/780.
Jun 03, 2013 · 3Digests
  Latest News More    RSS  

Platform  ·  Video  ·  Multimedia  ·  Mobile  ·  Other  ||  About us & Privacy policy  ·  Twitter  ·  Facebook

Copyright © Byrds Research & Publishing, Ltd., 1997–2011. All rights reserved.