Saturday, May 26, 2012

HARD DISK DRIVE and WORKING


A hard disk drive (HDD; also hard drive, hard disk, or disk drive) is a device for storing and retrieving digital information, primarily computer data. It consists of one or more rigid (hence "hard") rapidly rotating discs (platters) coated with magnetic material, and with magnetic heads arranged to write data to the surfaces and read it from them.
Hard drives are classified as non-volatile, random access, digital, magnetic, data storage devices. Introduced by IBM in 1956, hard disk drives have decreased in cost and physical size over the years while dramatically increasing in capacity and speed. Hard disk drives have been the dominant device for secondary storage of data in general purpose computers since the early 1960s. They have maintained this position because advances in their recording capacity, cost, reliability, and speed have kept pace with the requirements for secondary storage. 
They were originally called "fixed disks" or "Winchesters" (a code name used for a popular IBM product). They later became known as "hard disks" to distinguish them from "floppy disks."
At the simplest level, a hard disk is not that different from a cassette tape. Both hard disks and cassette tapes use the same magnetic recording techniques. Hard disks and cassette tapes also share the major benefits of magnetic storage -- the magnetic medium can be easily erased and rewritten, and it will "remember" the magnetic flux patterns stored onto the medium for many years.

RECORDING IN A HARD DRIVE:

A hard disk drive records data by magnetizing a thin film of ferromagnetic material on a disk. User data is encoded into a run-length limited code and the encoded data written as a pattern of sequential magnetic transitions on the disk. The data is represented by the time between transitions. The self-clocking nature of the run-length limited codes used enables the clocking of the data during reads. The data is read from the disk by detecting the transitions and then decoding the written run-length limited data back to the user data.
A typical HDD design consists of a spindle that holds flat circular disks, also called platters, which hold the recorded data. The platters are made from a non-magnetic material, usually aluminium alloy, glass, or ceramic, and are coated with a shallow layer of magnetic material typically 10–20 nm in depth, with an outer layer of carbon for protection. For reference, a standard piece of copy paper is 0.07–0.18 millimetre (70,000–180,000 nm).
The platters in contemporary HDDs are spun at speeds varying from 4,200 rpm in energy-efficient portable devices, to 15,000 rpm for high performance servers. The first hard drives spun at 1,200 rpm and, for many years, 3,600 rpm was the norm. Information is written to and read from a platter as it rotates past devices called read-and-write heads that operate very close (tens of nanometres in new drives) over the magnetic surface. The read-and-write head is used to detect and modify the magnetization of the material immediately under it. In modern drives there is one head for each magnetic platter surface on the spindle, mounted on a common arm. An actuator arm (or access arm) moves the heads on an arc (roughly radially) across the platters as they spin, allowing each head to access almost the entire surface of the platter as it spins. The arm is moved using a voice coil actuator or in some older designs a stepper motor.
The magnetic surface of each platter is conceptually divided into many small sub-micrometre-sized magnetic regions referred to as magnetic domains. In older disk designs the regions were oriented horizontally and parallel to the disk surface, but beginning about 2005, the orientation was changed to perpendicular to allow for closer magnetic domain spacing. Due to the polycrystalline nature of the magnetic material each of these magnetic regions is composed of a few hundred magnetic grains. Magnetic grains are typically 10 nm in size and each form a single magnetic domain. Each magnetic region in total forms a magnetic dipole which generates a magnetic field.
For reliable storage of data, the recording material needs to resist self-demagnetization, which occurs when the magnetic domains repel each other. Magnetic domains written too densely together to a weakly magnetizable material will degrade over time due to physical rotation of one or more domains to cancel out these forces. The domains rotate sideways to a halfway position that weakens the readability of the domain and relieves the magnetic stresses. Older hard disks used Iron (III) oxide as the magnetic material, but current disks use a cobalt-based alloy.
A write head magnetizes a region by generating a strong local magnetic field. Early HDDs used an electromagnet both to magnetize the region and to then read its magnetic field by using electromagnetic induction. Later versions of inductive heads included metal in Gap (MIG) heads and thin film heads. As data density increased, read heads using magneto-resistance (MR) came into use; the electrical resistance of the head changed according to the strength of the magnetism from the platter. Later development made use of spintronics; in these heads, the magneto-resistive effect was much greater than in earlier types, and was dubbed "giant" magneto-resistance (GMR). In today's heads, the read and write elements are separate, but in close proximity, on the head portion of an actuator arm. The read element is typically magneto-resistive while the write element is typically thin-film inductive.
The heads are kept from contacting the platter surface by the air that is extremely close to the platter; that air moves at or near the platter speed. The record and playback head are mounted on a block called a slider, and the surface next to the platter is shaped to keep it just barely out of contact. This forms a type of air bearing.
In modern drives, the small size of the magnetic regions creates the danger that their magnetic state might be lost because of thermal effects. To counter this, the platters are coated with two parallel magnetic layers, separated by a 3-atom layer of the non-magnetic element ruthenium, and the two layers are magnetized in opposite orientation, thus reinforcing each other. Another technology used to overcome thermal effects to allow greater recording densities is perpendicular recording, first shipped in 2005, and as of 2007 the technology was used in many HDDs. 




HDLC Protocol

HDLC [High-level Data Link Control] is a group of protocols for transmitting [synchronous] data [Packets] between [Point-to-Point] nodes.In HDLC, data is organized into a frame.HDLC protocol resides with Layer 2 of the OSI model, the data link layer.HDLC uses zero insertion/deletion process [bit stuffing] to ensure that the bit pattern of the delimiter flag does not occur in the fields between flags.The HDLC frame is synchronous and therefore relies on the physical layer to provide method of clocking and synchronizing the transmission and reception of frames.

General HDLC Frame

Opening Flag, 8 bits [01111110], [7E Hex]
Address, 8 bits [ could be more]
Control, 8 bits, or 16 bits
Data [Payload], Variable, not used in some frames, or may be padded to complete the fill
CRC, 16 bits, or 32 bits
Closing Flag, 8 bits [01111110], [7E hex]

User data which contains 7E is resolved using an escape sequence which converts 7E to 7D-5E [with 7D being the escape character].If 7D is used in the data stream it again is converted into 7D-5D. Address 11111111 is known as all stations, 00000000 is this station.Frames may be aborted by sending an abort sequence [01111111] instead of the normal flag sequence [01111110].An abort sequence will cause the frame to be discarded.
During idle times when no frames are being transmitted idle flags [11111111] may be sent to fill the area between frames.A continuous series of flags [01111110] may be sent to fill the area between frames instead of sending idle flags [11111111].


Fill Between Frames

HDLC Opening Flag
8 bits [01111110], [7E hex]
The Opening flag may be preceded by additional flags [01111110] or idle flags [11111111], both used as inter-frame fill.
       
HDLC Address Field

HDLC Address Field
The length of the address field depends on the data link layer protocol used, but is normally 0, 8 or 16 bits in length. In many cases the address field is typically just a single byte, but an Extended Address [EA] bit may be used allowing for multi-byte addresses. A one residing in the LSB bit indicates [the end of the field] that the length of the address field will be 8 bits long. A zero in this bit location [now the first byte of a multi-byte field] indicates the continuation of the field [adding 8 additional bits]. The SDLC protocol will use only an 8 bit address.The SS7 protocol, which is used in point-to-point links, does not use an address field at all.The first [MSB] bit in the Address field indicates if the frame is a unicast or multicast message.A zero in the MSB bit location indicates a unicast message; the remaining bits indicate the destination node address.A one in the MSB bit location indicates multicast message, the remaining bits indicate the group address.

HDLC Control Field
The Control field is 8 or 16 bits and defines the frame type; Control or Data. The Control field is protocol dependent.
HDLC Data Field
The Data field may vary in length depending upon the protocol using the frame. Layer 3 frames are carried in the data field.
HDLC FCS Field
FCS [16 bits] = X16 + X12 + X5 + 1
FCS [32 bits] = X32 + X26 + X23 + X22 + X16 + X12 + X11 + X10 + X8 + X7 + X5 + X4 + X2 + X + 1
Frame Encapsulation:
A few different versions of the HDLC frame are shown below.These include the PPP [Point-to-Point Protocol] HDLC frame, and the Ethernet HDLC frame.


Ethernet HDLC Frame Encapsulation

Ethernet Frame Encapsulation:
The Preamble [a specific bit pattern] Informs the receiving station that a new packet is arriving and synchronizes the receive clock with the transmitted clock. Used in Ethernet, not HDLC.

The Address Field consists of a Source Address and/or a Destination Address. The Source and Destination Addresses identify the sender [Source] and receiver [Destination]. The Source Address is used to identify to the network that's sending data. The Destination Address is used to identify who should be receiving the data. Some protocols may only have one address.

The Control Field indicates the type of Information that is being sent as Data. It identifies the purpose of the packet as Data or Control information, and may also indicate the size of the packet and Data.

The Data Field is the actual information being transmitted. It can contain Control Information for handshaking, or actual Data used by applications.

The CRC [Cyclic Redundancy Checking] or FCS [Frame Check Sequence] contains an error checking number that the Destination can use to verify that the packet is error free.

The End Frame Delimiter has a specific bit pattern. This bit pattern identifies the end of the packet to the Destination. Protocols with fixed packet size may not require an End Frame Delimiter.

For some physical interfaces [SDH or SONET] after the data as been encapsulated into the frame it must still be scrambled before being sent to the physical layer [from the Link layer].



Point-to-Point Protocol HDLC Frame Encapsulation

Point-to-Point Protocol Frame Encapsulation:
Point-to-Point Protocol [PPP] is used in transporting multi-protocol datagrams over point-to-point links. PPP is capable of operating on many DTE/DCE interfaces (such as, RS-232CRS-422RS-423 or V.35). PPP is used with full-duplex circuits [dedicated or circuit-switched] operating in either an asynchronous (start/stop), bit-synchronous, or octet-synchronous mode, transparent to PPP Data Link Layer frames. PPP does not require the use of control signals, such as Request To Send (RTS), Clear To Send (CTS), Data Carrier Detect (DCD), and Data Terminal Ready (DTR). For asynchronous links, inter-octet and inter-frame time fill MUST be accomplished by transmitting continuous "1" bits.