- Does LBA always specify sectors as 512 bytes even if the drive is formatted with 4K sectors?
Yes, a lot of code in the world was written in the times of exclusive domination of 512-byte sectors. This code cannot handle any other sector size, so BIOS / disk hardware always emulates 512-bytes sectors regardless of actual sector size. Otherwise, 95% of operating systems just wouldn't boot from such disks at all.
- Also, is the reason the logical drive geometry is different from the physical drive geometry – to maintain backwards compatibility with old standards and limitations with CHS?
There are boundaries in CHS addressing system. 1 ≤ S ≤ 63, 0 ≤ H ≤ 255 (and sometimes 0 ≤ C ≤ 1023). It is the reason why logical geometry exists and is different from the physical geometry.
- If the drive-reported geometry is not accurate, why do partitions still need to start at sector 63 (if that is no longer always the correct cylinder)?
Since Windows Vista, FDISK
creates the first partition on LBA sector 2048 (1M alignment). It may have any CHS coordinates; they do not matter anymore.
In Windows XP and previous versions, the first partition was created on CHS sector (C=0, H=1, S=1) which usually maps to LBA sector 63 (if logical geometry of this disk has 63 sectors per track). Some USB flash drives have logical geometry with 32 virtual sectors per track, so the first partition starts on LBA sector 32 for them. In any case, all of this has nothing to do with actual disk geometry, performance reasons, etc – it's a pure tradition, terminated in Vista/Windows 7.
- Are clusters aligned with the start of the partition or the start of the disk?
Clusters are always aligned with the start of the partition. So they may be misaligned on disk, if the partition was created in pre-Vista FDISK
and is misaligned itself.
I understand BLOCK generally means a batch of data seen as a whole I/O unit
The use of the term "block" is widespread in computing, and not restricted to I/O.
What I thought a logical block, or a filesystem block refers to is the minimal I/O unit seen as a whole used by specific filesystem, in order to, as the essence of any batch operation, reduce the overheads brought by reading or writing one sector one time.
IMO it would be careless to make sweeping definitions that encompass all filesystems. Be aware that the I/O blocksize for file data could be different from filesystem metadata. E.G. writes to a file could be consolidated into 4KB (or larger) blocks, but the filesystem journal may need to be written more often (with a smaller block) to ensure data retention.
"Batch operation" is old jargon, and you're using the term in a nonsensical manner.
And a physical block is exactly the synonym of a disk sector.
Only in the context of disk drives.
Magnetic tape requires I/O to be performed in physical blocks, but there is no concept of sectors with tape.
What's more, I believe the word CLUSTER is just filesystem block in Microsoft's fashion, as suggested by this thread on Reddit.
A "cluster" is a unit of allocation in MS filesystems.
Whether I/O is always performed in that same blocksize is questionable. E.G. When the cluster size is 64KB, and the entire file is just 128 bytes, is the filesystem going to write 128 sectors or optimize the I/O to just one sector?
So, is LBA just a fancy word which actually concerns addressing disk sectors?
Essentially yes (for legacy 512-byte sectors).
The integrated controller of the modern disk drive performs the mapping of LBA to physical sector. The actual cylinder, head, and sector that maps to a particular LBA is known only to the drive so that any type of zone-bit recording and relocation for bad sectors can be implemented by the disk drive.
With Advanced Format 512e HDDs that use 4096-byte sectors and a 512-byte transfer size, the term LBA is truly accurate: the address is not of a physical sector, but rather for a logical block consisting of an eighth of a sector.
Or does LBA-compliant disks really understand the concept of filesystem/logical block,
I'm not sure what you mean by "filesystem/logical block", but the answer is probably no.
It's simply a storage device with no concept of organizing the raw data it is storing.
See What kind of api does a sata hard-drive expose?
and is capable of making block-level I/O, thus hide the existence of "sector" from operating system?
The concept of sector (or physical block) cannot be eliminated, simply because that is the minimum unit of I/O. The lowest-levels of the OS (i.e. the device drivers) will always be cognizant of the hardware attributes. But each abstraction layer of the OS will try to obscure those details. So when you read a file, you may not know if it was retrieved from a HDD or DVD or over a network.
FWIW disk controllers (even old ones that used CHS addressing) can perform multi-sector read or write operations, e.g. perform a read of N sequential sectors.
Best Answer
Overall you are rather sloppy with terminology, so that is a source of further confusion.
The IBM PC/XT used a Western Digital WD1010 disk controller that used (in hardware registers) a 10-bit cylinder number.
The first cylinder has address 0, so there are 1024 cylinder addresses.
"Addressable number" is nonsensical.
The first sector (of every track) is address 1, so a 6-bit sector number can address up to 63 sectors (sector numbers 1 through 63) on each track.
There is no sector address zero. It's not reserved. It doesn't exist.
The subtraction of this offset is an arithmetic necessity, and is not related in any way to the boot sector. The use of the first sector (or any sector) of the disk drive for booting (or any function) is irrelevant to need for subtracting the starting offset.
No, that is a maximum capacity.
Disk addresses are for sectors, not bytes.
Huh??? An "addressable number"???
One of the drive parameters is the number of heads (in a cylinder).
One of the numbers in a CHS address is the head number.
246 bits???
Heads-per-track
is something you made up, as there is no such parameter for the typical HDD used in a PC (i.e. that number would always be unity).A specific track would be read and written by only one specific R/W head.
There's one R/W head per surface. (You're not likely to use a dual-port drive.)
The R/W head is mounted on the end of an arm.
All of the R/W heads and arms comprise an assembly that is moved/rotated by an actuator.
(But there have also been fixed-head disk drives, e.g. one head per track, that have zero seek time.)
Then apparently you're confused as to what a head is.
You are also confusing "platter" with "surface".
There's no requirement that both sides of a platter must be used, so each surface is treated as a unit, rather than the platter as a unit.
There is a drive parameter called
sectors per track
.Again, something you seemed to have made up. Heads per track is unity.
LBA is a sector address.
CHS is also a sector address.
In order to convert one style of address to the other, you need to specify the drive geometry:
You cannot *translate * the geometry to an address; you use the geometry to convert an address.
CHS address
3,2,1
is equivalent to LBA address3150
if the drive geometry is1020,16,63
.ADDENDUM for the revised Question
Of the numerous technical documents (from the disk drive manufacturers) that I have read, the specifications table for a (single-port) drive would list the number of R/W heads and the number of platters. There never was a ratio of
heads per disk
,heads per surface
, orheads per platter
.In my work as a software/firmware engineer developing controller firmware, device drivers for disks, and filesystem handlers, I never was concerned with or had to use the number of platters. The number of platters or that there are two possible surfaces to a platter are mechanical properties that are totally irrelevant to the drive geometry for CHS addressing.
The C in CHS refers to the cylinder address. The disk drive has to (electro-mechanically) seek to the requested cylinder address/location so that the R/W head assembly is positioned correctly.
The H in CHS refers to the R/W head address. The disk controller (electrically) selects the requested R/W head (after the seek is complete) by its address to access the correct track. All other R/W heads are (electrically) disabled.
The S in CHS refers to the sector address. The disk controller (programmatically) scans each sector (after the seek and head selection) as it rotates under the (selected) R/W head, until the requested sector is located (e.g. reads the ID record of the sector, and performs an address comparison).
Also
If you're familiar with Dimensional Analysis, specifying the number of heads of a disk drive as
heads per cylinder
makes more sense thanheads per drive
.That's just an arbitrary CHS address chosen for use in examples of conversions to LBA addresses.
BTW
In end-user jargon, "disk" == disk drive.
In professional HDD jargon, "disk" == disk platter.