Skip to content

Instantly share code, notes, and snippets.

@tuukka
Created August 13, 2014 10:55
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuukka/7a81112ef161ee77eccb to your computer and use it in GitHub Desktop.
Save tuukka/7a81112ef161ee77eccb to your computer and use it in GitHub Desktop.
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.
@aatit
Copy link

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?

@skuke1
Copy link

skuke1 commented Dec 26, 2017

Couple of fixes and extra instructions:
on step 4, second line needs to be -->
mkfs.btrfs --label sailfish --nodesize 4096 --features ^extref,^raid56,^skinny-metadata,^no-holes new-jolla.img
or at least I ended up with "invalid arguments" and "unsupported features(100)" without those additions.

on step 6, I used nano to replace the UUIDs, from both fstab as peremen instructed.

on step 7,
To use the nc, type from the ubuntu:
dd if=new-jolla.img | nc -l 3333

and after that from recovery shell in jolla:
nc 10.42.66.67 3333 > /dev/mmcblk0p28

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