• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Backing up Partitions

Search This thread

smokejumper76

Senior Member
Nov 28, 2014
130
27
Once device is rooted, since there is no extSD, FULL backup options are limited. I'm sure people know about this but just wanted

to share what I recently learned. Via Busybox/Toybox , netcat, and dd one can dump the partition data using dd over a netcat TCP stream on a local USB network. With one terminal pooping it out, you have another terminal capturing it and dumping it to a image file.



Example:



On rooted phone connected to PC



Reboot into TWRP or Lineage Recovery (tested on Lineage Recovery they use Toybox. I think TWRP uses busybox but I could be wrong)

Code:
adb devices
<make sure adb sees device>



<Enter ADB Shell phone # prompt should be present>


Code:
adb shell



Code:
dd if=/dev/block/sda19 | gzip | toybox nc -l -p 8888
(may work better w/o gzip/bzip2 but will create massive userdata file whereever you store it.)

or

Code:
dd if=/dev/block/sda19 | toybox nc -l -p 8888
<you have been warned!>




*this command will run and read sda19 (userdata), piping the output through gzip to compress (or directly to netcat if omit compression if used alternative command above) then to the toybox/busybox command executing netcat over tcp port 8888.



|'s (pipes) are used when the output needs to input into another COMMAND/PROGRAM.

> (redirects) are used when the output needs to write to a FILE. |'s for programs, >'s for files.



On the 2nd terminal on computer



Code:
adb forward tcp:8888 tcp:8888

Code:
netcat 127.0.0.1 8888 > userdata.bin.gz

OR if you elected w/o compression use
Code:
netcat 127.0.0.1 8888 > userdata.bin
instead (or any filename u want really).

<this command uses netcat to capture the stream of data sent over port 8888 from the 1st terminal and dump it to the compressed/uncompressed image file.>


This will take a long long time. There are dd options to speed up the process but I'm lazy and maybe will include later. Compression option will speed it up but not sure I trust it as I get unexpected end of file on the archive when I test it. Havnt tried it uncompressed yet.


* Or just use:

Partitions Backup & Restore by Wanam, from Google Play at



URLs:
 
Last edited:

smokejumper76

Senior Member
Nov 28, 2014
130
27
Partition Reference
=================



# ls -la /dev/block/bootdevice/by-name
total 0
drwxr-xr-x 2 root root 1500 1971-03-20 19:20 .
drwxr-xr-x 3 root root 1640 1971-03-20 19:20 ..
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 ALIGN_TO_128K_1 -> /dev/block/sdd1
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 ALIGN_TO_128K_2 -> /dev/block/sdf1
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 abl_a -> /dev/block/sde4
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 abl_b -> /dev/block/sde20
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 aop_a -> /dev/block/sde1
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 aop_b -> /dev/block/sde17
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 apdp_a -> /dev/block/sde14
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 apdp_b -> /dev/block/sde30
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 boot_a -> /dev/block/sda6
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 boot_b -> /dev/block/sda7
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 cdt -> /dev/block/sdd2
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 cmnlib64_a -> /dev/block/sde7
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 cmnlib64_b -> /dev/block/sde23
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 cmnlib_a -> /dev/block/sde6
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 cmnlib_b -> /dev/block/sde22
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 ddr -> /dev/block/sdd3
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 devcfg_a -> /dev/block/sde8
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 devcfg_b -> /dev/block/sde24
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 devinfo -> /dev/block/sde33
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 dtbo_a -> /dev/block/sda10
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 dtbo_b -> /dev/block/sda11
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 featenabler_a -> /dev/block/sde16
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 featenabler_b -> /dev/block/sde32
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 frp -> /dev/block/sda5
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 fsc -> /dev/block/sdf5
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 fsg -> /dev/block/sdf4
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 hyp_a -> /dev/block/sde3
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 hyp_b -> /dev/block/sde19
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 imagefv_a -> /dev/block/sde13
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 imagefv_b -> /dev/block/sde29
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 keymaster_a -> /dev/block/sde5
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 keymaster_b -> /dev/block/sde21
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 keystore -> /dev/block/sda4
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 klog -> /dev/block/sda14
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 limits -> /dev/block/sde36
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 limits-cdsp -> /dev/block/sde37
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 logfs -> /dev/block/sde39
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 metadata -> /dev/block/sda15
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 misc -> /dev/block/sda3
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 modem_a -> /dev/block/sda12
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 modem_b -> /dev/block/sda13
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 modemst1 -> /dev/block/sdf2
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 modemst2 -> /dev/block/sdf3
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 multiimgoem_a -> /dev/block/sde15
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 multiimgoem_b -> /dev/block/sde31
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 persist -> /dev/block/sda2
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 qupfw_a -> /dev/block/sde9
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 qupfw_b -> /dev/block/sde25
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 reserve_1 -> /dev/block/sde11
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 reserve_2 -> /dev/block/sde27
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 secdata -> /dev/block/sde42
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 splash -> /dev/block/sde35
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 spunvm -> /dev/block/sde34
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 ssd -> /dev/block/sda1
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 storsec -> /dev/block/sde40
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 super -> /dev/block/sda18
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 toolsfv -> /dev/block/sde38
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 tz_a -> /dev/block/sde2
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 tz_b -> /dev/block/sde18
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 uefisecapp_a -> /dev/block/sde12
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 uefisecapp_b -> /dev/block/sde28
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 uefivarstore -> /dev/block/sde41
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 userdata -> /dev/block/sda19
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 vbmeta_a -> /dev/block/sde10
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 vbmeta_b -> /dev/block/sde26
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 vbmeta_system_a -> /dev/block/sda16
lrwxrwxrwx 1 root root 16 1971-03-20 19:20 vbmeta_system_b -> /dev/block/sda17
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 vendor_boot_a -> /dev/block/sda8
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 vendor_boot_b -> /dev/block/sda9
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 xbl_a -> /dev/block/sdb1
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 xbl_b -> /dev/block/sdc1
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 xbl_config_a -> /dev/block/sdb2
lrwxrwxrwx 1 root root 15 1971-03-20 19:20 xbl_config_b -> /dev/block/sdc2
:/ #




Logical Order



ssd -> /dev/block/sda1
persist -> /dev/block/sda2
misc -> /dev/block/sda3
keystore -> /dev/block/sda4
frp -> /dev/block/sda5
boot_a -> /dev/block/sda6
boot_b -> /dev/block/sda7
vendor_boot_a -> /dev/block/sda8
vendor_boot_b -> /dev/block/sda9
dtbo_a -> /dev/block/sda10
dtbo_b -> /dev/block/sda11
modem_a -> /dev/block/sda12
modem_b -> /dev/block/sda13
klog -> /dev/block/sda14
metadata -> /dev/block/sda15
vbmeta_system_a -> /dev/block/sda16
vbmeta_system_b -> /dev/block/sda17
super -> /dev/block/sda18
userdata -> /dev/block/sda19
xbl_a -> /dev/block/sdb1
xbl_config_a -> /dev/block/sdb2
xbl_b -> /dev/block/sdc1
xbl_config_b -> /dev/block/sdc2
ALIGN_TO_128K_1 -> /dev/block/sdd1
cdt -> /dev/block/sdd2
ddr -> /dev/block/sdd3
aop_a -> /dev/block/sde1
tz_a -> /dev/block/sde2
hyp_a -> /dev/block/sde3
abl_a -> /dev/block/sde4
keymaster_a -> /dev/block/sde5
cmnlib_a -> /dev/block/sde6
cmnlib64_a -> /dev/block/sde7
devcfg_a -> /dev/block/sde8
qupfw_a -> /dev/block/sde9
vbmeta_a -> /dev/block/sde10
reserve_1 -> /dev/block/sde11
uefisecapp_a -> /dev/block/sde12
imagefv_a -> /dev/block/sde13
apdp_a -> /dev/block/sde14
multiimgoem_a -> /dev/block/sde15
featenabler_a -> /dev/block/sde16
aop_b -> /dev/block/sde17
tz_b -> /dev/block/sde18
hyp_b -> /dev/block/sde19
abl_b -> /dev/block/sde20
keymaster_b -> /dev/block/sde21
cmnlib_b -> /dev/block/sde22
cmnlib64_b -> /dev/block/sde23
devcfg_b -> /dev/block/sde24
qupfw_b -> /dev/block/sde25
vbmeta_b -> /dev/block/sde26
reserve_2 -> /dev/block/sde27
uefisecapp_b -> /dev/block/sde28
imagefv_b -> /dev/block/sde29
apdp_b -> /dev/block/sde30
multiimgoem_b -> /dev/block/sde31
featenabler_b -> /dev/block/sde32
devinfo -> /dev/block/sde33
spunvm -> /dev/block/sde34
splash -> /dev/block/sde35
limits -> /dev/block/sde36
limits-cdsp -> /dev/block/sde37
toolsfv -> /dev/block/sde38
logfs -> /dev/block/sde39
storsec -> /dev/block/sde40
uefivarstore -> /dev/block/sde41
secdata -> /dev/block/sde42
ALIGN_TO_128K_2 -> /dev/block/sdf1
modemst1 -> /dev/block/sdf2
modemst2 -> /dev/block/sdf3
fsg -> /dev/block/sdf4
fsc -> /dev/block/sdf5




cat /proc/partitions



1 0 8192 ram0
1 1 8192 ram1
1 2 8192 ram2
1 3 8192 ram3
1 4 8192 ram4
1 5 8192 ram5
1 6 8192 ram6
1 7 8192 ram7
1 8 8192 ram8
1 9 8192 ram9
1 10 8192 ram10
1 11 8192 ram11
1 12 8192 ram12
1 13 8192 ram13
1 14 8192 ram14
1 15 8192 ram15
7 0 524288 loop0
254 0 2097152 zram0
8 0 124846080 sda
8 1 8 sda1
8 2 32768 sda2
8 3 1024 sda3
8 4 512 sda4
8 5 512 sda5
8 6 98304 sda6
8 7 98304 sda7
8 8 98304 sda8
8 9 98304 sda9
8 10 16384 sda10
8 11 16384 sda11
8 12 199680 sda12
8 13 199680 sda13
8 14 8192 sda14
8 15 16384 sda15
259 0 64 sda16
259 1 64 sda17
259 2 9527296 sda18
259 3 114409452 sda19
8 32 8192 sdc
8 33 3584 sdc1
8 34 128 sdc2
8 80 16384 sdf
8 81 104 sdf1
8 82 2560 sdf2
8 83 2560 sdf3
8 84 2560 sdf4
8 85 128 sdf5
8 64 65536 sde
8 65 512 sde1
8 66 4096 sde2
8 67 512 sde3
8 68 2048 sde4
8 69 512 sde5
8 70 512 sde6
8 71 512 sde7
8 72 128 sde8
8 73 80 sde9
8 74 64 sde10
8 75 8192 sde11
8 76 2048 sde12
8 77 2048 sde13
8 78 64 sde14
8 79 32 sde15
259 4 128 sde16
259 5 512 sde17
259 6 4096 sde18
259 7 512 sde19
259 8 2048 sde20
259 9 512 sde21
259 10 512 sde22
259 11 512 sde23
259 12 128 sde24
259 13 80 sde25
259 14 64 sde26
259 15 8192 sde27
259 16 2048 sde28
259 17 2048 sde29
259 18 64 sde30
259 19 32 sde31
259 20 128 sde32
259 21 4 sde33
259 22 8192 sde34
259 23 32 sde35
259 24 4 sde36
259 25 4 sde37
259 26 1024 sde38
259 27 8192 sde39
259 28 128 sde40
259 29 512 sde41
259 30 28 sde42
8 16 8192 sdb
8 17 3584 sdb1
8 18 128 sdb2
8 48 8192 sdd
8 49 104 sdd1
8 50 128 sdd2
8 51 1024 sdd3
253 0 2719324 dm-0
253 1 726468 dm-1
253 2 995784 dm-2
253 3 286384 dm-3
253 4 114409452 dm-4