[Desire HD Q&A, Help & Troubleshooting] Wropzter:
Hello!

I managed to flash the CM 12.1 rom but I noticed that the /system partition is barely large enough (585Mb). It is so small that

I can't install the gapps package I need.

I also note that my /userdata partition is 1200Mb.

I would like to decrease the size of the userdata partition and increase the size of the system partition.

I am able to do this fine through adb shell after booting into TWRP recovery - but

the changes don't stick.

In some cases (not sure if it's when I mess up the partition table) - the partition table is simply reset

upon reboot.

In other cases - the partition table is reset - but contains duplicate partitions (as shown below)

~ # fdisk -l -u /dev/block/mmcblk0
Warning: deleting partitions after 60

Disk /dev/block/mmcblk0: 2332 MB, 2332033024 bytes
1 heads, 16 sectors/track, 284672 cylinders, total 4554752 sectors
Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 * 1 1000 500 4d Unknown
Partition 1 does not end on cylinder boundary
/dev/block/mmcblk0p2 1001 1128 64 45 Unknown
Partition 2 does not end on cylinder boundary
/dev/block/mmcblk0p3 1129 10128 4500 46 Unknown
Partition 3 does not end on cylinder boundary
/dev/block/mmcblk0p4 10129 4554750 2272311 5 Extended
Partition 4 does not end on cylinder boundary
/dev/block/mmcblk0p5 10130 70129 30000 49 Unknown
/dev/block/mmcblk0p6 70131 95130 12500 50 Unknown
/dev/block/mmcblk0p7 95132 99227 2048 51 Unknown
/dev/block/mmcblk0p8 99229 105372 3072 52 Unknown
/dev/block/mmcblk0p9 105374 109469 2048 53 Unknown
/dev/block/mmcblk0p10 109471 111518 1024 54 Unknown
/dev/block/mmcblk0p11 111520 113567 1024 56 Unknown
/dev/block/mmcblk0p12 113569 131071 8751+ 55 Unknown
/dev/block/mmcblk0p13 131073 137216 3072 4a Unknown
/dev/block/mmcblk0p14 137218 143361 3072 4b Unknown
/dev/block/mmcblk0p15 143363 145410 1024 74 Unknown
/dev/block/mmcblk0p16 145412 163326 8957+ 75 Unknown
/dev/block/mmcblk0p17 163328 163839 256 76 Unknown
/dev/block/mmcblk0p18 163841 165888 1024 47 Unknown
/dev/block/mmcblk0p19 165890 167937 1024 34 Unknown
/dev/block/mmcblk0p20 167939 170498 1280 36 Unknown
/dev/block/mmcblk0p21 170500 187901 8701 71 Unknown
/dev/block/mmcblk0p22 187903 196094 4096 48 Unknown
/dev/block/mmcblk0p23 196096 196607 256 73 Unknown
/dev/block/mmcblk0p24 196609 200702 2047 26 Unknown
/dev/block/mmcblk0p25 200704 1343486 571391+ 83 Linux
/dev/block/mmcblk0p26 1343488 3749886 1203199+ 83 Linux
/dev/block/mmcblk0p27 3749888 4046846 148479+ 83 Linux
/dev/block/mmcblk0p28 4046848 4358143 155648 83 Linux
/dev/block/mmcblk0p29 4358145 4364286 3071 33 Unknown
/dev/block/mmcblk0p30 4364288 4406782 21247+ 19 Unknown
/dev/block/mmcblk0p31 4406784 4407295 256 23 Unknown
/dev/block/mmcblk0p32 10130 70129 30000 49 Unknown
/dev/block/mmcblk0p33 70131 95130 12500 50 Unknown
/dev/block/mmcblk0p34 95132 99227 2048 51 Unknown
/dev/block/mmcblk0p35 99229 105372 3072 52 Unknown
/dev/block/mmcblk0p36 105374 109469 2048 53 Unknown
/dev/block/mmcblk0p37 109471 111518 1024 54 Unknown
/dev/block/mmcblk0p38 111520 113567 1024 56 Unknown
/dev/block/mmcblk0p39 113569 131071 8751+ 55 Unknown
/dev/block/mmcblk0p40 131073 137216 3072 4a Unknown
/dev/block/mmcblk0p41 137218 143361 3072 4b Unknown
/dev/block/mmcblk0p42 143363 145410 1024 74 Unknown
/dev/block/mmcblk0p43 145412 163326 8957+ 75 Unknown
/dev/block/mmcblk0p44 163328 163839 256 76 Unknown
/dev/block/mmcblk0p45 163841 165888 1024 47 Unknown
/dev/block/mmcblk0p46 165890 167937 1024 34 Unknown
/dev/block/mmcblk0p47 167939 170498 1280 36 Unknown
/dev/block/mmcblk0p48 170500 187901 8701 71 Unknown
/dev/block/mmcblk0p49 187903 196094 4096 48 Unknown
/dev/block/mmcblk0p50 196096 196607 256 73 Unknown
/dev/block/mmcblk0p51 196609 200702 2047 26 Unknown
/dev/block/mmcblk0p52 200704 1343486 571391+ 83 Linux
/dev/block/mmcblk0p53 1343488 3749886 1203199+ 83 Linux
/dev/block/mmcblk0p54 3749888 4046846 148479+ 83 Linux
/dev/block/mmcblk0p55 4046848 4358143 155648 83 Linux
/dev/block/mmcblk0p56 4358145 4364286 3071 33 Unknown
/dev/block/mmcblk0p57 4364288 4406782 21247+ 19 Unknown
/dev/block/mmcblk0p58 4406784 4407295 256 23 Unknown
/dev/block/mmcblk0p59 10130 70129 30000 49 Unknown
/dev/block/mmcblk0p60 70131 95130 12500 50 Unknown

(Note how partition 32 and onwards are just copies of the earlier ones)

My question is, is there some part of the system that actually tries to repair/reset the partition table after I have changed it - or does TWRP simply not save the changes I do for some reason?

What part of my system might reset the partition table & why?

Thanks!