Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
steps to create new btrfs filesystem for a Jolla phone
1. On a phone that's still working:
mount -o subvolid=0 /dev/mmcblk0p28 /mnt/
2. On a Linux laptop:
ssh jolla tar c /mnt/factory-@ >factory.tar
ssh jolla tar c /mnt/factory-@home >factory-home.tar
3. On the working phone again:
umount /mnt
4. On the laptop:
dd if=/dev/zero of=new-jolla.img count=28831711
mkfs.btrfs --label sailfish --nodesize 4096 --features ^extref new-jolla.img
sudo mount -o loop new-jolla.img /mnt
sudo btrfs subvolume create /mnt/factory-@
sudo btrfs subvolume create /mnt/factory-@home
sudo btrfs subvolume create /mnt/@swap
cd /
sudo tar xf ~/factory-home.tar
sudo tar xf ~/factory.tar
sudo btrfs subvolume snapshot /mnt/factory-@ /mnt/@
sudo btrfs subvolume snapshot /mnt/factory-@home /mnt/@home
sudo btrfs subvolume list /mnt
5. Note the ID of the @ subvolume in the output of the previous command and substitute 260 here:
sudo btrfs subvolume set-default 260 /mnt
sudo btrfs-show-super new-jolla.img
6. Note the fsid in the output of the last command and substitute the second hex number here:
sed -i -e 's/0f8a2490-53ed-4ff6-ba34-b81df3430387/f6f0da16-fd3e-48b6-b785-cc9af653b055/' /mnt/@/etc/fstab
sudo umount /mnt
7. Upload the new filesystem image new-jolla.img to the non-working phone in the recovery mode and write it to /dev/mmcblk0p28, sync and reboot -f. Install updates to get back to the latest SailfishOS version.

peremen commented Oct 25, 2014

I think step 6 needs to be modified, to modify both /etc/fstab of factory-@ and @. If factory-@'s UUID is left default, restoring the device from recovery mode will cause bootloop due to mismatch of UUID. For step 7, if you don't have large microSD card to host the image, recovery contains 'nc' and using it will be fine. Just make sure that your USB connection is stable.

I have a fried jolla, and a working one so I have always wanted to see how to clone mi working one to fix the dead one.

I am guessing step 1 is for the working phone connected to the linux computer and those are shell commands or am I supposed to do those steps in the dev mode shell IN the phone?

Cheers

aatit commented Nov 20, 2015

Hi,
Thank you for the post.
What should i do if I don't have a working Jolla and my phone is bricked.
Is there a way I can download and use the filesystem jolla.img to use on my phone in recovery mode?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment