I booted to TWRP recovery and tried to shrink /system and extend /data in the following way:

parted /dev/block/mmcblk0

(parted) unit s
(parted) print free

The output (original partition table):

Model: MMC H8G4u! (sd/mmc)
Disk /dev/block/mmcblk0: 15269888s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number  Start      End        Size       File system  Name        Flags
        34s        8191s      8158s      Free Space
 1      8192s      38911s     30720s                  apnhlos     msftdata
 2      38912s     156543s    117632s                 modem       msftdata
 3      156544s    157567s    1024s                   sbl1
 4      157568s    157631s    64s                     ddr
 5      157632s    161727s    4096s                   aboot
 6      161728s    162751s    1024s                   rpm
 7      162752s    163775s    1024s                   qsee
 8      163776s    164799s    1024s                   qhee
 9      164800s    170943s    6144s                   fsg
10      170944s    170975s    32s                     sec
11      170976s    192511s    21536s                  pad         msftdata
12      192512s    212991s    20480s                  param
13      212992s    241663s    28672s     ext4         efs
14      241664s    247807s    6144s                   modemst1
15      247808s    253951s    6144s                   modemst2
16      253952s    280575s    26624s                  boot
17      280576s    311295s    30720s                  recovery
18      311296s    336897s    25602s                  fota
19      336898s    351215s    14318s                  backup      legacy_boot
20      351216s    357359s    6144s                   fsc
21      357360s    357375s    16s                     ssd
22      357376s    373759s    16384s     ext4         persist
23      373760s    374783s    1024s                   persistent
24      374784s    393215s    18432s     ext4         persdata
25      393216s    4653055s   4259840s   ext4         system
26      4653056s   5062655s   409600s    ext4         cache
27      5062656s   5206015s   143360s    ext4         hidden
28      5206016s   15269847s  10063832s  ext4         userdata
        15269848s  15269854s  7s         Free Space

Then I removed last 3 partitions and resized /system:

(parted) rm 28
(parted) rm 27
(parted) rm 26
(parted) resizepart 25 3186687
(parted) mkpart physical ext4 3186688 3596287
(parted) name 26 cache
(parted) mkpart physical ext4 3596288 3602431
(parted) name 27 hidden
(parted) mkpart physical ext4 3602432 15269847
(parted) name 28 userdata
(parted) quit

Then you need to sync changes to be able to mount /system again:

blockdev --flushbufs /dev/block/mmcblk0

However, nothing is changed.

parted /dev/block/mmcblk0 print free

After mounting partitions in TWRP or after reboot to system the partition sizes remain old.

What am I doing wrong? Has Samsung Galaxy J5 (SM-J500FN) any hardware lock?

  • I am facing the same issue with a Galaxy S4 Mini GT-i9195. But this link shows it working on the same phone. Not for me though. Even if I remove system and create it again with the desired size, it always comes back the old size after reboot. Are you following any links for the steps you used?
    – Reg Edit
    Dec 9, 2021 at 23:39
  • @RegEdit, I gave up. Perhaps, the only way to change partition sizes is to upload PIT file via Odin alongside firmware files. This will probably cause all data lost. Dec 10, 2021 at 2:24
  • I saw that people have done that, and I pulled my existing PIT so I could change partitions and push it back but I think it's too risky and can brick the device unless you get it right--and I didn't find solid info about how to edit. I think it will work with parted, just that something is overriding the change at the moment. We have different devices but perhaps the cause is the same. I will post the solution here when I find it! :)
    – Reg Edit
    Dec 10, 2021 at 19:36

1 Answer 1


This doesn't directly explain what you are seeing, but you have a missing step, which may possibly be contributing to your partitions getting reset by TWRP or something else.

When you create a partition with parted, and include a partition type such as ext4, that doesn't actually make a file system on your new partition. To do that, you need to exit parted and format the partition using

mkfs.ext4 /dev/block/mmcblk0p26

where 26 is the partition number of your cache, so repeat the same command using p27 and p28 for your other two partitions.

If you don't have mkfs.ext4 there's a zipfile containing it along with parted and other related tools attached to this post in the XDA Developer forum. There are zipfiles for both ARM and ARM64/AARCH builds, so choose whichever zipfile's right for your device.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .