Learn about the technologies behind the Internet with The TCP/IP Guide!|
NOTE: Using robot software to mass-download the site degrades the server and is prohibited. See here for more.
Find The PC Guide helpful? Please consider a donation to The PC Guide Tip Jar. Visa/MC/Paypal accepted.
|View over 750 of my fine art photos any time for free at DesktopScenes.com!|
[ The PC Guide | Systems and Components Reference Guide | Hard Disk Drives | Hard Disk Logical Structures and File Systems | New Technology File System (NTFS) | NTFS Reliability Features and System Management ]
Whenever you are using your PC, the operating system (and hence the file system) are constantly reading files and writing files. Each operation that you do on the system usually involves changes to a number of different files and disk structures. In many cases, these changes are related, meaning that it is important that they all be executed at the same time. In a traditional file system such as FAT, if something happens to interrupt these operations, there is the possibility that only some of these related structure changes will have been performed. This can leave the file system in an inconsistent state, producing file system errors, such as when clusters are allocated but never linked to a file.
To avoid these problems, NTFS was designed as a transaction-based or transactional file system, using a concept very similar to that used in many database applications. Take as an example, transferring $100 from your checking account to your savings account. Simplistically, this transaction involves reducing your checking account balance by $100, and increasing your savings account balance by the same amount. However, it is essential that both changes occur--or neither. If only one occurs then either you or the bank are out $100. To ensure that this cannot happen, the database systems used at banks are designed to treat such transactions as atomic units--either all the changes in the transaction occur, or none of them do.
NTFS works in a very similar way. Every operation that results in a change to anything on the operating system is considered a transaction. Each transaction is made of several different components, each of which results in a change to part of the file system, such as a file's data or other attributes, or the volume's metadata files. A special activity log is maintained by the system (in fact, it is one of NTFS's metadata files). Every time a change is made to any part of the volume, the system records the change in the activity log. These changes include the creation, deletion, or modification of files or directories.
As a particular transaction progresses, NTFS records each of the changes it makes to any part of the volume. Once all of the changes are complete, the transaction is also complete, and a marking is placed in the activity log to indicate that the transaction was successful. This is called committing the transaction. However, suppose a problem occurs before all portions of the transaction are complete--for example, a power failure. In this case, the activity log will be left with some of the components of the transaction having been marked as completed, but the transaction not having been committed. This tells the file system that the transaction was interrupted. It can then use the information in the activity log to "undo" the partially-completed transaction (or in some cases, to "redo" changes that need to be reapplied after a system problem). This is called rolling back the transaction, so that the file system appears as it did prior to the start of the transaction. This is all part of the NTFS recovery procedure.
Note: It's important to
realize that the transactional operation system only guarantees that transactions will be
completed in their entirety if they are completed. If a transaction isn't
completed, it will be rolled back, which may result in the loss of some data. NTFS does
not guarantee that data will never be lost, only that files won't be left in an
Of course, there is a bit of a downside to this transactional system, as there usually is. The necessity of writing information to the transaction log and managing it during the course of every disk operation results in a slight degradation of file system performance. The impact isn't generally considered major, and for most users, the slight reduction in performance is well worth the reliability improvements. NTFS makes this tradeoff in implementing many of its different features.
Next: Transaction Recovery