I've been writing to a 3TB USB external hard drive (WD MyBook) with a Btrfs filesystem, when accidentally I've switched the power off to the drive's power brick.
What is strange - the write operations seemed to continue (I expected an immediate I/O error). I have killed the rsync
process manually and tried to remount the filesystem.
The /dev/sdf
node was still there, but I was unable to mount it.
I've tried partprobe
and btrfs device scan
to no avail.
After rebooting I was unable to mount the filesystem again.
I've run a btrfs rescue chunk-recover -v
on the drive, and after about 14 hours found this:
(A long list of good chunks)
Chunk: start = 1992919351296, len = 1073741824, type = 1, num_stripes = 1
Stripes list:
[ 0] Stripe: devid = 1, offset = 1975739482112
No block group.
Device extent list:
[ 0]Device extent: devid = 1, start = 1975739482112, len = 1073741824, chunk offset = 1992919351296
Chunk: start = 1993993093120, len = 1073741824, type = 1, num_stripes = 1
Stripes list:
[ 0] Stripe: devid = 1, offset = 1976813223936
No block group.
Device extent list:
[ 0]Device extent: devid = 1, start = 1976813223936, len = 1073741824, chunk offset = 1993993093120
Unrecoverable Chunks:
Chunk: start = 1995066834944, len = 1073741824, type = 1, num_stripes = 1
Stripes list:
[ 0] Stripe: devid = 1, offset = 1977886965760
No block group.
No device extent.
Chunk: start = 1996140576768, len = 1073741824, type = 1, num_stripes = 1
Stripes list:
[ 0] Stripe: devid = 1, offset = 1978960707584
No block group.
No device extent.
Chunk: start = 1997214318592, len = 1073741824, type = 1, num_stripes = 1
Stripes list:
[ 0] Stripe: devid = 1, offset = 1980034449408
No block group.
No device extent.
Chunk: start = 1998288060416, len = 1073741824, type = 1, num_stripes = 1
Stripes list:
[ 0] Stripe: devid = 1, offset = 1981108191232
No block group.
No device extent.
Chunk: start = 1361559158784, len = 1073741824, type = 1, num_stripes = 0
Stripes list:
Block Group: start = 1361559158784, len = 1073741824, flag = 1
No device extent.
Total Chunks: 1850
Recoverable: 1845
Unrecoverable: 5
Orphan Block Groups:
Orphan Device Extents:
parent transid verify failed on 1634923266048 wanted 1530 found 1532
parent transid verify failed on 1634923266048 wanted 1530 found 1532
Ignoring transid failure
Couldn't setup extent tree
open with broken chunk error
Chunk tree recovery failed
After a long list of chunks, there's a few that were unrecoverable. What does that mean?
I've tried all possible btrfs command including scrub, check, --init-extent-tree, zero-log but the y all end up doing nothing with a similar output:
# btrfs check -p /dev/sdc
Opening filesystem to check...
parent transid verify failed on 1634923266048 wanted 1530 found 1532
parent transid verify failed on 1634923266048 wanted 1530 found 1532
Ignoring transid failure
Couldn't setup extent tree
ERROR: cannot open file system
Is it possible that I have completely trashed a Btrfs filesystem just with an unexpected power failure?
You can find more detail about this case here: https://forum.manjaro.org/t/unfixable-btrfs-filesystem-after-a-power-failure/80994
btrfs check --repair
without first reading all about it and trashed my filesystem that way.