On Sun, May 17, 2020 at 1:54 PM Jiří Lisický <jiri_lisicky@xxxxxxxxx> wrote: > > Hi, I have Jolla 1 Phone, which use btrfs. With bad battery, phone x times suddenly turned off. Now is bricked. I go into recovery mode > and copy image to my PC with Fedora Live 31 with kernel 5.6.6. > > ~ # losetup --find --show /home/jirka/tmp/jolla.img > /dev/loop0 > > ~ # btrfs fi show > Label: 'sailfish' uuid: 86180ca0-d351-4551-b262-22b49e1adf47 > Total devices 1 FS bytes used 4.73GiB > devid 1 size 13.75GiB used 13.75GiB path /dev/loop0 > > ~ # mount -t btrfs /dev/loop0 ~/mnt > mount: /dev/loop0: can't read superblock > > ~ # mount -t btrfs -o usebackuproot /dev/loop0 ~/mnt > mount: /dev/loop0: can't read superblock > > ~ # btrfs rescue super-recover /dev/loop0 > All supers are valid, no need to recover Weird. How does it not read the superblock, but all superblocks are valid? What do you get for btrfs insp dump-s -fa /dev/loop0 > ~ # LC_ALL=C btrfs rescue zero-log /dev/loop0 > Clearing log on /dev/loop0, previous log_root 0, level 0 This is not advised except in specific cases which the man page gives examples of. > ~ # btrfs fi df ~/mnt > Data, single: total=13.08GiB, used=4.51GiB > System, DUP: total=8.00MiB, used=4.00KiB > System, single: total=4.00MiB, used=0.00B > Metadata, DUP: total=330.00MiB, used=224.30MiB > Metadata, single: total=8.00MiB, used=0.00B > GlobalReserve, single: total=512.00MiB, used=406.37MiB > > ~ # truncate --size=2GB ~/tmp/space > ~ # losetup --find --show ~/tmp/space > /dev/loop1 > > ~ # btrfs device add /dev/loop1 ~/mnt/ > Performing full device TRIM /dev/loop1 (1.86GiB) ... > ERROR: error adding device '/dev/loop1': Read-only file system > > When I mount, in syslog appears: > BTRFS info (device loop0): disk space caching is enabled > BTRFS info (device loop0): creating UUID tree > BTRFS warning (device loop0): block group 144703488 has wrong amount of free space > BTRFS warning (device loop0): failed to load free space cache for block group 144703488, rebuilding it now > BTRFS warning (device loop0): failed to create the UUID tree: -28 > BTRFS: open_ctree failed > > So now I can mount readonly, but is there any way to repair this filesystem? Definitely get things off of it now while you can. Fedora 31 has btrfs-progs 5.6 current. I suggest posting the output from # btrfs check --readonly /dev/ -- Chris Murphy
