Restoring /root and /home by dd

Hello collegues.

In the Jolla Recovery i created 2 images of the
/dev/mapper/root
and
/dev/mapper/home

DD created 2 .img files on the SD-Card.
root.img is a simple ext4 volume and can be mounted on Linux PC,
home.img is an encrypted volume, it can be also decrypted and mounted on the Linux PC.

Now i want restore this 2 images with dd back.

Which /dev/? Partitions should i use?

I tried to write it back to the /dev/mapper/root and /dev/mapper/home - but i got a brocken /home Partition. Something with size is wrong.
So i thing the right way is to write them straight to the /dev/XX Device.

Can someone tell me, which Partition numbers shoul i use on Xperia 10 III ?

Maybe @olf or somebody else know it for sure?

Thanks

1 Like

The short answer is: none
Because, as you correctly denoted:

So i thin[k] the right way is to write them straight to [/dev/sdaXX.]

But in consequence you must also backup the whole /dev/sdaXX partition (XX = 79 on an Xperia 10 III) in the first place, which contains both, the /home and /root volumes (and a little LVM metadata).
So, if you have a chance to perform the backup again, do that as described by @wetab73 here (some other variants but also wrong guesses are described further down in this discussion thread).

But maybe I am missing the point, because these statements are not comprehensible for me:

I tried to write it back to the /dev/mapper/root and /dev/mapper/home - but i got a broken /home Partition. Something with size is wrong.

  • Why do you want to restore a “broken” home volume, and what do you exactly mean by “broken”?
    If the filesystem is broken, backup as much as you can from the mounted filesystem (e.g. by using tar, maybe with the GNU tar option --ignore-failed-read) and then use fsck (starting with a “dry run” by -N) to repair the filesystem.

  • Something with size is wrong.

    • Which command line emitted which error message (please copy&paste)?
    • Did you recreate the /root and /home volumes (if so: how?), or how come that a volume size is different now?
2 Likes

Thanks for the clarification @olf
So i wrote not the whole /dev/sda79 Partition, but only /dev/mapper/home and /dev/mapper/root
The Phone is reinstalled, so i have no possibility to backup the right partition again.

When i tried to restore back the /home partition after reboot i get stuck after unlock code and in the recovery menu i got many errors during e2fsck.

I will try now only to restore root, and will try to copy the content of /home afterwards.

Thanks for your help.

The Phone is reinstalled, …

Do I assume correctly, that you re-flashed your Xperia 10 III (this is not mentioned anywhere in this thread)?
Before I assumed you backed up the /root volume to avoid that, e.g. in order to update the device’s firmwares by flashing a more recent Android than the one which had been installed before SaillfishOS was originally flashed.

When i tried to restore back the /home partition after reboot

Rebooting from what and into what?
E.g. “first reboot after flashing” and “into the fresh SailfishOS installation (or the recovery image?)”?

I.e. there is lots of information missing what you did to arrive in the current state.
Maybe you originally adapted the root volume size and now forgot to do that again (hence the sizes of your backup images do not fit to their current sizes).

1 Like

Yes, after i made dd_backup of /dev/mapper/root and /dev/mapper/home i reflashed my Xperia 10 III.
Than booted into recovery. Resized partitions to the same size i had before 10GB root, 80GB home
then rebooted again into recovery, restored boot partitions with dd, reflashed hybris-boot and booted into normal SailfishOS.

After antering the code the phone got neverending spin circle.
Reflashed recovery and booted into it, decrypted /home, made e2fsck and it found many unrecoverable errors.

Thats what i did so far.

O.K., this summary was comprehensive.

Spontaneously I have no idea what went wrong, I would have to think about what to check to determine the reason … but not now (sorry).

1 Like

Thanks. this is not a big deal. I can read all the data, so its nothing lost. But thanks for your answers, @olf