Is it possible to clone a device and make a backup with all apps and settings

Sooo, yes, it seems to work! :partying_face:
I cloned one JP2 on another.
The second JP2 survived!

So far, the phone boots, my home is there, fingerprints are all there and wifi connections work.
Camera, Mail, Fernie, Phone, SMS, BT music on my speaker, all work.
Wifi mac addresse is ok and IMEI too.
I didn’t test it extensively yet, but it seems to work normally.

Hickup: both BT mac addresses are now the same.

Disclaimer:
Use these commands at your own risk and only if you understand them and know exactly what they do.
An error can result in a data loss and/or unbootable system.
The recovery might not work anymore.
Your phone can become a brick.

To clone an XA2, there is a similar method here.

Unlike the XA2 method, which uses a microSD, here, the image file is made on the PC.
Netcat is used to transport the image from/to the phones/PC.
The image size is 233GB, which could perhaps, perhaps fit on a 256GB uSD.

JP2/JP2026 only.
Here is the method I used, probably not the cleanest/shortest.
Read to the end before starting, PC and disk space are needed.

Assuming you already are in the recovery shell, option 3.

Create the image file from phone 1:

On the Source Phone:

  • cd /
  • umount /rootfs/proc
  • umount /rootfs/dev
  • umount /rootfs
  • Deactivate the LVM volumes
    lvm vgchange -an sailfish
  • Prepare to transmit to the PC
    dd if=/dev/sdc71 bs=16M | nc -l -p 1234

On the PC:
Prepare to receive the data, and store it into an img file.

  • nc -d 10.42.66.66 1234 | pv -s 249493946368 > /the_path_ and_file_name_you_like.img
    pv is used to show the progression (with the partition size) but you can use the command without it. Just remove the | pv -s 249493946368 part
  • Once finished, you can verify the image size with
    stat -c %s /the_path_ and_file_name_you_like.img (should be 249493946368)
  • You also can verify if the partition and image file have the same sum. Too long, I didn’t, but it should be done for a serious work.
    md5sum /the_path_ and_file_name_you_like.img
    And on the phone: md5sum /dev/sdc71

Exit the shell on the phone with exit
dd took approx 1h48.

Apply the image file to the phone 2

First, create a backup of the second phone with the method above.

On the second phone:
Then, assuming you already are in the recovery shell, option 3:

  • cd /
  • umount /rootfs/proc
  • umount /rootfs/dev
  • umount /rootfs
  • Deactivate the LVM volumes
    lvm vgchange -an sailfish
  • verify that the size is the same as on the first phone (should be 487292864)
    cat /sys/class/block/sdc71/size
  • Prepare to receive the image from the PC
    nc -l -p 1234 | dd of=/dev/sdc71 bs=16M

On the PC:

  • Send the image to the phone
    pv /the_path_ and_file_name_you_like.img | nc -N 10.42.66.66 1234

When it is finished, back on the second phone:

  • Write everything that is in memeory
    sync (not sure if really needed, as we wrote on the partition but well…)
  • Calculate the partition md5sum Too long, I didn’t, but it should be done for a serious work.
    Must be the same as on the PC
    md5sum /dev/sdc71
  • Exit, reboot
    exit

dd took approx 2h02.

One question stays open:
How to get an unique BT MAC address back for the cloned phone?


edit:
To get the original BT MAC address back:
In terminal, devel-su:
Seee the wrong MAC:

cat /var/lib/bluetooth/board-address

Refresh the installer packages list

pkcon refresh

Install the BT tools package

pkcon install bluez5-tools

See the correct MAC:

bluetoothctl list

Copy the correct MAC from the above command answer and paste it
echo “EX:AM:PL:E0:ON:LY” > /var/lib/bluetooth/board-address

Reboot
Verify it holds.

3 Likes