Bricked the phone trying to balance btrfs (adding free space via SDCard) [answered]

asked 2017-02-23 21:45:55 +0300

Flickta gravatar image

updated 2017-03-03 13:34:22 +0300

Hi!

I had this problem when there is plenty free space on the phone but btrfs metadata is full and btrfs balancing doesn't start (no space left on the device) and you can't even delete files to fix it (again, no space left). I added a second btrfs device on SD card following the guide here: https://together.jolla.com/question/30822/root-and-home-disks-full-and-causing-various-problems/ Still had trouble running the balancer... Tried a lot... To cut the long story short, now it boots only in recovery mode and I can only connect to it via telnet. Here are the results:

 btrfs fi show
Label: 'sailfish'  uuid: 0f8a2490-53ed-4ff6-ba34-b81df3430387
        Total devices 2 FS bytes used 8.93GiB
        devid    1 size 13.75GiB used 9.37GiB path /dev/mmcblk0p28
        *** Some devices missing

Btrfs v3.16

and

btrfs check --repair /dev/mmcblk0p28
enabling repair mode
warning, device 2 is missing
warning devid 2 not found already
Checking filesystem on /dev/mmcblk0p28
UUID: 0f8a2490-53ed-4ff6-ba34-b81df3430387
checking extents
btrfs: extent-tree.c:2682: btrfs_reserve_extent: Assertion `!(ret)' failed.
Aborted

I really need to save some data from the phone, my contacts and my notes specifically. Restoring it to working condition would be a plus.

Please, help!


Okay, some development here. I was able to get some of the info back on mys SD card. Turns out, my disk became a RAID1 setup after I ran the balance with the temporary partition on an SD card. And after reboot, it was unable to operate or mount, until I performed the same losetup /dev/loop0 /mysd/btrfs and then mounted the partition from the SD card. Then btrfs fi show command saw both devices and allowed me finally to mount the subvolume with my home directory.

I copied some files successfully, but I have two problems now:

No idea how to convert the RAID setup back to single to be able to boot (if it is at all possible here)

4 btrfs-delayed-m processes appeared unexpectedly and consume 16% CPU each and I again have no idea, what are they and whether I can safely reboot in Recovery mode again to try the RAID -> Single conversion (Now all commands take a lot of time to complete).

A sidenote: I am not a technical person, so am asking for leniency here.


Update #2. Copied my backup to an SD card (had to mount the missing part of my "RAID" from the card and then copied my backups. Had to do that in two stages - first to the recovery partition, and then to SD card (copying straight to SD card didn't work, instead some btrfs processes kicked in and copying process was left forever in a D state). Then got a working image, thanks to help from @coderus and dd'ed it to my phone from an SD card. Now slowly updating back to the latest version of the OS. Have to say that I still like the 1.x UI/UX more :)

I would like to thank everyone who came here to help for your help! You are great :)

Case closed.

edit retag flag offensive reopen delete

The question has been closed for the following reason "the question is answered, an answer was accepted" by Flickta
close date 2017-03-03 13:34:41.029941

Comments

dd partition to file to sdcard, mount it inside linux with newer kernel and do repair.

coderus ( 2017-02-23 21:50:07 +0300 )edit

That's a great idea, thanks a lot! Can you add some details about the dd command, please, because I'm not sure how to do that properly. Also, what Linux distro will work for the repair? I'll have to download and install it in Parallels, so, maybe, some newer Ubuntu? And repairing it in Linux - I can do that without mounting, right? Just copy it to the sdcard, then to my HDD (into folder shared with Linux)?

Flickta ( 2017-02-23 22:12:40 +0300 )edit

Something like: dd if=/dev/mmcblk0p28 of=/dev/mmcblk1p1 ?

Flickta ( 2017-02-23 22:14:56 +0300 )edit

@Flickta: Answers to your questions (and more), use-cases etc. are all here on tjc. Many of those tjc articles contain a link to https://jolla.zendesk.com/hc/en-us/articles/204709607-How-do-I-use-the-Recovery-Mode-. Chapter 3.1 may be especially relevant for you.

Please do understand what the dd command does (e.g. look at its manpage), what partitions to copy and how to extract your data from the resulting images, first. Otherwise you may brick your phone completely (your above example points in this direction).

olf ( 2017-02-24 00:18:33 +0300 )edit
1

Sorry, @olf but I have looked through the articles on zendesk, and they do not cover my scenario. For instance, I am unable to mount my home directory (Invalid argument). So, 3.1 is not especially relevant to me at this moment. Articles on tjc contain lots of tidbits, and btrfs wiki too. And I will try to understand the dd command better before proceeding with it. But still, after I will have a partition copied to an sdcard, where do I get a Linux distro with a "newer kernel"?

Flickta ( 2017-02-24 02:12:45 +0300 )edit