[T-Mobile Samsung Galaxy S II SGH-T989] Lorien_Silmaril:
Hey everyone! As some of you may already know, there has been a guide on how to re-partition the internal memory for the Samsung Galaxy S II for some time. The problem is that guide was for model I9100 of the S II (for those who are curious, the guide is located here). I have looked around extensively to see if anyone has had success re-partitioning the internal memory of the T989, and it looks like several people have asked about this in the past - but nobody's provided any answers (I am assuming because nobody's done it). So I went ahead and experimented, and to my surprise it was quite easy to do! :)

Background Info:

The Galaxy S II by default allocates only 2GB to the /data partition. This partition is used for all app installations and their associated data. Unfortunately, 2GB is completely insufficient by today's standard, and the phone often runs out of storage space for app installations quickly (my wife's T989 for example was not even able to receive app updates anymore due to low memory errors). The problem is further compounded by the fact that many custom Kitkat (or later) ROMs do not include a "Move to SD Card" feature for app management (though this can be circumvented by using an utility such as Link2SD), so many users are stuck with a very limited number of apps on their T989.

On the other hand, the phone has over 11GB allotted for the internal SD partition (which is not an actual SD card; this is part of the internal memory). Now, most of us have an external SD card, and don't really store much on the internal SD. So to me it is rather silly to have only 2GB of space in the /data partition for apps (which is what the internal memory should be for!) while the internal SD partition just sits around with over 11GB of space.

What a Re-Partition Does:

Re-Partitioning the internal memory of the phone relocates the available memory (16GB total) from one partition to another. In this specific case, we will be reducing the amount of memory allocated to the internal SD partition and increase the amount allocated to the /data partition.

Does re-partitioning have a high risk of bricking your device? Yes. But we actually won't be doing that much tinkering for the purpose of this guide, and it should be fairly safe (at least in my case, everything went smoothly). That said, I will not be responsible if you manage to brick your device because you didn't follow the steps carefully, do your research, or did something silly like using the included .pit file for a wrong model of Galaxy S II.

What You Will Need:

PIT Magic: Utility for editing the .pit file, which defines your device's memory structure.

ODIN: To upload the .pit file to your device and re-partition it.

The .pit file for Samsung SGH-T989 (see attached).

For your convenience, if you do not want to mess around with the .pit file in PIT Magic (it can get a bit confusing), I have attached a modified .pit file for the SGH-T989 which allots 8GB of space to the /data partition (leaving 5.25GB for the Internal SD). You can flash this directly through ODIN (see below for instructions).

Editing the .PIT File For Samsung SGH-T989 (Hercules):

Download and extract the attached .pit file, "T989_PIT_(Unmodified).zip".

(If you decide to use my pre-modified .pit file, T989_PIT_(Modified,8GB).zip, skip to the next section of the guide: "Flashing .PIT File Through ODIN")

Launch PIT Magic and click "Open". Select the .pit file you downloaded.

Click on PIT Entry List - this will open a drop-down menu. You will see 28 entries, each is a partition (for comparison, the international I9100 model only has 12 PIT Entries). For reference, I will include their names and sizes below (the info below is actually that of a Skyrocket, the AT-T variant of the phone. But the file structure is the same for our device).

#00 100MB SMD_HDR (partition info)
#01 500KB SBL1 sbl1.mbn
#02 1500KB SBL2 sbl2.mbn
#03 1KB (unnamed partition with '55 AA' MBR signature)
#04 500KB RPM rpm.mbn
#05 2MB SBL3 sbl3.mbn
#06 2500KB ABOOT aboot.mbn
#07 10MB BOOT boot.img
#08 500KB TZ tz.mbn
#09 500KB SSD n/a (empty partition)
#10 500KB PIT celox.pit
#11 10MB PARAM param.lfs
#12 98MB MODEM amss.bin /system/etc/firmware/misc
#13 3MB MSM_ST1 efs.img
#14 3MB MSM_ST2 n/a
#15 3MB MSM_FSG n/a
#16 98MB MDM mdm.bin /system/etc/firmware/misc_mdm
#17 3MB M9K_EFS1 efsclear1.bin
#18 3MB M9K_EFS2 efsclear2.bin
#19 3MB M9K_FSG n/a
#20 10MB DEVENC enc.img.ext4 /efs
#21 10MB RECOVERY recovery.img
#22 3MB FOTA n/a
#23 598MB SYSTEM system.img.ext4 /system
#24 2GB USERDATA userdata.img.ext4 /data
#25 302MB CACHE cache.img.ext4 /cache
#26 129MB TOMBSTONES tomb.img.ext4 /tombstones
#27 11.2GB UMS ums.rfs /mnt/sdcard

The only entry you actually have to alter is #24. When you select it under PIT Entry List, you will see it listed with:

Block Size: 512

Block Count: 4,198,400

Since each block is 512KB, that effectively results in 2,149,580,800 KB (2GB). Now, we want to increase this, so just enter a larger value in the "Block Count" field. For ease of calculations, I recommend simply using a multiple of the default value (so if you double the value, you get 4GB for the /data partition. Triple it and you get 6GB, and so on).

Now, what about the UMS (internal SD) partition? The short of the long is, you don't need to touch it (for our device). In the guide for the I9100 model, it mentioned having to adjust the value for the UMS partition manually - but if you view the UMS partition (#27 in the PIT Entry List), you will see that it's listed with the following attributes:

Block Size: 512

Block Count: 10

Obviously, the UMS partition can't be only 5,120KB in size, so I presumed that our device automatically adjusts the size of the UMS partition based on available space. I turned out to be correct in my presumption.

WARNING: Do NOT change the values of any partition other than /data! If you alter the sizes of crucial system partitions (modem, etc.), it can seriously mess up your device. For safety, ONLY change the size of the /data partition as instructed.

After you have altered the value for the /data partition, save it as a new .pit file.

Flashing .PIT File Through ODIN:

Boot your phone into Download Mode. For the T989, this is done by holding Vol+, Vol-, and Power button at the same time. You will see a warning message about custom ROM's. Press Vol+ to continue, then connect your phone to the PC via USB.

Launch ODIN. Make sure device shows as connected (use a good USB cable!!!) Click the "PIT" button and select the modified .pit file. The checkbox for "Re-Partition" should automatically be checked when this happens.

Click "Start", and ODIN will re-partition the memory on your device as specified by the .pit file.

When ODIN is done, the device will automatically restart (unless you told ODIN not to do so). When this happens, hold the VOL+ key to boot into Recovery (the re-partition shouldn't have affected the Recovery partition, at least in my case it didn't. If it did somehow, you can just flash Recovery through ODIN).

Now, in Recovery, you may notice a series of "Failed to mount /_____ (partition name)" errors. Don't worry - this is because the partition info has changed but they haven't been re-formated yet. You just have to manually re-format them. To do so, click "Wipe" --> "Advanced Wipe" --> "Repair or Change File System" --> "Select Partition to Repair or Format" --> "Change File System" --> "EXT4" (or F2FS, if your ROM and Recovery supports it). Note that you will have to do this individually for each of the partitions (when I tried to simply do a wipe of all the partitions, it resulted in errors). Make sure you do not use the "Repair" function, it won't work for this!

After you have re-formatted all the partitions, you can now check the /data and /sdcard to make sure they are now the desired size (before you re-formatted the partitions, many of them will show 0MB for size; don't freak out. The correct size will show once re-formatted). If you have increased the size of the /data partition, the /sdcard partition should have received an automatic reduction in size.

After you have done the above steps, you can then proceed with ROM installation or recovery. Feel free to check the "Storage" info under System Settings to see if the partition sizes are correct. :)

(

Left:

Size of the /data partition on my T989.) (

Right:

Size of the /sdcard partition on my T989.)​

I Messed Up Somehow & My Phone Appears To Be Bricked! What Should I Do???

Don't panic. Plenty of people have bricked their phones and recovered. Re-partitioning the phone's memory does NOT damage the hardware (I don't see how it could), so as long as ODIN can still detect your phone, you should be able to restore the original memory structure (flash the unmodified .pit file) and flash Recovery. If in doubt, ask for help. :)