background
Hi all,
I was experimenting with waydroid. I accidentally deleted (rm -rf
) my documents, music, and pictures folders that were linked to the waydroid directories. In my panic, I accidentally ran test disk and incorrectly set the type as MBR.
I tried using chatgpt, but I feel I’m getting in a circle. I found this tool that can recover it, but I am having trouble with the outputs
https://www.lukeshu.com/blog/btrfs-rec.html
btrfs-rec inspect rebuild-mappings \
--pv=/run/media/bedhedd/Expansion/disk_clone/backup.img \
> mappings-1.json
12:38:23.0537 ERR : goroutine "/main" exited with error: device file "/run/media/bedhedd/Expansion/disk_clone/backup.img": superblock 0: unknown checksum type: 22
12:38:23.0539 INF thread=:shutdown_logger : shutting down (gracefully)...
12:38:23.0539 INF thread=:shutdown_status : final goroutine statuses:
12:38:23.0539 INF thread=:shutdown_status : /main: exited with error
btrfs-rec: error: device file "/run/media/bedhedd/Expansion/disk_clone/backup.img": superblock 0: unknown checksum type: 22
current status
I created a dd backup of the image
debugging commands
sda1
is the nvme
sudo btrfs check --readonly /dev/sda1
Opening filesystem to check...
Checking filesystem on /dev/sda1
UUID: 027f2550-4813-20d9-ac54-fc87dc4612eb
[1/8] checking log skipped (none written)
[2/8] checking root items
[3/8] checking extents
ERROR: block device size is smaller than total_bytes in device item, has 2199023255040 expect >= 4096804589568
ERROR: errors found in extent allocation tree or chunk allocation
[4/8] checking free space cache
cache and super generation don't match, space cache will be invalidated
[5/8] checking fs roots
[6/8] checking only csums items (without verifying data)
[7/8] checking root refs
[8/8] checking quota groups skipped (not enabled on this FS)
found 924773294080 bytes used, error(s) found
total csum bytes: 901903928
total tree bytes: 1090568192
total fs tree bytes: 44154880
total extent tree bytes: 17858560
btree space waste bytes: 121016944
file data blocks allocated: 1541724680192
referenced 1541646524416
I created a backup in a separate drive and mounted it
sudo losetup --find --show backup.img
sudo btrfs check --readonly /dev/loop0p1
Opening filesystem to check...
Checking filesystem on /dev/loop0p1
UUID: 027f2550-4813-20d9-ac54-fc87dc4612eb
[1/8] checking log skipped (none written)
[2/8] checking root items
[3/8] checking extents
[4/8] checking free space cache
[5/8] checking fs roots
[6/8] checking only csums items (without verifying data)
[7/8] checking root refs
[8/8] checking quota groups skipped (not enabled on this FS)
found 924660998144 bytes used, no error found
total csum bytes: 901903928
total tree bytes: 1089945600
total fs tree bytes: 44154880
total extent tree bytes: 17743872
btree space waste bytes: 120964529
file data blocks allocated: 1541613006848
referenced 1541534851072