LinuxCommandLibrary

btrfs-rescue

Recovery tools for damaged btrfs filesystems

TLDR

Rebuild the filesystem metadata tree (very slow)

$ sudo btrfs rescue chunk-recover [path/to/partition]
copy
Fix device size alignment problems
$ sudo btrfs rescue fix-device-size [path/to/partition]
copy
Recover corrupted superblock from copies
$ sudo btrfs rescue super-recover [path/to/partition]
copy
Recover from interrupted transactions
$ sudo btrfs rescue zero-log [path/to/partition]
copy
Create the btrfs control device
$ sudo btrfs rescue create-control-device
copy

SYNOPSIS

btrfs rescue subcommand [options] device

DESCRIPTION

btrfs rescue provides recovery tools for damaged btrfs filesystems. These are last-resort commands when normal mounting or btrfs check fails.
Each subcommand addresses specific failure modes like corrupted metadata, superblock damage, or interrupted transactions. The filesystem must be unmounted for all operations.

SUBCOMMANDS

chunk-recover

Scan and rebuild chunk tree (very slow, hours to days)
fix-device-size
Fix device size mismatches preventing mount
super-recover
Restore superblock from backup copies
zero-log
Clear the transaction log to fix log replay failures
create-control-device
Create /dev/btrfs-control when mknod unavailable

CAVEATS

These are emergency recovery tools. Always backup any recoverable data first. chunk-recover can take extremely long on large filesystems. Some operations may cause data loss. The filesystem must be unmounted.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community