[Sony Xperia 10 III] wirespot:
How to backup partition images with dd on the command line (root required)​

We don't currently have a working custom recovery for the Xperia 10 III, but if you have root there's a simple method to dump partition images.

This is a very good idea and you should do it at least once, especially if you like to mess around the device a lot.

You won't be able to do this before you root, so by the time you do some partitions will not be stock anymore. Use XperiFirm instead to get the clean stock images.

Special partitions:​

The userdata partition holds all your personal files and system settings. It's huge (about 105 GB) and obviously you can't dump it into itself. You can dump it on an SD card if it's 128+ GB.

The super partition is a physical partition that contains several logical partitions (including system and vendor) That's why you won't find those in the partition list. This is done on Android 10+ devices to allow those logical partitions to be resized or rearranged as needed. You don't need to split out the internal logical partitions, you can flash back the entire super partition. The stock firmware also comes with a super image, not individual logical partitions.

Using a helper script:​

There's a Magisk module called Backup (by Draco) which gives you a command line shell script you can use if you prefer. It mostly does the same things I described above. The script is here if anybody wants to just grab it directly.

On the plus side, the script knows to dump only the active A/B image (which is the one that interests you most). On the flip side, it doesn't have a feature to skip userdata.

So here is a shell command that will use the backup script to dump all partitions, but only those matching your device's active A/B slot, and skips userdata:

backup $(ls /dev/block/bootdevice/by-name/ | grep -v userdata | sed 's/_[ab]$//')

And here's one that also skips super:

backup $(ls /dev/block/bootdevice/by-name/ | grep -v userdata | grep -v super | sed 's/_[ab]$//')

How to dump partitions manually:​

If you can't/won't use the helper script you can do it by hand. All the following commands need root:

Find the names of all the partitions:

ls /dev/block/bootdevice/by-name/

Dump one specific partition identified by NAME:

dd if=/dev/block/bootdevice/by-name/NAME of=NAME.img

Dump all partitions except userdata:

ls /dev/block/bootdevice/by-name/ | grep -v userdata | while read NAME; do echo dd if=/dev/block/bootdevice/by-name/${NAME} of=${NAME}.img; done

Find the active slot:

getprop ro.boot.slot_suffix

Get checksums for all the images after the dump:

md5sum *.img

Confused about _a and _b partitions?​

You should read about A/B Seamless Updates.

Long story short, some partitions have two copies eg. boot_a and boot_b. When you boot up the device you use the partitions in one slot (eg. the _a partitions). When an OTA update is being downloaded, it writes into the partitions for the other slot (eg. the _b partitions). Your phone can stay in use while this happens. If the OTA fails nothing is broken, you just keep using the good slot partitions. After the OTA is successful you switch to the other slot and also have the previous version in the other slot in case you need to switch back.

This means that some of the _a and _b images for the same partition can be different for you! So it's strongly recommended to do the checksums, and also to find out which is your active slot, so you know which partitions you're using right now.