Backup postmarketOS partitions of Android phone.
This article discusses how to back up data from postmarketOS system partitions.
postmarketOS has plenty of backup tools, such as rsync and Timeshift, which can restore the system to a previous state. Linux has more complete permissions than Android, so in theory you can back up any directory. If the phone supports the Linux mainline kernel, then you can make even better use of BTRFS snapshots.
However, this article is about a “full device backup” approach. I want a one-to-one backup of the phone data, so it can be restored to a previous state with one command.
1. postmarketOS and Android Partitions#
When installing postmarketOS on the PinePhone, we can use Tow-Boot to make the PinePhone appear as a disk. After plugging it into a computer, we can use the dd command to extract the entire system image and back up the whole system.
But many postmarketOS devices are converted from Android phones, and their partition tables are inherited from Android. So we need to back them up the Android way.
Devices before Android 9 often used A/B partitions, while devices after Android 10 mostly use dynamic partitions. Every device is different. Take the Xiaomi Poco F1 as an example: postmarketOS is flashed through fastboot to the boot and userdata partitions, while the other partitions remain in their original Android state. Therefore, Fastboot and Recovery can still be used.
In theory, those two partitions can be extracted as full partition image files from the Android Recovery interface using ADB commands.
Because this is a full device backup, the required space can easily exceed the phone’s own storage capacity. Store the extracted image files on a larger SD card or on a computer. I recommend using a USB 3 or faster port for transfer.
2. Back Up postmarketOS Partitions#
Xiaomi’s stock Recovery does not have ADB support, so I used LineageOS recovery. Backing up with TWRP also works, but TWRP is not available for every phone.
Reboot the phone into Fastboot mode.
Download Recovery from the LineageOS website and flash it.
Reboot into LineageOS Recovery:
fastboot reboot recoveryTap the Advanced menu and enable ADB.
Connect the phone to the computer.
Pull the partitions to the computer:
adb pull /dev/block/bootdevice/by-name/userdata userdata.img
adb pull /dev/block/bootdevice/by-name/boot boot.img- Now we have two img files.
3. Restore postmarketOS Partitions#
Restoration test:
Reboot into postmarketOS.
Delete some files.
Flash the img files back. This time, use fastboot:
fastboot flash boot boot.img
fastboot flash userdata userdata.img- After rebooting, it should return to the previous state.
You might ask: if the phone system is flashed back to Android, can this method still restore the postmarketOS data? Pretty risky. The partition table may get messed up.


