Logical block addressing
From Wikipedia, the free encyclopedia
Logical block addressing (LBA) is a common scheme used for specifying the location of blocks of data stored on computer storage devices, generally secondary storage systems such as hard disks. The term LBA can mean either the address or the block to which it refers. Logical blocks in modern computer systems are typically 512 or 1024 bytes each. ISO 9660 CDs (and images of them) use 2048-byte blocks.
Contents |
[edit] The LBA scheme
LBA is a particularly simple addressing scheme; blocks are located by an index, with the first block being LBA=0, the second LBA=1, and so on. The LBA scheme replaces earlier schemes which exposed the physical details of the storage device to the software of the operating system. Chief among these was the cylinder-head-sector (CHS) scheme, where blocks were addressed by means of a tuple which defined the cylinder, head, and sector at which they appeared on the hard disk. CHS didn't map well to devices other than hard disks (such as tapes and networked storage), and was generally not used for them. CHS was used in early MFM and RLL drives, and both it and its successor Extended Cylinder-Head-Sector (ECHS) were used in the first ATA drives.
SCSI introduced LBA as an abstraction. While the drive controller still addresses data blocks by their CHS address, this information is generally not used by the SCSI device driver, the OS, filesystem code, or any applications (such as databases) that access the "raw" disk. System calls requiring block-level I/O pass LBA definitions to the storage device driver; for simple cases (where one volume maps to one physical drive), this LBA is then passed directly to the drive controller.
[edit] LBA mapping and LUN virtualization
For more complex cases (particularly RAID devices and SANs and where logical drives (LUNs) are composed via LUN virtualization and aggregation), LBAs are translated from the application's model of the disk to that used by the actual storage device. In complex deployments, particularly when a storage fabric is employed, several of these LBA translations may occur between the dispatching application and the final, remote, disk.
[edit] LBA to CHS mapping
LBA addresses can be mapped onto CHS tuples using the following formulas:
c = lba / (num_heads*num_sectors); h = (lba % (num_heads*num_sectors)) / num_sectors; s = (lba % (num_heads*num_sectors))%num_sectors + 1;
Where lba is the input logical address, num_heads and num_sectors are the total number of heads of the disk and sectors by track respectively, / is the integer division operator and % is the modulus operator.
[edit] LBA, ATA devices and Enhanced BIOS
The first formal definition of the ATA interface inherited the CHS scheme from earlier drive standards. This proved to be a limiting factor as ATA drives grew. Originally cylinder, head, and sector were limited to 1024, 16, and 63 respectively. Later, more advanced BIOS implementations (known sometimes as Enhanced BIOS) that virtualised the CHS mapping (often generating many more "virtual" drive heads than the physical disk really possessed) expanded this limit to 1024, 255, and 63. This meant an MS-DOS volume (and a Windows NT 4.0 system partition) was limited to 7.8 GiB.
The second ATA standard (ATA-2) introduced an LBA mode of operation, which has subsequently become the most commonly used scheme when communicating with ATA drives and their technical successors. LBA addresses in ATA can be 28-bit or 48-bit (introduced in ATA-6) wide, which results in a disk size limit of 128 GiB or 128 PiB, respectively, assuming the common 512 bytes per sector.
[edit] Operating Systems with LBA dependencies
Some operating systems do not require LBA because they simply distrust and ignore the geometry reported by BIOS. Among these operating systems are BSD, Linux, Mac OS X, OS/2 and ReactOS. Operating systems that are sensitive to BIOS-reported geometry include DOS, Windows NT kernel (NT, 2000, XP, Vista) and Solaris.
[edit] External links
- LBAs explained
- LBA and CHS format, LBA mapping
- Microsoft article on 7.8GB limit on NT 4.0
- 48bitLBA.com Source for 48-bit LBA Information
- Hard Drive Size Limitations and Barriers