Vocademy

Part 11: Mass Storage

Magnetic Disks

The most-used mass storage system is the magnetic disk. A hard disk is made of aluminum, glass, or some other non-magnetic material and is covered with a magnetic coating much like that used for recording tape. Data is stored by magnetizing spots on the disk (referred to as magnetic domains).

Data is recorded as the disk spins and the read/write head or heads move along the disk from the edge to the center. The heads can only move from the edge to the center; the disk can only rotate under the heads. The heads pinch the disk like a pair of tweezers.

Each face of a disk has data recorded on it, with data laid out in concentric tracks. The data is divided into pie-slice-shaped areas called sectors. A sector is also the data on a particular track within a sector.

Data is laid out in concentric tracks called cylinders. The data is divided into pie-slice-shaped areas called sectors (pink). A sector is also the data on a particular cylinder within a sector.

In IBM terminology, a disk side is called a head, and a track is called a cylinder. Head and side, as well as cylinder and track, are used interchangeably.

Heads and cylinders are numbered starting with 0, but sectors are numbered starting with 1. In virtually every discipline of computer science, numbering starts with 0. There is no documented reason why disk drive sectors are numbered starting with 1.[1] 

The Atari 8-bit computer did not use a cylinder, head, sector nomenclature for accessing the disk drive but numbered all the sectors sequentially. The engineers developing the operating system used the tradition of numbering sectors from 1. However, the engineers developing the floppy disk hardware and those developing the BIOS (the system ROM in Atari terminology) didn’t get the memo and numbered the sectors from 0. This resulted in sector zero existing but unaccessible by the operating system. Since the operating system’s copy-disk command didn’t copy sector 0, some software developers put key data in sector 0 to prevent unauthorized copying. This copy protection scheme was easily defeated as copying sector 0 using the BIOS was trivial.

The first sector (head 0, cylinder 0, sector 1) is called the boot sector and contains the Master Boot Record (MBR). On hard disks, the MBR contains a table that lists how the disk is partitioned called the partition table. The entire first cylinder (cylinder 0) is unused on hard disks except for sector 1.

When a computer starts, it searches for a disk drive and loads the boot sector from the first disk it can read. Control is turned over to the program in the boot sector. A typical floppy disk has a short program in the boot sector that prints a message indicating that the disk is not bootable. However, the core programming of MS-DOS, DR-DOS, and FreeDOS can fit onto a floppy disk. Therefore, a floppy disk can boot into DOS. In that case, the program in the boot sector loads the necessary DOS system files into memory[2] and turns control over to the command interpreter. In the case of Windows or Linux, the boot sector of the first hard disk continues the boot process, loading the operating system into memory.

When floppy drives were common, users often left a floppy disk in the drive when they turned off the computer at the end of the work day. When they turned on the computer the next day, it would find this floppy disk first and load its boot sector. The boot sector program would print something like “Non-system disk or disk error” and quit. To prevent support calls only to tell users to remove the floppy disk and restart the computer, technicians often configured the computer to try the first hard disk before trying the floppy disk when starting.

Data is organized in concentric tracks on the face of the disk. Each track is divided into sectors. On the PC, each sector holds 512 data bytes (other bytes hold auxiliary information). At the lowest level, the OS will get data from the disk or put data on the disk on a sector-by-sector basis. At the user level, data is organized in files. This will be covered in Operating Systems under File Systems.

Advanced format

As of 2011, hard disks are typically formatted with 4096-byte sectors. With larger sectors, there are fewer sectors on the disk. This reduces the total overhead (bytes identifying the sector, etc.).

Disks using the advanced format can use a mode called 512e. This compatibility mode works with hardware and operating systems that can’t handle 4,096-byte sectors. However, this lowers performance during write operations because the entire 4096-byte sector is read, modified, and then written back to the drive. This may require an extra turn of the disk.

Hard drive performance

Note: this the following is in outline format and will be fleshed out later

RPM and cache size greatly affect performance

5400 RPM is slowest

Low-end drives
Economical and "environmentally friendly" drives
USB external drives
Most laptop drives

7200 RPM

Standard performance

10,000 RPM

High performance for servers and graphic workstations

Cache

Most drives have a RAM cache. Frequently accessed data is held in the cache to improve performance.

Cache sizes range from 2 MB to 512 MB. Always get the most you can afford. Anything less than 16 MB will have poor performance.

—————————
1An Internet search only fings dubious explanations.
2With early versions of MS-DOS the system files (IO.SYS and MSDOS.SYS) had to be in fixed sectors on the disk.
Vocademy