'In my case formatting or factory reset did not help. The solution was to boot into recovery (TWRP) after flashing a ROM and rooting, and there change the file system type. For example I switched from the recognized 8GB ext4 to FAT (this switched the capacity to 32GB) and then back again to...