[G4 General] letama:
You're welcome.

To get the exact offsets for dd commands, I took a dump of the gpt partition table and then used a tool that gave me this (FRA/EUR model):

[+] Primary GPT header
[-] Signature: b'EFI PART'
[-] Revision: 65536
[-] Header Size: 92
[-] CRC32 of header: F1E68634 (VALID) => Real: F1E68634
[-] Current LBA: 0x00000001
[-] Backup LBA: 0x03A3DFFF
[-] First usable LBA for partitions: 0x00000022
[-] Last usable LBA for partitions: 0x03A3DFDE
[-] Disk GUID: 98101B32-BBE2-4BF2-A06E-2BB33D000C20
[-] Partition entries starting LBA: 0x00000002
[-] Number of partition entries: 52
[-] Size of partition entry: 0x00000080
[-] CRC32 of partition array: 0x7330FD5F

[+] Primary GPT header md5: a22b35048e8f33a3df50a3bf2cc6c1b2

[+] Partition table
[-] WARNING!! CRC32 Check : E177F4F2 (INVALID)

[-] Partition 1
[-] First LBA: 32768
[-] Last LBA: 208895
=> First Offset: 0x01000000
=> Last Offset: 0x065FFE00
[-] Partition Name: modem

[-] Partition 2
[-] First LBA: 229376
[-] Last LBA: 230399
=> First Offset: 0x07000000
=> Last Offset: 0x0707FE00
[-] Partition Name: pmic

[-] Partition 3
[-] First LBA: 230400
[-] Last LBA: 232447
=> First Offset: 0x07080000
=> Last Offset: 0x0717FE00
[-] Partition Name: sbl1

[-] Partition 4
[-] First LBA: 232448
[-] Last LBA: 234495
=> First Offset: 0x07180000
=> Last Offset: 0x0727FE00
[-] Partition Name: tz

[-] Partition 5
[-] First LBA: 234496
[-] Last LBA: 235519
=> First Offset: 0x07280000
=> Last Offset: 0x072FFE00
[-] Partition Name: sdi

[-] Partition 6
[-] First LBA: 235520
[-] Last LBA: 236543
=> First Offset: 0x07300000
=> Last Offset: 0x0737FE00
[-] Partition Name: hyp

[-] Partition 7
[-] First LBA: 236544
[-] Last LBA: 237567
=> First Offset: 0x07380000
=> Last Offset: 0x073FFE00
[-] Partition Name: rpm

[-] Partition 8
[-] First LBA: 237568
[-] Last LBA: 241663
=> First Offset: 0x07400000
=> Last Offset: 0x075FFE00
[-] Partition Name: aboot

[-] Partition 9
[-] First LBA: 241664
[-] Last LBA: 243711
=> First Offset: 0x07600000
=> Last Offset: 0x076FFE00
[-] Partition Name: sbl1bak

[-] Partition 10
[-] First LBA: 243712
[-] Last LBA: 244735
=> First Offset: 0x07700000
=> Last Offset: 0x0777FE00
[-] Partition Name: pmicbak

[-] Partition 11
[-] First LBA: 244736
[-] Last LBA: 246783
=> First Offset: 0x07780000
=> Last Offset: 0x0787FE00
[-] Partition Name: tzbak

[-] Partition 12
[-] First LBA: 246784
[-] Last LBA: 247807
=> First Offset: 0x07880000
=> Last Offset: 0x078FFE00
[-] Partition Name: hypbak

[-] Partition 13
[-] First LBA: 247808
[-] Last LBA: 248831
=> First Offset: 0x07900000
=> Last Offset: 0x0797FE00
[-] Partition Name: rpmbak

[-] Partition 14
[-] First LBA: 248832
[-] Last LBA: 252927
=> First Offset: 0x07980000
=> Last Offset: 0x07B7FE00
[-] Partition Name: abootbak

[-] Partition 15
[-] First LBA: 252928
[-] Last LBA: 253951
=> First Offset: 0x07B80000
=> Last Offset: 0x07BFFE00
[-] Partition Name: sdibak

[-] Partition 16
[-] First LBA: 253952
[-] Last LBA: 254975
=> First Offset: 0x07C00000
=> Last Offset: 0x07C7FE00
[-] Partition Name: limits

[-] Partition 17
[-] First LBA: 254976
[-] Last LBA: 255999
=> First Offset: 0x07C80000
=> Last Offset: 0x07CFFE00
[-] Partition Name: devinfo

[-] Partition 18
[-] First LBA: 256000
[-] Last LBA: 257023
=> First Offset: 0x07D00000
=> Last Offset: 0x07D7FE00
[-] Partition Name: apdp

[-] Partition 19
[-] First LBA: 257024
[-] Last LBA: 258047
=> First Offset: 0x07D80000
=> Last Offset: 0x07DFFE00
[-] Partition Name: msadp

[-] Partition 20
[-] First LBA: 258048
[-] Last LBA: 259071
=> First Offset: 0x07E00000
=> Last Offset: 0x07E7FE00
[-] Partition Name: dpo

[-] Partition 21
[-] First LBA: 259072
[-] Last LBA: 262143
=> First Offset: 0x07E80000
=> Last Offset: 0x07FFFE00
[-] Partition Name: spare1

[-] Partition 22
[-] First LBA: 262144
[-] Last LBA: 294911
=> First Offset: 0x08000000
=> Last Offset: 0x08FFFE00
[-] Partition Name: misc

[-] Partition 23
[-] First LBA: 294912
[-] Last LBA: 360447
=> First Offset: 0x09000000
=> Last Offset: 0x0AFFFE00
[-] Partition Name: persist

[-] Partition 24
[-] First LBA: 360448
[-] Last LBA: 363519
=> First Offset: 0x0B000000
=> Last Offset: 0x0B17FE00
[-] Partition Name: modemst1

[-] Partition 25
[-] First LBA: 363520
[-] Last LBA: 366591
=> First Offset: 0x0B180000
=> Last Offset: 0x0B2FFE00
[-] Partition Name: modemst2

[-] Partition 26
[-] First LBA: 366592
[-] Last LBA: 369663
=> First Offset: 0x0B300000
=> Last Offset: 0x0B47FE00
[-] Partition Name: fsg

[-] Partition 27
[-] First LBA: 369664
[-] Last LBA: 370687
=> First Offset: 0x0B480000
=> Last Offset: 0x0B4FFE00
[-] Partition Name: fsc

[-] Partition 28
[-] First LBA: 370688
[-] Last LBA: 371711
=> First Offset: 0x0B500000
=> Last Offset: 0x0B57FE00
[-] Partition Name: ssd

[-] Partition 29
[-] First LBA: 371712
[-] Last LBA: 372735
=> First Offset: 0x0B580000
=> Last Offset: 0x0B5FFE00
[-] Partition Name: keystore

[-] Partition 30
[-] First LBA: 372736
[-] Last LBA: 376831
=> First Offset: 0x0B600000
=> Last Offset: 0x0B7FFE00
[-] Partition Name: DDR

[-] Partition 31
[-] First LBA: 376832
[-] Last LBA: 377855
=> First Offset: 0x0B800000
=> Last Offset: 0x0B87FE00
[-] Partition Name: sec

[-] Partition 32
[-] First LBA: 377856
[-] Last LBA: 378879
=> First Offset: 0x0B880000
=> Last Offset: 0x0B8FFE00
[-] Partition Name: encrypt

[-] Partition 33
[-] First LBA: 378880
[-] Last LBA: 379903
=> First Offset: 0x0B900000
=> Last Offset: 0x0B97FE00
[-] Partition Name: eksst

[-] Partition 34
[-] First LBA: 379904
[-] Last LBA: 380927
=> First Offset: 0x0B980000
=> Last Offset: 0x0B9FFE00
[-] Partition Name: rct

[-] Partition 35
[-] First LBA: 380928
[-] Last LBA: 385023
=> First Offset: 0x0BA00000
=> Last Offset: 0x0BBFFE00
[-] Partition Name: persistent

[-] Partition 36
[-] First LBA: 385024
[-] Last LBA: 393215
=> First Offset: 0x0BC00000
=> Last Offset: 0x0BFFFE00
[-] Partition Name: spare2

[-] Partition 37
[-] First LBA: 393216
[-] Last LBA: 491519
=> First Offset: 0x0C000000
=> Last Offset: 0x0EFFFE00
[-] Partition Name: laf

[-] Partition 38
[-] First LBA: 491520
[-] Last LBA: 573439
=> First Offset: 0x0F000000
=> Last Offset: 0x117FFE00
[-] Partition Name: boot

[-] Partition 39
[-] First LBA: 573440
[-] Last LBA: 655359
=> First Offset: 0x11800000
=> Last Offset: 0x13FFFE00
[-] Partition Name: recovery

[-] Partition 40
[-] First LBA: [B]655360[/B]
[-] Last LBA: [B]671743[/B]
=> First Offset: 0x14000000
=> Last Offset: 0x147FFE00
[-] Partition Name: drm

[-] Partition 41
[-] First LBA: 671744
[-] Last LBA: 688127
=> First Offset: 0x14800000
=> Last Offset: 0x14FFFE00
[-] Partition Name: sns

[-] Partition 42
[-] First LBA: 688128
[-] Last LBA: 753663
=> First Offset: 0x15000000
=> Last Offset: 0x16FFFE00
[-] Partition Name: mpt

[-] Partition 43
[-] First LBA: 753664
[-] Last LBA: 847871
=> First Offset: 0x17000000
=> Last Offset: 0x19DFFE00
[-] Partition Name: factory

[-] Partition 44
[-] First LBA: 847872
[-] Last LBA: 868351
=> First Offset: 0x19E00000
=> Last Offset: 0x1A7FFE00
[-] Partition Name: fota

[-] Partition 45
[-] First LBA: 868352
[-] Last LBA: 876543
=> First Offset: 0x1A800000
=> Last Offset: 0x1ABFFE00
[-] Partition Name: raw_resources

[-] Partition 46
[-] First LBA: 876544
[-] Last LBA: 884735
=> First Offset: 0x1AC00000
=> Last Offset: 0x1AFFFE00
[-] Partition Name: raw_resourcesbak

[-] Partition 47
[-] First LBA: 884736
[-] Last LBA: 9363455
=> First Offset: 0x1B000000
=> Last Offset: 0x11DBFFE00
[-] Partition Name: system

[-] Partition 48
[-] First LBA: 9363456
[-] Last LBA: 9887743
=> First Offset: 0x11DC00000
=> Last Offset: 0x12DBFFE00
[-] Partition Name: cust

[-] Partition 49
[-] First LBA: 9895936
[-] Last LBA: 12419071
=> First Offset: 0x12E000000
=> Last Offset: 0x17AFFFE00
[-] Partition Name: cache

[-] Partition 50
[-] First LBA: 12419072
[-] Last LBA: 61046783
=> First Offset: 0x17B000000
=> Last Offset: 0x746FFFE00
[-] Partition Name: userdata

[-] Partition 51
[-] First LBA: 61046784
[-] Last LBA: 61071326
=> First Offset: 0x747000000
=> Last Offset: 0x747BFBC00
[-] Partition Name: grow

[+] Partition table md5: ea0c8acec7957b09de3d317ab378824a

LBA is the index ofa 512 bytes block, so for instance to dump drm partition, dd looks like this:

dd if=/dev/block/mmcblk0 of=/data/media/0/drm.img bs=[COLOR="Red"][B]512[/B][/COLOR] skip=[COLOR="Red"][B]655360[/B][/COLOR] count=[COLOR="red"][B]16384[/B][/COLOR]

skip value is exactly First LBA in table (=> 655360),

count value is (Last LBA - first LBA +1) (=> 671743 - 655360 +1 => 16384)

You can also retrieve the indexes and size in download mode if you know what partition number is the one you're looking for.

To find partition number do:

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

It will give you this:

lrwxrwxrwx root root 2015-01-15 01:12 DDR -> /dev/block/mmcblk0p30
lrwxrwxrwx root root 2015-01-15 01:12 aboot -> /dev/block/mmcblk0p8
lrwxrwxrwx root root 2015-01-15 01:12 abootbak -> /dev/block/mmcblk0p14
lrwxrwxrwx root root 2015-01-15 01:12 apdp -> /dev/block/mmcblk0p18
lrwxrwxrwx root root 2015-01-15 01:12 boot -> /dev/block/mmcblk0p38
lrwxrwxrwx root root 2015-01-15 01:12 cache -> /dev/block/mmcblk0p49
lrwxrwxrwx root root 2015-01-15 01:12 cust -> /dev/block/mmcblk0p48
lrwxrwxrwx root root 2015-01-15 01:12 devinfo -> /dev/block/mmcblk0p17
lrwxrwxrwx root root 2015-01-15 01:12 dpo -> /dev/block/mmcblk0p20
[B]lrwxrwxrwx root root 2015-01-15 01:12 drm -> /dev/block/mmcblk0p40[/B]
lrwxrwxrwx root root 2015-01-15 01:12 eksst -> /dev/block/mmcblk0p33
lrwxrwxrwx root root 2015-01-15 01:12 encrypt -> /dev/block/mmcblk0p32
lrwxrwxrwx root root 2015-01-15 01:12 factory -> /dev/block/mmcblk0p43
lrwxrwxrwx root root 2015-01-15 01:12 fota -> /dev/block/mmcblk0p44
lrwxrwxrwx root root 2015-01-15 01:12 fsc -> /dev/block/mmcblk0p27
lrwxrwxrwx root root 2015-01-15 01:12 fsg -> /dev/block/mmcblk0p26
lrwxrwxrwx root root 2015-01-15 01:12 grow -> /dev/block/mmcblk0p51
lrwxrwxrwx root root 2015-01-15 01:12 hyp -> /dev/block/mmcblk0p6
lrwxrwxrwx root root 2015-01-15 01:12 hypbak -> /dev/block/mmcblk0p12
lrwxrwxrwx root root 2015-01-15 01:12 keystore -> /dev/block/mmcblk0p29
lrwxrwxrwx root root 2015-01-15 01:12 laf -> /dev/block/mmcblk0p37
lrwxrwxrwx root root 2015-01-15 01:12 limits -> /dev/block/mmcblk0p16
lrwxrwxrwx root root 2015-01-15 01:12 misc -> /dev/block/mmcblk0p22
lrwxrwxrwx root root 2015-01-15 01:12 modem -> /dev/block/mmcblk0p1
lrwxrwxrwx root root 2015-01-15 01:12 modemst1 -> /dev/block/mmcblk0p24
lrwxrwxrwx root root 2015-01-15 01:12 modemst2 -> /dev/block/mmcblk0p25
lrwxrwxrwx root root 2015-01-15 01:12 mpt -> /dev/block/mmcblk0p42
lrwxrwxrwx root root 2015-01-15 01:12 msadp -> /dev/block/mmcblk0p19
lrwxrwxrwx root root 2015-01-15 01:12 persist -> /dev/block/mmcblk0p23
lrwxrwxrwx root root 2015-01-15 01:12 persistent -> /dev/block/mmcblk0p35
lrwxrwxrwx root root 2015-01-15 01:12 pmic -> /dev/block/mmcblk0p2
lrwxrwxrwx root root 2015-01-15 01:12 pmicbak -> /dev/block/mmcblk0p10
lrwxrwxrwx root root 2015-01-15 01:12 raw_resources -> /dev/block/mmcblk0p45
lrwxrwxrwx root root 2015-01-15 01:12 raw_resourcesbak -> /dev/block/mmcblk0p46
lrwxrwxrwx root root 2015-01-15 01:12 rct -> /dev/block/mmcblk0p34
lrwxrwxrwx root root 2015-01-15 01:12 recovery -> /dev/block/mmcblk0p39
lrwxrwxrwx root root 2015-01-15 01:12 rpm -> /dev/block/mmcblk0p7
lrwxrwxrwx root root 2015-01-15 01:12 rpmbak -> /dev/block/mmcblk0p13
lrwxrwxrwx root root 2015-01-15 01:12 sbl1 -> /dev/block/mmcblk0p3
lrwxrwxrwx root root 2015-01-15 01:12 sbl1bak -> /dev/block/mmcblk0p9
lrwxrwxrwx root root 2015-01-15 01:12 sdi -> /dev/block/mmcblk0p5
lrwxrwxrwx root root 2015-01-15 01:12 sdibak -> /dev/block/mmcblk0p15
lrwxrwxrwx root root 2015-01-15 01:12 sec -> /dev/block/mmcblk0p31
lrwxrwxrwx root root 2015-01-15 01:12 sns -> /dev/block/mmcblk0p41
lrwxrwxrwx root root 2015-01-15 01:12 spare1 -> /dev/block/mmcblk0p21
lrwxrwxrwx root root 2015-01-15 01:12 spare2 -> /dev/block/mmcblk0p36
lrwxrwxrwx root root 2015-01-15 01:12 ssd -> /dev/block/mmcblk0p28
lrwxrwxrwx root root 2015-01-15 01:12 system -> /dev/block/mmcblk0p47
lrwxrwxrwx root root 2015-01-15 01:12 tz -> /dev/block/mmcblk0p4
lrwxrwxrwx root root 2015-01-15 01:12 tzbak -> /dev/block/mmcblk0p11
lrwxrwxrwx root root 2015-01-15 01:12 userdata -> /dev/block/mmcblk0p50

So, in our case, drm is partition 40, commands to retrieve index and size are:

cat /sys/devices/soc.0/f9824900.sdhci/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p[COLOR="Red"]40[/COLOR]/start
cat /sys/devices/soc.0/f9824900.sdhci/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p[COLOR="red"]40[/COLOR]/size

giving you 655360 and 16384 directly.

Last, to dump full MMC until userdata, I just did dd until userdata LBA:

dd if=/dev/block/mmcblk0 of=/data/media/0/full_dump.img bs=512 count=12419072

It's, a big file, around 6 GB. If you want to speed up things a bit, read with a block size of 4096 and divide by 8 the count:

dd if=/dev/block/mmcblk0 of=/data/media/0/full_dump.img bs=4096 count=1552384

I didn't test relocking yet though, not enough free time. Hope it helps, don't hesitate to ask if you need more details.