BTRFS Data Recovery

BTRFS Filesystem Features

Copy-on-write

BTRFS uses copy-on-write. This means that when it is needed to change a file, BTRFS filesystem does not change the file in-place, but writes changes in other place. It helps to avoid problems associated with so-called “partial” write which often occurs due to power failures when original data has already been deleted while new data has not yet been written. From the recovery point of view copy-on-write is a very useful feature since the chance of successful recovery is higher. Even if the last copy of file metadata is damaged, it is likely that the previous versions of the metadata still exist on the device.

Checksums on data and metadata

BTRFS filesystem calculates checksums both for metadata and for user data. This feature allows to know that there are some errors in a structure and correct them. For example, if BTRFS filesystem calculates checksum (during read operation) for some data block and detects that it does not match, BTRFS tries to find a good copy of this block and fix the error, if mirroring is enabled.

Online data scrubbing

This feature of BTRFS filesystem is connected with the previous one. Sometimes BTRFS filesystem checks filesystem structure (so called data scrubbing) to find some errors and then to fix them. The errors are identified and corrected using checksums as described above.

Built-in compression

BTRFS filesystem provides optional transparent compression, using either ZLIB DEFLATE or LZO algorithms.

In-place conversion from ext3/4 to BTRFS

In BTRFS filesystem there is a special tool allowing to convert ext3/4 to BTRFS in-place. During the conversion, metadata of ext filesystem is not modified; BTRFS filesystem writes its metadata to the free space. Such a behavior ensures that data stored on the device remains intact even if some failure happens during the conversion. Additionally, this method allows you to cancel “changing filesystem type” operation at any time. Once filesystem type is converted you get access to all files and folders created on ext.

Someday this may result in that NASes will convert their filesystems to BTRFS when updating firmware. It is quite possible that they even will not inform a user about it referring to the fact that a NAS is a black box and is not considered user-serviceable.  

Copyright © 2015 - 2023 www.ReclaiMe.com