Logical block addressing (LBA) is a common scheme used for specifying the location of
blocks of data stored on
computer storage
Computer data storage is a technology consisting of computer components and recording media that are used to retain digital data. It is a core function and fundamental component of computers.
The central processing unit (CPU) of a compute ...
devices, generally
secondary storage
Computer data storage is a technology consisting of computer components and recording media that are used to retain digital data. It is a core function and fundamental component of computers.
The central processing unit (CPU) of a computer ...
systems such as
hard disk drive
A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device that stores and retrieves digital data using magnetic storage with one or more rigid rapidly rotating platters coated with magnet ...
s. LBA is a particularly simple
linear addressing
Flat memory model or linear memory model refers to a memory addressing paradigm in which "memory appears to the program as a single contiguous address space." The CPU can directly (and linearly) address all of the available memory locations witho ...
scheme; blocks are located by an integer index, with the first block being LBA 0, the second LBA 1, and so on.
The
IDE standard included 22-bit LBA as an option, which was further extended to 28-bit with the release of ATA-1 (1994) and to 48-bit with the release of ATA-6 (2003), whereas the size of entries in on-disk and in-memory data structures holding the address is typically 32 or 64 bits. Most hard disk drives released after 1996 implement logical block addressing.
Overview
In logical block addressing, only one number is used to address data, and each linear base address describes a single block.
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
Cylinder-head-sector (CHS) is an early method for giving addresses to each physical block of data on a hard disk drive.
It is a 3D-coordinate system made out of a vertical coordinate ''head'', a horizontal (or radial) coordinate ''cylinder'', an ...
(CHS) scheme, where blocks were addressed by means of a
tuple
In mathematics, a tuple is a finite ordered list (sequence) of elements. An -tuple is a sequence (or ordered list) of elements, where is a non-negative integer. There is only one 0-tuple, referred to as ''the empty tuple''. An -tuple is defi ...
which defined the cylinder, head, and sector at which they appeared on the
hard disk
A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device that stores and retrieves digital data using magnetic storage with one or more rigid rapidly rotating platters coated with magnet ...
. CHS did not 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. However, current disk drives use
zone bit recording In computer storage, zone bit recording (ZBR) is a method used by disk drives to optimise the tracks for increased data capacity. It does this by placing more sectors per zone on outer tracks than on inner tracks. This contrasts with other approach ...
, where the number of sectors per track depends on the track number. Even though the disk drive will report some CHS values as sectors per track (SPT) and heads per cylinder (HPC), they have little to do with the disk drive's true geometry.
LBA was first introduced in
SCSI
Small Computer System Interface (SCSI, ) is a set of standards for physically connecting and transferring data between computers and peripheral devices. The SCSI standards define commands, protocols, electrical, optical and logical interface ...
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.
In
redundant array of independent disks
Raid, RAID or Raids may refer to:
Attack
* Raid (military), a sudden attack behind the enemy's lines without the intention of holding ground
* Corporate raid, a type of hostile takeover in business
* Panty raid, a prankish raid by male college ...
(RAID) devices and
storage area network
A storage area network (SAN) or storage network is a computer network which provides access to consolidated, block-level data storage. SANs are primarily used to access data storage devices, such as disk arrays and tape libraries from serve ...
s (SANs) and where logical drives (
logical unit number
In computer storage, a logical unit number, or LUN, is a number used to identify a logical unit, which is a device addressed by the SCSI protocol or by Storage Area Network protocols that encapsulate SCSI, such as Fibre Channel or iSCSI.
A LUN m ...
s, LUNs) are composed via LUN virtualization and aggregation, LBA addressing of individual disk should be translated by a software layer to provide uniform LBA addressing for the entire storage device.
Enhanced BIOS
The earlier IDE standard from Western Digital introduced 22-bit LBA; in 1994, the
ATA-1 standard allowed for 28 bit addresses in both LBA and CHS modes. The CHS scheme used 16 bits for cylinder, 4 bits for head and 8 bits for sector, counting sectors from 1 to 255. This means the reported number of heads never exceeds 16 (0–15), the number of sectors can be 255 (1–255; though 63 is often the largest used) and the number of cylinders can be as large as 65,536 (0–65535), limiting disk size to 128 GiB (≈137.4 GB), assuming 512 byte sectors. These values can be accessed by issuing the ATA command "Identify Device" (
EC
h) to the drive.
However, the
IBM BIOS
In computing, BIOS (, ; Basic Input/Output System, also known as the System BIOS, ROM BIOS, BIOS ROM or PC BIOS) is firmware used to provide runtime services for operating systems and programs and to perform hardware initialization during the b ...
implementation defined in the
INT 13h
INT 13h is shorthand for BIOS interrupt call 13 hex, the 20th interrupt vector in an x86-based (IBM PC-descended) computer system. The BIOS typically sets up a real mode interrupt handler at this vector that provides sector-based hard disk an ...
disk access routines used quite a different 24-bit scheme for CHS addressing, with 10 bits for cylinder, 8 bits for head, and 6 bits for sector, or 1024 cylinders, 256 heads, and 63 sectors. This INT 13h implementation had pre-dated the ATA standard, as it was introduced when the
IBM PC
The IBM Personal Computer (model 5150, commonly known as the IBM PC) is the first microcomputer released in the IBM PC model line and the basis for the IBM PC compatible de facto standard. Released on August 12, 1981, it was created by a team ...
had only
floppy disk
A floppy disk or floppy diskette (casually referred to as a floppy, or a diskette) is an obsolescent type of disk storage composed of a thin and flexible disk of a magnetic storage medium in a square or nearly square plastic enclosure lined w ...
storage, and when hard disk drives were introduced on the
IBM PC/XT
The IBM Personal Computer XT (model 5160, often shortened to PC/XT) is the second computer in the IBM Personal Computer line, released on March 8, 1983. Except for the addition of a built-in hard drive and extra expansion slots, it is very simila ...
, INT 13h interface could not be practically redesigned due to
backward compatibility
Backward compatibility (sometimes known as backwards compatibility) is a property of an operating system, product, or technology that allows for interoperability with an older legacy system, or with input designed for such a system, especially i ...
issues. Overlapping ATA CHS mapping with BIOS CHS mapping produced the lowest common denominator of 10:4:6 bits, or 1024 cylinders, 16 heads, and 63 sectors, which gave the practical limit of 1024×16×63 sectors and 528MB (504
MiB
The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit ...
), assuming 512 byte sectors.
In order for the BIOS to overcome this limit and successfully work with larger hard drives, a CHS translation scheme had to be implemented in the BIOS disk I/O routines which would convert between 24-bit CHS used by INT 13h and 28-bit CHS numbering used by ATA. The translation scheme was called ''large'' or ''bit shift translation''. This method would remap 16:4:8 bit ATA cylinders and heads to 10:8:6 bit scheme used by INT 13h, generating much more "virtual" drive heads than the physical disk reported. This increased the practical limit to 1024×256×63 sectors, or 8.4GB (7.8
GiB
The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit ...
).
To further overcome this limit,
INT 13h Extensions
INT 13h is shorthand for BIOS interrupt call 13 hex, the 20th interrupt vector in an x86-based (IBM PC-descended) computer system. The BIOS typically sets up a real mode interrupt handler at this vector that provides sector-based hard disk and ...
were introduced with the ''
BIOS Enhanced Disk Drive Services
INT 13h is shorthand for BIOS interrupt call 13 hex, the 20th interrupt vector in an x86-based (IBM PC-descended) computer system. The BIOS typically sets up a real mode interrupt handler at this vector that provides sector-based hard disk an ...
'', which removed practical limits on disk size for operating systems which are aware of this new interface, such as the ''DOS 7.0'' component in
Windows 95
Windows 95 is a consumer-oriented operating system developed by Microsoft as part of its Windows 9x family of operating systems. The first operating system in the 9x family, it is the successor to Windows 3.1x, and was released to manufacturin ...
. This ''enhanced BIOS'' subsystem supports LBA addressing with ''LBA'' or ''
LBA-assisted'' method, which uses native 28-bit LBA for addressing ATA disks and performs CHS conversion as needed.
The ''normal'' or ''none'' method reverts to the earlier 10:4:6 bit CHS mode which does not support addressing more than 528MB.
![Installation of the Western Digital's EZ Drive, on a 3](https://upload.wikimedia.org/wikipedia/commons/a/a9/Installation_of_the_Western_Digital%27s_EZ_Drive%2C_on_a_3.5-inch_floppy_disk.jpg)
Until the release of ATA-2 standard in 1996, there were a handful of large hard drives which did not support LBA addressing, so only ''large'' or ''normal'' methods could be used. However, using the ''large'' method also introduced portability problems, as different BIOSes often used different and incompatible translation methods, and hard drives partitioned on a computer with a BIOS from a particular vendor often could not be read on a computer with a different make of BIOS. The solution was to use conversion software such as
OnTrack Disk Manager
Disk Manager is a discontinued software (that was a popular 1980s and 1990s) and documentation package for MS-DOS and PC DOS computers, useful for self-installing personal computer hard disks. It was written by Ontrack, a company that is now part ...
, Micro House EZ-Drive/EZ-BIOS, etc., which installed to the disk's
OS loader and replaced INT 13h routines at boot time with custom code. This software could also enable LBA and INT 13h Extensions support for older computers with non LBA-compliant BIOSes.
LBA-assisted translation
When the BIOS is configured to use a disk in LBA-assisted translation mode, the BIOS accesses the hardware using LBA mode, but also presents a translated CHS geometry via the INT 13h interface. The number of cylinders, heads, and sectors in the translated geometry depends on the total size of the disk, as shown in the following table.
LBA48
The current 48-bit LBA scheme was introduced in 2002 with the
ATA-6 standard, raising the addressing limit to 2× 512 bytes, which is exactly 128
PiB or approximately 144
PB. Current PC-compatible computers support INT 13h Extensions, which use 64-bit structures for LBA addressing and should encompass any future extension of LBA addressing, though modern operating systems implement direct disk access and do not use the
BIOS
In computing, BIOS (, ; Basic Input/Output System, also known as the System BIOS, ROM BIOS, BIOS ROM or PC BIOS) is firmware used to provide runtime services for operating systems and programs and to perform hardware initialization during the ...
subsystems, except at
boot load time. However, the common
DOS
DOS is shorthand for the MS-DOS and IBM PC DOS family of operating systems.
DOS may also refer to:
Computing
* Data over signalling (DoS), multiplexing data onto a signalling channel
* Denial-of-service attack (DoS), an attack on a communicatio ...
style
Master Boot Record
A master boot record (MBR) is a special type of boot sector at the very beginning of partitioned computer mass storage devices like fixed disks or removable drives intended for use with IBM PC-compatible systems and beyond. The concept of MBR ...
(MBR) partition table only supports
disk partition
Disk partitioning or disk slicing is the creation of one or more regions on secondary storage, so that each region can be managed separately. These regions are called partitions. It is typically the first step of preparing a newly installed disk ...
s up to 2TiB in size. For larger partitions this needs to be replaced by another scheme, for instance the
GUID Partition Table
The GUID Partition Table (GPT) is a standard for the layout of partition tables of a physical computer storage device, such as a hard disk drive or solid-state drive, using universally unique identifiers, which are also known as globally unique i ...
(GPT) which has the same 64-bit limit as the current INT 13h Extensions.
CHS conversion
In the LBA addressing scheme, sectors are numbered as integer indexes; when mapped to CHS (
cylinder-head-sector
Cylinder-head-sector (CHS) is an early method for giving addresses to each physical block of data on a hard disk drive.
It is a 3D-coordinate system made out of a vertical coordinate ''head'', a horizontal (or radial) coordinate ''cylinder'', an ...
)
tuple
In mathematics, a tuple is a finite ordered list (sequence) of elements. An -tuple is a sequence (or ordered list) of elements, where is a non-negative integer. There is only one 0-tuple, referred to as ''the empty tuple''. An -tuple is defi ...
s, LBA numbering starts with the first cylinder, first head, and track's first sector. Once the track is exhausted, numbering continues to the second head, while staying inside the first cylinder. Once all heads inside the first cylinder are exhausted, numbering continues from the second cylinder, etc. Thus, the lower the LBA value is, the closer the physical sector is to the hard drive's first (that is, outermost) cylinder.
CHS tuples can be mapped to LBA address with the following formula:
: ''LBA'' = (''C'' × ''HPC'' + ''H'') × ''SPT'' + (S − 1)
where
* ''C'', ''H'' and ''S'' are the cylinder number, the head number, and the sector number
* ''LBA'' is the logical block address
* ''HPC'' is the maximum number of heads per cylinder (reported by disk drive, typically 16 for 28-bit LBA)
* ''SPT'' is the maximum number of sectors per track (reported by disk drive, typically 63 for 28-bit LBA)
LBA addresses can be mapped to CHS tuples with the following formula ("mod" is the
modulo operation
In computing, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another (called the '' modulus'' of the operation).
Given two positive numbers and , modulo (often abbreviated as ) is th ...
, i.e. the
remainder
In mathematics, the remainder is the amount "left over" after performing some computation. In arithmetic, the remainder is the integer "left over" after dividing one integer by another to produce an integer quotient (integer division). In algebr ...
, and "÷" is
integer division
Division is one of the four basic operations of arithmetic, the ways that numbers are combined to make new numbers. The other operations are addition, subtraction, and multiplication.
At an elementary level the division of two natural numbers ...
, i.e. the
quotient
In arithmetic, a quotient (from lat, quotiens 'how many times', pronounced ) is a quantity produced by the division of two numbers. The quotient has widespread use throughout mathematics, and is commonly referred to as the integer part of a ...
of the division where any fractional part is discarded):
: ''C'' = ''LBA'' ÷ (''HPC'' × ''SPT'')
: ''H'' = (''LBA'' ÷ ''SPT'') mod ''HPC''
: ''S'' = (''LBA'' mod ''SPT'') + 1
According to the ATA specifications, "If the content of words (61:60) is greater than or equal to 16,514,064, then the content of word 1
he number of logical cylindersshall be equal to 16,383."
Therefore, for LBA 16450559, an ATA drive may actually respond with the CHS ''tuple'' (16319, 15, 63), and the number of cylinders in this scheme must be much larger than 1024 allowed by INT 13h.
Operating system dependencies
Operating systems that are sensitive to BIOS-reported drive geometry include
Solaris
Solaris may refer to:
Arts and entertainment Literature, television and film
* ''Solaris'' (novel), a 1961 science fiction novel by Stanisław Lem
** ''Solaris'' (1968 film), directed by Boris Nirenburg
** ''Solaris'' (1972 film), directed by ...
,
DOS
DOS is shorthand for the MS-DOS and IBM PC DOS family of operating systems.
DOS may also refer to:
Computing
* Data over signalling (DoS), multiplexing data onto a signalling channel
* Denial-of-service attack (DoS), an attack on a communicatio ...
and Windows NT family, where
NTLDR
NTLDR (abbreviation of ''NT loader'') is the boot loader for all releases of Windows NT operating system from 1993 with the release of Windows NT 3.1 up until Windows XP and Windows Server 2003. From Windows Vista onwards it was replaced by the BOO ...
(
NT,
2000
File:2000 Events Collage.png, From left, clockwise: Protests against Bush v. Gore after the 2000 United States presidential election; Heads of state meet for the Millennium Summit; The International Space Station in its infant form as seen from ...
,
XP,
Server 2003
Server may refer to:
Computing
*Server (computing), a computer program or a device that provides functionality for other programs or devices, called clients
Role
* Waiting staff, those who work at a restaurant or a bar attending customers and su ...
) or
WINLOAD (
Vista
Vista usually refers to a distant view.
Vista may also refer to:
Software
*Windows Vista, the line of Microsoft Windows client operating systems released in 2006 and 2007
*VistA, (Veterans Health Information Systems and Technology Architecture) ...
,
Server 2008
Windows Server 2008 is the fourth release of the Windows Server operating system produced by Microsoft as part of the Windows NT family of the operating systems. It was released to manufacturing on February 4, 2008, and generally to retail on Fe ...
,
Windows 7
Windows 7 is a major release of the Windows NT operating system developed by Microsoft. It was released to manufacturing on July 22, 2009, and became generally available on October 22, 2009. It is the successor to Windows Vista, released nearly ...
and
Server 2008 R2
Windows Server 2008 R2 is the fifth version of the Windows Server operating system produced by Microsoft and released as part of the Windows NT family of operating systems. It was released to manufacturing on July 22, 2009, and became generally ...
) use
Master boot record
A master boot record (MBR) is a special type of boot sector at the very beginning of partitioned computer mass storage devices like fixed disks or removable drives intended for use with IBM PC-compatible systems and beyond. The concept of MBR ...
which addresses the disk using CHS;
x86-64
x86-64 (also known as x64, x86_64, AMD64, and Intel 64) is a 64-bit version of the x86 instruction set, first released in 1999. It introduced two new modes of operation, 64-bit mode and compatibility mode, along with a new 4-level paging mod ...
and
Itanium
Itanium ( ) is a discontinued family of 64-bit Intel microprocessors that implement the Intel Itanium architecture (formerly called IA-64). Launched in June 2001, Intel marketed the processors for enterprise servers and high-performance computin ...
versions of Windows can partition the drive with
GUID Partition Table
The GUID Partition Table (GPT) is a standard for the layout of partition tables of a physical computer storage device, such as a hard disk drive or solid-state drive, using universally unique identifiers, which are also known as globally unique i ...
which uses LBA addressing.
Some operating systems do not require any translation because they do not use geometry reported by BIOS in their
boot loader
A bootloader, also spelled as boot loader or called boot manager and bootstrap loader, is a computer program that is responsible for booting a computer.
When a computer is turned off, its softwareincluding operating systems, application code, a ...
s. Among these operating systems are
BSD
The Berkeley Software Distribution or Berkeley Standard Distribution (BSD) is a discontinued operating system based on Research Unix, developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berk ...
,
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
,
macOS
macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
,
OS/2
OS/2 (Operating System/2) is a series of computer operating systems, initially created by Microsoft and IBM under the leadership of IBM software designer Ed Iacobucci. As a result of a feud between the two companies over how to position OS/2 ...
and
ReactOS
ReactOS is a free and open-source operating system for amd64/i686 personal computers intended to be binary-compatible with computer programs and device drivers made for Windows Server 2003 and later versions of Windows. ReactOS has been noted a ...
.
See also
*
Block (data storage)
In computing (specifically data transmission and data storage), a block, sometimes called a physical record, is a sequence of bytes or bits, usually containing some whole number of records, having a maximum length; a ''block size''. Data thus ...
*
Cylinder-head-sector
Cylinder-head-sector (CHS) is an early method for giving addresses to each physical block of data on a hard disk drive.
It is a 3D-coordinate system made out of a vertical coordinate ''head'', a horizontal (or radial) coordinate ''cylinder'', an ...
(CHS)
*
Disk formatting
Disk formatting is the process of preparing a data storage device such as a hard disk drive, solid-state drive, floppy disk, memory card or USB flash drive for initial use. In some cases, the formatting operation may also create one or more new fil ...
*
Disk partitioning
Disk partitioning or disk slicing is the creation of one or more regions on secondary storage, so that each region can be managed separately. These regions are called partitions. It is typically the first step of preparing a newly installed disk ...
*
Disk storage
Disk storage (also sometimes called drive storage) is a general category of storage mechanisms where data is recorded by various electronic, magnetic, optical, or mechanical changes to a surface layer of one or more rotating disks. A disk drive is ...
Notes
References
External links
LBAs explainedCHS to LBA Translation TutorialMicrosoft article on 7.8 GB limit on NT 4.0Upgrading and Repairing PC's by Scott Mueller. Pages 524–531.
AT Attachment 8 - ATA/ATAPI Command Set (ATA8-ACS)
{{DEFAULTSORT:Logical block addressing
Computer storage devices
SCSI
AT Attachment
BIOS