[MOD][TWRP][RECOVERY] Reclaim the whole free space of your system partition - Nexus 10 Android Development

Hello,
many users complain that since lollipop their system partition size doesn't reflect the actual system of the block device. Therefore, they can not install some extra in this partition( busybox, big gapps packages,etc.).
This is due to the system image size specified when building the rom:
One of the parameter of your system partition(which has been hardcoded in some config file, I.e. BoardConfig) is its size, but if the block device(i.e. the part of your internal storage that will be mounted for the system partition)'s size that is mounted is larger than the system partition's size than you will loose some space.
TWRP has included this feature into their recovery from 2.8.7.0 and onwards ! You don't need to get my flashable package if you got a newer version than this.​
Fortunately resize2fs executable allows to modify an ext2,ext3,ext4 partition size:
linux man page said:
The resize2fs program will resize ext2, ext3, or ext4 file systems. It can be used to enlarge or shrink an unmounted file system located on device. If the filesystem is mounted, it can be used to expand the size of the mounted filesystem, assuming the kernel supports on-line resizing. (As of this writing, the Linux 2.6 kernel supports on-line resize for filesystems mounted using ext3 only.).
Click to expand...
Click to collapse
This package simply resizes your system size to match the size of your block device size.
It does not alter your partitions table just reclaim the unmounted space.
Instructions:
Boot on a twrp 2.8.x.y TWRP recovery
flash the package
Download :
https://drive.google.com/file/d/0B9kxrJw-dzUmNG12QkdaU3R4Ujg/view
Credits :
@m11kkaa from whom I took the idea

Lets see if I understood this correctly. Currently in Lollipop the system partition is smaller than the block where the partition resides? And if the partition size doesn't match the block size, you will loose the remaining space on the block? The remaining space on the block is not available to any other partition?

That's correct. Your system partition is mounted with am 800 mb allocated space. Depending on your ROM ypou might loose some space.
Here I got 437 mb of free space .
Sent from my nexus 10

Tried it and my system partition went from 643.7MB to 787.9MB in size on Lollipopalooza. That definetily helps with installing gapps as last time I had to leave off quite a few apps to get it to fit. So just to make sure, this extra space isn't taken from any other partition? It just made the system partition use the unallocated free space on the block?

Which app do you use to see partition sizes? How can I see what it is vs what it should be? Thanks.

CazeW said:
Tried it and my system partition went from 643.7MB to 787.9MB in size on Lollipopalooza. That definetily helps with installing gapps as last time I had to leave off quite a few apps to get it to fit. So just to make sure, this extra space isn't taken from any other partition? It just made the system partition use the unallocated free space on the block?
Click to expand...
Click to collapse
Exactly.it corrects some internal ext4's variables that represents the size of fs to match the block's
lepa71 said:
Which app do you use to see partition sizes? How can I see what it is vs what it should be? Thanks.
Click to expand...
Click to collapse
There are plenty out there . I use fx embedded filesystem's analysis

Excellent! I have one more question. As we know, modifying the system partition means that otas will fail. So if before I had to uninstall say Play Movies to make room for busybox, then I'd have had to reinstall it if I wanted to flash an OTA. With this method, the md5 signature of system isn't altered, and therefore otas wont fail, right?

You are on aosp ?

Khaon said:
You are on aosp ?
Click to expand...
Click to collapse
Stock factory image + root, uninstalled Play Movies to make room for busybox

Do I need to do anything?

You used my mod right ?
Best way is either issue
df in a terminal console or install this app
https://play.google.com/store/apps/details?id=com.cls.partition
It will display the actual filesystem size .disk info display the size of your ssd
Sent from my nexus 10.

Khaon said:
You used my mod right ?
Best way is either issue
df in a terminal console or install this app
https://play.google.com/store/apps/details?id=com.cls.partition
It will display the actual filesystem size .disk info display the size of your ssd
Sent from my nexus 10.
Click to expand...
Click to collapse
Thank you very much for your mod.
I want to try it but I'm a little bit afraid. Do I lose any data? Will this affect the installation of other ROMs? I'm on stock now but I want to try some custom ROMs to decide. Do I have to use your mod every time I install a new ROM?
Thanks in advance!

You won't loose any data it will adjust the size of ext4 fs to the actual physical size of your partition.
Flashing a new lollipop ROM flashes a new system image which specifies the image size.
Our device system image size is defined here https://github.com/CyanogenMod/android_device_samsung_manta/blob/cm-12.0/BoardConfig.mk#L64
685768704 is 654 megabyte but your mmcblk0p8 partition mounted on /system is 800 mb.
Until this is fixed. Will open a ticket to increase this value but there are maybe few reason google chose 654.
And yes you must reflash it each to flash
Sent from my nexus 10.

If you replying to my question then I didn't do anything. I'm asking I should do it.
Is this only for CM based roms?
Thanks
Khaon said:
You used my mod right ?
Best way is either issue
df in a terminal console or install this app
https://play.google.com/store/apps/details?id=com.cls.partition
It will display the actual filesystem size .disk info display the size of your ssd
Sent from my nexus 10.
Click to expand...
Click to collapse

lepa71 said:
If you replying to my question then I didn't do anything. I'm asking I should do it.
Is this only for CM based roms?
Thanks
Click to expand...
Click to collapse
any roms

Khaon said:
any roms
Click to expand...
Click to collapse
I installed the app you said, but I didn't see any unclaimed space. Is your mod for stock ROM as well? I seem to have 644MB of space on the /system partition.
Sent from my Nexus 10 using Tapatalk

_Raziel666 said:
I installed the app you said, but I didn't see any unclaimed space. Is your mod for stock ROM as well? I seem to have 644MB of space on the /system partition.
Sent from my Nexus 10 using Tapatalk
Click to expand...
Click to collapse
Well the maximum space you system partition can get is 800mb. The system of je partition number 8.
Thus you are looking space.
The resizes just fixes that
Read this post.
http://forum.xda-developers.com/showthread.php?p=59016220
Sent from my Xiaomi MI2s.

So mine shows 800 for system partition. Does this mean I don't have to do anything? Thanks

Khaon said:
You used my mod right ?
Best way is either issue
df in a terminal console or install this app
https://play.google.com/store/apps/details?id=com.cls.partition
It will display the actual filesystem size .disk info display the size of your ssd
Sent from my nexus 10.
Click to expand...
Click to collapse
Don't use disk info but rather one of tje two over here.
Sent from my Xiaomi MI2s.

lepa71 said:
So mine shows 800 for system partition. Does this mean I don't have to do anything? Thanks
Click to expand...
Click to collapse
Yes, if your system partition is already 800MB in size then you're already using the whole block.

Related

[Q] how to get bigger EXT2 part for data

Hi.. i think EXT2 Partition for data has 256MB.. and i want make it bigger.. maybe 512MB maybe 1GB. please, how to do it
Same way you got the partition you have, by repartitioning the SD card.
Sent from my HTC Dream using Tapatalk
zenity said:
Same way you got the partition you have, by repartitioning the SD card.
Sent from my HTC Dream using Tapatalk
Click to expand...
Click to collapse
Maybe he means the data img that is created while running from haret?
no.. im on NAND. i have EXT2 partition on my Sdcard and it has 1gb.. but in system i can see only 256mb.. why?
i don`t know why but i have the same problem and the bloody data.img is stored on the fat partition not on ext2 partition can somebody explains that?
Use bsg and change data.img size in the generated script.
i will try it.. thanks
l1q1d said:
Use bsg and change data.img size in the generated script.
Click to expand...
Click to collapse
i saw your program, but i cat find there any properties how to change data.img
how i can change size of it?
i just release a new version with this option (and other)

Any way to reclaim integrated memory space?

Hi guys,
I was wondering, now that I no longer use a TouchWiz-based ROM, if there's an easy way to reclaim the "lost" space available in the /system folder after flashing a now much small ROM. I know TW-based ROMs use at least 1GB of space, if not more, but my current ROM barely pushes 200MB used of the /system folder, leaving with me a lot of unused space I would like to use for the integrated storage.
Regards
gonXed said:
Hi guys,
I was wondering, now that I no longer use a TouchWiz-based ROM, if there's an easy way to reclaim the "lost" space available in the /system folder after flashing a now much small ROM. I know TW-based ROMs use at least 1GB of space, if not more, but my current ROM barely pushes 200MB used of the /system folder, leaving with me a lot of unused space I would like to use for the integrated storage.
Regards
Click to expand...
Click to collapse
It's about partitions, no matter what rom you use.
Imagine you have a 1gig harddisk. You partitioned it into four 250gig harddisks as C,D,E,F
You have installed Windows 7 on C drive but then you installed XP to save some spaces for the harddisks D,E,F
Would it be possible? No!
You have to resize all the partitions which would cause you bigger problems.
I think is something to do with the pit files.
I read something about Sammy offering a new Flash for the s4 with some Chinese rom that enables them to get another couple gig space whilst losing some trash.
I hope we can get something similar either officially or through our devs
Sent from my GT-N7105 using xda app-developers app
[email protected] said:
It's about partitions, no matter what rom you use.
Imagine you have a 1gig harddisk. You partitioned it into four 250gig harddisks as C,D,E,F
You have installed Windows 7 on C drive but then you installed XP to save some spaces for the harddisks D,E,F
Would it be possible? No!
You have to resize all the partitions which would cause you bigger problems.
Click to expand...
Click to collapse
I don't think I follow you. You're telling me resizing partitions is not possible? Theoretically, it is with any type of filesystem and partition table that supports differently sized partitions/blocks. I'm not asking if it's possible to do it, I'm asking if it's possible to do it in an easy way.
My question wasn't if it was possible to do it with the new ROM, I was asking if it was possible to do, now that I have some abundant disk space for /system.
On my Nokia N900 this was extremely straightforward as I basically had the full GNU coreutils available - and with some hacking I resized the partitions to better fit my needs - and even flashed the fat32 filesystem to ext3 while I was at it.
And since it's possible with S4 as 3vo3d mentioned, there's no reason it shouldn't with the GN2.
gonXed said:
I don't think I follow you. You're telling me resizing partitions is not possible? Theoretically, it is with any type of filesystem and partition table that supports differently sized partitions/blocks. I'm not asking if it's possible to do it, I'm asking if it's possible to do it in an easy way.
My question wasn't if it was possible to do it with the new ROM, I was asking if it was possible to do, now that I have some abundant disk space for /system.
On my Nokia N900 this was extremely straightforward as I basically had the full GNU coreutils available - and with some hacking I resized the partitions to better fit my needs - and even flashed the fat32 filesystem to ext3 while I was at it.
And since it's possible with S4 as 3vo3d mentioned, there's no reason it shouldn't with the GN2.
Click to expand...
Click to collapse
No, I didn't say that you cannot resize partitions
I said that you cannot gain more space in other partitions by just installing a lighter OS. I said exactly what you said in the rest.

Repartition Note 2?

I just installed CM10.2 on my i317 and was amazed how much left-over space there is in /cache and /system. Is there a way to repartition it so I can use that extra 1.5GB of space in /data?
So far, it looks like this:
/system - 1763MB total (444MB used)
/cache - 1259MB (110MB used)
Can I shrink /system down to ~768MB (for future updates like KitKat) and /cache down to ~512MB?
Um.. Anyone?
It seems that repartitioning is a taboo in these parts.
Simba.7 said:
Um.. Anyone?
It seems that repartitioning is a taboo in these parts.
Click to expand...
Click to collapse
I wouldn't do it. This was more of an option for earlier builds where you needed to put part of your system on the sd. Unless the rom you want says to do it I wouldn't mess with it.
Sent from my GT-N7105 using XDA Premium 4 mobile app
So, I'm stuck with 1.5GB of wasted, unused space. That sucks.
Simba.7 said:
So, I'm stuck with 1.5GB of wasted, unused space. That sucks.
Click to expand...
Click to collapse
I haven't used cm11 but I believe you can change the size of your system memory. Either way when you leave a tw rom you gain something like 4gb of memory back.
Simba.7 said:
So, I'm stuck with 1.5GB of wasted, unused space. That sucks.
Click to expand...
Click to collapse
Lol. If you want to use it so bad put your user apps on the system partition. Problem solved
--》Sent from my mind to your screen

Partition resizing

I have 1.8GB of free space on my SYSTEM partition. Is there any way to shred that down so I can have more space on my DATA partition?
I'm running cm12.1 on my t805
slobodan0104 said:
I have 1.8GB of free space on my SYSTEM partition. Is there any way to shred that down so I can have more space on my DATA partition?
I'm running cm12.1 on my t805
Click to expand...
Click to collapse
As far as I know it is not possible because system partition size is fixed in source of the ROM. Theoretically it could be done but I am not sure if custom recovery also needs to be customised like ROM? I think best solution would be to buy large sdcard (64GB) ?
T.
Sent from my SM-T805 using Tapatalk
It is somewhat possible to resize partitions by adjusting the parameters in the pit file.
However how risky this is for the sake of what, 1.5gb, I don't know?
The better option, if you don't want to waste that space, is to use it.
Move your apps from user to system apps.
Its easy enough to do and can be accomplished with little effort using apps already available and with the bonus of gaining the extra space on the data partition.
Thanks guys. I just moved some of my bigger apps to system partition.

[Question] Resizing partitions with TWRP

I have a brand new G3 (D852) with Koodo that I just got 2 days ago. I've rooted, installed TWRP and flashed a few AOSP roms. Not a fan of any manufacturer UI, even though LG's is very minimal, so AOSP it is. I noticed that my system partition has more than 1GB of free space after everything is flashed and good to go. I also noticed that the latest TWRP (2.8.7.0) has a resize partition option inside the Wipe section. What I want to know is, how can I use this to resize the system and data partitions so that 1GB+ isn't being wasted and unused. I'd really like to get that 1GB+ added to my data partition for apps.
I've tried using it. The only time it didn't spit out an error was after I wiped the system partition. It succeeded in "resizing" it after that, but it didn't change anything. The system partition remained the same size.
ToYeD said:
I have a brand new G3 (D852) with Koodo that I just got 2 days ago. I've rooted, installed TWRP and flashed a few AOSP roms. Not a fan of any manufacturer UI, even though LG's is very minimal, so AOSP it is. I noticed that my system partition has more than 1GB of free space after everything is flashed and good to go. I also noticed that the latest TWRP (2.8.7.0) has a resize partition option inside the Wipe section. What I want to know is, how can I use this to resize the system and data partitions so that 1GB+ isn't being wasted and unused. I'd really like to get that 1GB+ added to my data partition for apps.
I've tried using it. The only time it didn't spit out an error was after I wiped the system partition. It succeeded in "resizing" it after that, but it didn't change anything. The system partition remained the same size.
Click to expand...
Click to collapse
This it why the option is there:
resize2fs feature: On some devices like the Nexus 6, the factory images include a userdata image that is the proper size only for the 32GB units. If you flash the factory image to a 64GB Nexus 6, the data partition will appear as if it only has the free space of a 32GB device. Using the resize2fs option, TWRP can resize your data partition to take up the full space available. The resize2fs may also be useful to resize system partitions on devices where custom ROM system images don’t take up the full partition space. Lastly, resize2fs may be useful in some cases to reserve the proper space at the end of a data partition for a full disk encryption key, should your partition be formatted incorrectly for some reason.
jeffrey268 said:
This it why the option is there:
resize2fs feature: On some devices like the Nexus 6, the factory images include a userdata image that is the proper size only for the 32GB units. If you flash the factory image to a 64GB Nexus 6, the data partition will appear as if it only has the free space of a 32GB device. Using the resize2fs option, TWRP can resize your data partition to take up the full space available. The resize2fs may also be useful to resize system partitions on devices where custom ROM system images don’t take up the full partition space. Lastly, resize2fs may be useful in some cases to reserve the proper space at the end of a data partition for a full disk encryption key, should your partition be formatted incorrectly for some reason.
Click to expand...
Click to collapse
Thank you for the reply
If I understand you correctly, the feature's original intent is to resize /data partitions in the event the rom/system image treats a larger storage capacity device as a lower capacity one, ie. 64GB device is treated like 32GB so /data will only reflect 32GB minus (system image install size), wasting 32GB and leaving it inaccessible to the user.
However, it also seemed like you were saying I also could use it to resize my /system partition to a smaller size so CM12.1 (with it's ~900MB install size after Full TK-Gapps) will only leave ~50MB to ~100MB on /system instead of ~1.5GB. However, the question remains. How do I do this and can I reallocate the ~1.5GB to the /data partition for apps and internal storage? If this can't be done then I see no point in resizing /system to begin with as it will still be inaccessible to me as the user.
ToYeD said:
Thank you for the reply
If I understand you correctly, the feature's original intent is to resize /data partitions in the event the rom/system image treats a larger storage capacity device as a lower capacity one, ie. 64GB device is treated like 32GB so /data will only reflect 32GB minus (system image install size), wasting 32GB and leaving it inaccessible to the user.
However, it also seemed like you were saying I also could use it to resize my /system partition to a smaller size so CM12.1 (with it's ~900MB install size after Full TK-Gapps) will only leave ~50MB to ~100MB on /system instead of ~1.5GB. However, the question remains. How do I do this and can I reallocate the ~1.5GB to the /data partition for apps and internal storage? If this can't be done then I see no point in resizing /system to begin with as it will still be inaccessible to me as the user.
Click to expand...
Click to collapse
I read a few things online and it seems you need aan unlocked bootlader, the G3 bootloader is not unlockable, so you are probily out of luck maby you can ask in the Q&A thread of the rom you are using.

Categories

Resources