The hard disk is the workhorse of a modern computer. It is where virtually all data is permanently stored, and it is also where much temporary data is kept when not in RAM. Each year the capacity goes up and the cost comes down, making disk drives still the best place to store code and documents.
Floppy disks, also called diskettes, work along the same principles as hard disks, so we will only discuss hard disks in this chapter. The terminology refers to the flexibility of the magnetic medium used. Floppy disks are just pieces of Mylar plastic coated with an iron-based "paint" that can be magnetized, while hard disks use the surface of a non-flexible platter as the base for their "paint." Floppies started out huge, 8 inches in diameter, and were originally designed only for IBM field diagnostics. Minicomputers of the early 1980s still used 8" floppies. Then 5.25" diameter floppies were made and used in most microcomputers until the late 1980s when they were supplanted by the now current 3.5" diameter floppies. The current 3.5" diskettes really don't seem floppy any more because the round Mylar surface is hidden in a hard plastic case that only the computer can open, whereas the older diskettes were kept in a sleeve and manually taken out of the sleeve by a human before being inserted into a disk drive.
Let's discuss how data is laid out on hard disks. Fig. 17.2.1 shows the basic setup from several angles.
There are one or more platters in a hard disk, each platter being a non-flexible disk that is coated with the iron-containing "paint" mentioned above. Oftentimes the platters are coated on both sides in order to double the storage capacity.
Read-write heads are suspended above the platters' surfaces, riding on a micro-thin cushion of air that is generated when the platter spins at enormous rates, usually 3000 to 7000 rpm (revolutions per minute). These read-write heads contain wires that are coiled into a tiny electromagnet at the tip.
When a current is passed through the coil, a small magnetic field is momentarily created which realigns the iron molecules in the coating into one direction in a small region, thereby "writing" a 1 or a 0 onto the platter in that place.
The coil in the read-write head can also be used to sense the presence of a magnetic field oriented in a certain direction. When a wire is moved through a magnetic field, as Faraday discovered 160 years ago, a current is generated in the wire. Thus, moving the coil of the read-write head over a magnetized region will cause a current to flow in the coil wire, which can be sensed by the electronics, making it possible for the computer to "read" the 1 or 0 that is stored on the platter in that small region.
In order to squeeze millions of bits onto the platter's surface, the read-write head slides back and forth across the platter's surface, very much like the tone arm of an old record player or the laser beam of a modern music CD player. Data bits are stored in concentric tracks that are logically formed on the surface of the platter when the read/write head is stationary. To jump to the next track, a small electric motor called the stepper motor is turned on briefly. The clicking sound that you hear from your hard disk when it is reading or writing files is the stepper motor turning on and off.
Fig. 17.2.4: Stepper motor and tracks on the platter surface
In most disk drives, there is one read-write head per surface, and all heads are attached to the same assembly and the same stepper motor. Thus, if one head moves to track 37, all the others will too. This isn't an inconvenience, since a disk drive can usually respond to only one read/write command at any given time. Refer back to Fig. 17.2.1 to see the multiple head assembly that is common today.
Bits are stored in the tracks as though each track were one long ribbon of magnetic tape. However, because each track usually holds a vast number of bits, the system breaks each track into a number of logical sectors, which are pie shaped wedges of the tracks. There is a small gap between each sector that is not used for data.
When a disk drive stores data, it always reads or writes one complete sector. It is too difficult to align the read/write head at an arbitrary bit position when it is spinning so fast. If the read-write head were between bit positions when the electronics started to read the bits, the wrong values would be sensed. So the disk drive waits until it senses the dead space between sectors before it starts to read or write. It then continues, reading or writing all the bits in that sector. Many disk drives today store 512 bytes (or 0.5K) per sector.