ReclaiMe’s Research – Determining Timestamps On BTRFS

ReclaiMe Data Recovery Company announces that they have completed the research devoted to determining the reliability and accuracy of various file metadata like creation, modification, and access timestamps in modern filesystems using copy-on-write (CoW).Old filesystems like NTFS, FAT, and EXT, which do not use copy-on-write, have one single instance of the file metadata. All file metadata is not necessarily stored in one place, but there is no more than one copy of each metadata piece on a disk. When deleting a file, a filesystem does not actually erase the metadata. Instead, it just marks the space previously allocated to the file and its metadata as free for reuse. Previous metadata thus remains intact until the next write, which happens to use the same space.

During normal operation on these filesystems (FAT/NTFS/EXT), there is only one place where metadata of a particular file is stored. There are few exceptions when more than one copy of metadata can exist:

• Journal on NTFS or EXT. Metadata copy gets into a journal for a short time resulting in the existence of two copies of metadata for a that (short) period of time.
• Defragmentation may create the copies of metadata. When the defragmenter moves metadata to a more optimal location, old copies are not zeroed and therefore can exist long enough to be discovered, until their space is used for a new write operation.

Generally, non-CoW filesystems store a single copy of file metadata; even journaling and defragmentation cannot produce many copies.

As for filesystems using copy-on-write, the situation with file metadata was not that clear because copy-on-write implies that every file modification generates a new copy of file metadata. In the current research, a file was created and modified on BTRFS, modern filesystem using in NETGEAR NASes. Once all the changes were written to the disk, search for the metadata revealed that there are at least four old, not yet reused, metadata blocks, and two groups of new blocks, which give different timestamps. From all this variety of metadata blocks, the filesystem driver finds a metadata block with correct timestamp by traversing filesystem trees. If a filesystem fails or the file is deleted, some metadata blocks can be destroyed or become unreachable because pointers to these blocks are damaged. Data recovery tools have to sort all the different metadata and generally, timestamps cannot be determined reliably. Taking the latest timestamps is a good assumption but in general case it is not possible to prove that a block with the latest timestamp was not destroyed during the data loss event.

The research formed the basis of their latest data recovery lesson available at www.data.recovery.training. This also includes the detailed description of the experiment and the corresponding disk image files, using which you can repeat the experiment.

Leave a Comment