Jump to content

Partition layout change


Guest rjm2k

Recommended Posts

I'm part of the way there, I've unmounted the cache partition & symlinked it to a directory under /data added the commands to userunit.sh to do it on boot & added a command to clear the cache on every boot too. Everything still works.

Now I just need to shrink the cache partition, move the system partition & add the extra space to /data hopefully giving us almost 330mb /data

Link to comment
Share on other sites

Guest oh!dougal
... Everything still works.

Now I just need to shrink the cache partition, move the system partition & add the extra space to /data hopefully giving us almost 330mb /data

Good of you to work on this.

I don't think /cache is actually used for very much (other than apk install!)

But would it be possible to add some debug code to "watch" /cache and report/log its usage?

It might be good to know WHEN it was used before people start moaning in random places about misc strangenesses when they had "plenty" of space left on /data ! :lol:

Link to comment
Share on other sites

But why does the free space in the ("42mb") 'download cache' as viewed from Android System Info change after each download I have made from Market?

Perhaps, for reasons best known to ZTE, apk's are moved through /cache?

And the change was without doing other activity on the phone. Naturally, I haven't been doing OTA upgrades - ZTE are not HTC! :lol:

Also note

The main use of /cache is for dalvik-cache. That can be redirected to /data. It also appears to be used to download apps before they are installed so it may always need a bit of space.

Adding dalvik.vm.dexopt-data-only=1 to build.prop should redirect dalvik-cache to /data.

10MB is probably enough for downloads. They don't stay there, it should only be until they are installed. Alternatively you could play with symlinks or bind mounts so that /cache and /data are on the same partition.

Link to comment
Share on other sites

Guest oh!dougal
The main use of /cache is for dalvik-cache. That can be redirected to /data.

Tom I'm pretty damn sure that /data dalvik-cache is standard Blade behaviour.

10MB is probably enough for downloads. ...

People have been having trouble with 20+mb game downloads .... !

Link to comment
Share on other sites

The main use of /cache is for dalvik-cache. That can be redirected to /data. It also appears to be used to download apps before they are installed so it may always need a bit of space.

Adding dalvik.vm.dexopt-data-only=1 to build.prop should redirect dalvik-cache to /data.

10MB is probably enough for downloads. They don't stay there, it should only be until they are installed. Alternatively you could play with symlinks or bind mounts so that /cache and /data are on the same partition.

dalvik-cache is already on /data.

The downloads do appear to stay there for a while, I'm not sure if or when they get deleted automatically, but it isn't immediately after install.

I played with symlinks last night & it works. However, I'm unmounting the cache partition & creating the symlink on boot using userinit.sh . I tried editing init.rc to prevent /cache from mounting, but it seems if I change that file my changes don't stick.

What file do I need to edit to prevent /cache from ever being mounted & create a symlink to /data/cache instead?

These are the commands I used to redirect /cache to /data/cache

mkdir /data/cache 0770 system cache
mkdir /data/cache/recovery 0770 system cache
mkdir /data/cache/lost+found 0770 root root
ln -s /data/dalvik-cache /data/cache/dalvik-cache
rm /cache/*.apk
rm /data/cache/*.apk
umount /cache
rmdir /cache
ln -s /data/cache /cache
[/codebox]

Not noticed any ill effects, market still works, installing apps still works & the downloaded apks end up in /data/cache.

Now I just need to do some hex editing to reclaim most of that 42mb wasted space.

I don't think I'm going to have time to produce a proper rom to release. I'm just going to edit the partition table in the jap jelly image install, use that to set the /cache partition really small & move the unused space to /data, then restore my nandroid backup on top of it. I'll share the hex edited files & the method.

Edited by wbaw
Link to comment
Share on other sites

Guest oh!dougal
...

What file do I need to edit to prevent /cache from ever being mounted & create a symlink to /data/cache instead?

...

I don't think I'm going to have time to produce a proper rom to release. I'm just going to edit the partition table in the jap jelly image install, use that to set the /cache partition really small & move the unused space to /data, then restore my nandroid backup on top of it.

The original mounting of /cache is way back close to the 'big bang' of Linux bootstrap ...

MUCH simpler to do as you suggest, but actually, I would think that 'proof-of-concept' is the thing, rather than optimisation.

Specifically, I wouldn't be worrying (for now) about just exactly how small /cache could go ...

If you leave it at 1mb or so, then you shouldn't be running into any system-use-before the-redirect-is-established issues.

Regain 41mb, with as little fuss as possible, and then worry about the last 1mb later ... ! :lol:

ADDED --

rm /cache/*.apk

rm /data/cache/*.apk

instead, how about copying everything *.* found in /cache to /data/cache ? (and THEN wipe it)

that should prevent any surprises!

Edited by oh!dougal
Link to comment
Share on other sites

The original mounting of /cache is way back close to the 'big bang' of Linux bootstrap ...

MUCH simpler to do as you suggest, but actually, I would think that 'proof-of-concept' is the thing, rather than optimisation.

Specifically, I wouldn't be worrying (for now) about just exactly how small /cache could go ...

If you leave it at 1mb or so, then you shouldn't be running into any system-use-before the-redirect-is-established issues.

Regain 41mb, with as little fuss as possible, and then worry about the last 1mb later ... ! :lol:

ADDED --

rm /cache/*.apk

rm /data/cache/*.apk

instead, how about copying everything *.* found in /cache to /data/cache ? (and THEN wipe it)

that should prevent any surprises!

It appears to only be used for downloaded app install files. I did think about moving/copying it, but there's really no point. It's just a couple of empty directories, downloaded apk files & a symlink to dalvik-cache. I just recreated the directory structure in /data/cache & it's fine.

The rm lines are just to clear out any apk files left in those directories, they aren't deleted as quickly or often as they could be & they aren't needed after an app has installed. Having those run on boot prevents it from swallowing too much of the data partition.

I can see in init.rc where /cache gets mounted, I just can't change it, any changes I make to that file seem to get overwritten on boot, it must be generated by something else...

I'm all about optimisation, even pointless ones like this, it's an obsession. I've got all the apps I want to install & still got 120mb free on /data thanks to move2sd & a 128mb /system partition, I don't have any use for this, it just annoys me that there's 42mb wasted for something pointless on a phone with ~512mb internal storage. I think I'll have to shrink it, rather than remove it, because I've got to hex edit the partition sizes in binary files, I don't think removing the partition would work. If I could stop /cache from being mounted, it'd be better than my current workaround & it'd save milliseconds off the boot time ... yes I am mental.

Edited by wbaw
Link to comment
Share on other sites

OK, it seems to work. It gives a few error messages in blade recovery, no problems other than that, I now have a 328.5MB /data partition :lol:

I've attached the modified partition layout, in case any rom builders want to use it, usual disclaimers apply, you also need to add the commands from my previous post to the end of /system/bin/userinit.sh

[edit] file removed, safer version in my last post

Edited by wbaw
Link to comment
Share on other sites

E:Can't mount CACHE:recovery/command

E:Can't mount CACHE:recovery/log

Are the errors that seb's ra recovery gives the second one is repeated twice every time I do anything. I hope they aren't important, it all seems to work.

Edited by wbaw
Link to comment
Share on other sites

Guest oh!dougal
...

I'm all about optimisation, even pointless ones like this, it's an obsession. ... If I could stop /cache from being mounted, it'd be better than my current workaround & it'd save milliseconds off the boot time ... yes I am mental.

E:Can't mount CACHE:recovery/command

E:Can't mount CACHE:recovery/log

Are the errors that seb's ra recovery gives the second one is repeated twice every time I do anything. I hope they aren't important, it all seems to work.

How small have you made /cache?

Like I said, we don't know who/what all might expect to be able to temporarily use a bit of space there.

After the system has booted properly, its redirected to /data -- but when it hasn't fully booted normally (as with recoveries), its not (if I understand correctly) going to be redirected. So, leaving just enough space to avoid trouble would seem optimal to me!

The best mods are those that are invisible, with no rough edges whatsoever.

The optimum might not be to absolutely maximise the /data freespace.

Link to comment
Share on other sites

I made the cache 3 sectors, same size as that misc partition, I'm not sure how big a sector is ... but I think it might be a little too small, it wont mount at all. The only problem I can find is that error message, everything still works in seb's recovery & there are no problems with the rom, once it's symlinked to a directory in data.

I even let a plain jj8 boot with the modified cache size, but no symlink & it booted, but I'd expect problems with app installs without the symlink.

The way to find out what uses the /cache partition is to break it & see what else breaks. That's what I've done & it doesn't seem like much breaks, although there's still further testing to be done.

If anybody else wants to try it, I attached the files to add to a tpt image & the commands to add to /system/bin/userinit.sh just don't blame me if you break your phone (hopefully another known working tpt image will fix it). Anyone is free to use it in their tpt rom.

Edited by wbaw
Link to comment
Share on other sites

Guest oh!dougal
The One way to find out what uses the /cache partition is to break it & see what else breaks. That's what I've done & it doesn't seem like much breaks, although there's still further testing to be done.

:lol:

Link to comment
Share on other sites

Dougal - the other ways take too long :lol:

It might be better to increase the cache size to a few mb, just to make sure nothing breaks, but I'm going to leave it as it is for now & see what happens.

What I posted is still an extreme hack for extremists, that's why I haven't done a step by step guide. If anybody wants to refine it into something safer & simpler, be my guest.

Edited by wbaw
Link to comment
Share on other sites

OK, a saner version

/cache = 4.5 mb

/system = 128 mb

/data = 324.4 mb

No errors in recovery mode. Still going to need to unmount & add the symlink in userinit.sh so that you can install large aps, if you use this.

Also, you're going to have to make sure there is plenty of space left on /data if you want to install any apps ... so you only really gain a few megs.

shrink_cache_sane.zip

Edited by wbaw
Link to comment
Share on other sites

Is there any way you can detect when and apps installs and clear the cache say 5 minutes later?

Ideally it'd clear them out as soon as the app had installed, at least with JJ8, it doesn't seem to. I'm clearing them on boot using userinit.sh, unmounting the cache partition & redirecting it to /data/cache.

Link to comment
Share on other sites

Guest Ashenfall

Just a possible suggestion - I don't know much about the internal workings, so this might not be feasible...

How about symlink'ing cache to the SD card instead, like pre-Froyo Apps2SD would? That way, you could still install large applications as long as you have space on SD card 'cache', but then have more space for applications on /data.

Link to comment
Share on other sites

Just a possible suggestion - I don't know much about the internal workings, so this might not be feasible...

How about symlink'ing cache to the SD card instead, like pre-Froyo Apps2SD would? That way, you could still install large applications as long as you have space on SD card 'cache', but then have more space for applications on /data.

I thought about that too, I think it'd be fairly safe as long as you don't want to install apps while the sd card is mounted over usb. File permissions aren't supported on FAT partitions either, but I'm not sure that's important. Also there's a symlink to dalvik-cache, I'm not sure we can have symlinks on a fat partition. It could be made to work with an ext2/3/4 sd card partition.

I think /cache is only used in recovery mode & for installing apps, recovery mode ignores any symlinks & mounts the partition directly, so it wouldn't be affected.

Link to comment
Share on other sites

Guest IronDoc
I thought about that too, I think it'd be fairly safe as long as you don't want to install apps while the sd card is mounted over usb. File permissions aren't supported on FAT partitions either, but I'm not sure that's important. Also there's a symlink to dalvik-cache, I'm not sure we can have symlinks on a fat partition. It could be made to work with an ext2/3/4 sd card partition.

I think /cache is only used in recovery mode & for installing apps, recovery mode ignores any symlinks & mounts the partition directly, so it wouldn't be affected.

No I don't think FAT supports symlinks. You sure having unused space for cache in an SD card partition is optimised enough for you? :lol:

Link to comment
Share on other sites

I don't even have an ext2/3/4 partition on my sd card (just fat & swap), i thought better of putting it on the fat partition & i do actually have a load of free space on /data, even more since repartitioning.

Link to comment
Share on other sites

I noticed that JJ8's /system is 116mb, I think we could possibly get away with a 1mb cache partition & there's another 1mb free on /boot, if I get daring.

So I think I can add about another 12mb to /data then I can forget how to add & subtract in hexadecimal again.

Link to comment
Share on other sites

Guest Phoenix Silver

i am using a2sd

cache is in an ext3 part

apps are here too

works fine all automatic for ALL apps

i don't care about the life of the sdcard :lol:

Link to comment
Share on other sites

i am using a2sd

cache is in an ext3 part

apps are here too

works fine all automatic for ALL apps

i don't care about the life of the sdcard :lol:

I'm using move2sd with the google froyo apps2sd on a fat partition. I've resized all my internal storage partitions, I have every app I want & 140mb free on /data now, I'm going for over 150mb... so I'll have plenty of space for apps on internal storage & my 8gb sd card for apps that i don't mind being on sd card.

Why did you move your cache to ext3? It'd seem very pointless with your config. Are you sure you did it? I just moved it to /data to reclaim some wasted internal storage space. You probably mean you moved dalvik-cache, which is a totally different issue.

Anyway, this thread is about repartitioning your phone's internal storage, not the sd card, that's too easy.

Edited by wbaw
Link to comment
Share on other sites

Here is today's partition layout, it seems to work well.

335mb seems to be the most I can get onto /data without making /system or /cache too small. I found out that a 1mb /cache partition is too small & gives errors, but 1.5mb works, this seems to be the minimum possible working size for /cache. I didn't alter recovery, boot or splash, possibly another couple of mb to be gained there, but I didn't want to risk it. I shrunk /system to 120mb, jj8 is only ~116mb, so there's still some breathing room there.

so

/cache = 1.5mb

/system = 120mb

/data = 335.35mb

I also noticed there is 42mb before the first partition (recovery), I assume that's where the hidden partitions are & what gets written to by the mbm files in the hungarian update...

		start	size
????? 0x000 0x156 = 42.75mb
recovery 0x156 0x024 = 4.5mb
boot 0x17A 0x024 = 4.5mb
splash 0x19E 0x00C = 1.5mb
misc 0x1AA 0x003 = 0.375mb
cache 0x1AD 0x00C = 1.5mb
system 0x1B9 0x3C0 = 120mb
userdata 0x579 0xA7B = 335.375mb
persist 0xFF4 0x00C = 1.5mb
[/codebox]

cache_shrink_0.3.zip

Link to comment
Share on other sites

The recovery program just seems to use the cache partition to write it's logs to, so 1.5mb should be plenty for that. It doesn't give any errors at that size. For some reason it wont mount at all if it's 1mb or less, but I'm not worried about that.

I think it's almost ready to start a new thread for & do a guide, just need to do a little testing first...

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.