NTFS Documentation: Update Sequence Technique
Interest
The purpose of update sequence technique (also called fixup technique in the Linux driver) is to detect incomplete multi-sector transfers. All important metadata structures use this technique:
How it works
Writing a structure to the storage unit involves the following operations:
- In memory, increment by one the update sequence (a value stored in the header part of the structure). The value 00 00 must be skipped.
- In memory, patch the update sequence at the end of each sector of the structure, and save the original value in the update sequence array (an array located in the header part of the structure)
- Copy the structure from memory to the storage unit
Reading a structure from the storage unit involves the following operations:
- Copy the structure from the storage unit to memory
- In memory, check if its magic number is correct
- In memory, check if the end of each sector of the structure is the update sequence
- If this is not the case, it means that the last write operation of this structure has not been completed (e.g. a power failure happened in the middle of the operation)
- If this is the case, restore in memory the original values at the end of each sector of the structure from the update sequence array
Note:
- Because we don't know in which order the storage unit actually writes physical sectors, we must patch the end of each sector of the structure, instead of just the end of the last sector of the structure.
- Here we rely on the hardware to check data integrity with checksum techniques.
Regis Duchesne at VIA, ECP, France
Last modified: Thu Jan 28 18:07:56 PST 1999