Skip to content
WebsiteHosting.com

concept Servers & hardware

Logical sectors, physical sectors and write alignment

A small write can start near the end of one physical sector and continue into the next, even when it is logically aligned. Offset and length together determine coverage, not the number of disk operations.

Latest recorded source check · P0220

What it means

A logically aligned write can still overlap partial physical sectors. Its length tells you how many bytes the request covers. Its starting offset determines where those bytes fall relative to a sector boundary.

Microsoft’s Advanced Format compatibility discussion describes 512e disks that present 512-byte logical sectors but use 4096-byte physical sectors. On such a disk, updating only part of a physical sector can require a read-modify-write: the disk reads the sector, replaces the requested bytes, and writes it back with the other bytes intact.

Try it

The simulation uses synthetic byte ranges. It does not open a disk or measure hardware activity.

Logical sectors, physical sectors and write alignment

Change logical/physical sector sizes, byte offset and length; show affected boundaries and the assumed read-modify-write scope.

Simulation

Synthetic inputs only. This is not a measurement of your hardware or service.

Computed under the stated assumptions

The half-open byte interval determines the touched sectors; an exclusive end on a boundary does not touch the next sector.

Logical sectors, physical sectors and write alignment: synthetic scenario inputs

Scenario: Starting example

Each preset replaces all fields. Editing any field preserves the other values exactly, including invalid entries.

Half-open write range and physical boundaries

Physical sectors touched
2
Fully covered sectors
0
Partially covered sectors
2
Byte overlap with each touched physical sector
SectorStart byteExclusive end byteWrite overlapFully covered
004096512 bytesNo
140968192512 bytesNo

Evaluated evidence

Logical sector size (bytes)
512
Physical sector size (bytes)
4096
Starting byte offset (bytes)
3584
Write length (bytes)
1024

Geometry only. Partial-sector coverage can motivate an RMW explanation, but controller caching, coalescing, actual physical I/O count, atomicity and timing are not established.

About this model

Every input is local synthetic evidence. Numbers stay as raw text until this model validates them. The shown evaluated values come from the same result as the explanation.

Presets replace the entire scenario. Reset restores all starting fields, scenario selection and model state; it does not change the open or closed state of this help or article FAQ.

No external request, device command, stored-input history or measurement is performed.

Start with Logical sector size (bytes) set to 512 and Physical sector size (bytes) set to 4096. The default Starting byte offset is 3584 and Write length is 1024. Both offset and length are multiples of 512, so the request passes the logical alignment check.

The write covers [3584, 4608): byte 3584 is included, but byte 4608 is not. Of the 1024 bytes, the first 512 occupy the end of physical sector 0, just before byte 4096. The remaining 512 occupy the start of sector 1. That gives Physical sectors touched = 2, Fully covered sectors = 0, and Partially covered sectors = 2.

The model assumes that physical sector 0 starts at byte 0. For physical sector size P in bytes, the first sector touched is floor(offset / P) and the last is floor((offset + length - 1) / P). Subtracting one uses the last included byte. Within that span, a sector is fully covered only if the write overlaps all P bytes.

  • Keep the length fixed. Change only the starting offset to 4096. The same 1024 bytes now fit inside sector 1: one sector touched, still only partially covered.
  • Cover one whole physical sector. This preset uses offset 4096 and length 4096. The range [4096, 8192) covers all of sector 1 and none of sector 2, because 8192 is the exclusive end.
  • Inspect the evidence boundary. This preset keeps the default offset and length but sets the physical size to Unknown / evidence unavailable. The logical alignment check still passes, but the physical count is unknown, not zero.

Enter offset and length as whole-number decimal text, not fractions or exponents. For example, 3584.000000000000000001 is invalid rather than rounded. The model accepts offsets from 0 through 1048576 bytes and lengths from 1 through 65536 bytes; both must be multiples of the logical size. A known physical size must also be a multiple of the logical size. Reset restores the default scenario and all four inputs without retaining errors, history, or a comparison.

In practice

When checking a request, first identify its byte offset and length and check them against the logical sector size. Then locate the range on the physical boundaries, if known. Microsoft’s Win32 file buffering documentation distinguishes logical and physical sector sizes when discussing alignment requirements for unbuffered I/O; passing this simulation’s logical check is not a test of all those requirements.

Two partial sectors identify two places where bytes outside the request must be preserved. They do not prove that a controller performed two read-modify-write operations: it may cache or combine writes. The count establishes neither atomicity nor elapsed time. Use the whole byte range, not the payload length alone, to decide which boundaries a write crosses; use that result as a coverage count, not an I/O count.

Frequently asked questions

Editorial questions based on the listed sources and explicitly labeled local examples.

Can logical alignment still be physically misaligned?

Yes. An offset divisible by 512 need not be divisible by 4096. Logical addressing and physical write boundaries are separate quantities.

Does the count predict actual disk operations?

No. It counts geometric overlap only. Caching and combining writes can change the actual work performed by a controller.

What happens if physical geometry is unknown?

The simulator returns unknown rather than inventing physical boundaries. Obtain the exact geometry before interpreting that layer.

Does this tool format or modify a drive?

No. It calculates intervals from synthetic values. It opens no disk, sends no commands and changes no device settings.

Sources & model boundaries

Primary references used for this explanation. The interactive example is an educational model, not a live check.

  1. Microsoft: Advanced format disk compatibility update

    512e read-modify-write and alignment discussion. A logical 512-byte interface can expose media with 4096-byte physical units; partial physical writes motivate read-modify-write handling in the described setting.

    Checked .

  2. Microsoft: File buffering

    Alignment and File Access Requirements. Unbuffered I/O has explicit alignment requirements; logical addressing size and physical sector size must not be conflated.

    Checked .

Report an issue. Include the article URL and ID, not passwords or access keys.