[Q&A] 2 GB External Data -- Hefe Hook Kernel and others - Samsung Galaxy S (4G Model)

The Hefe Hook kernel allows you to mount a partition of your microSD as /data, getting 2 GB (or more) for your apps and their data.
Please ask your questions here about installation, use, or general approach.

This is great @jeffsf and can u show me how to re-partition the "real internal" storage? I mean expanding the /system since u put the /data out of it. Thanks man
Sent from my GT-N7000 using Tapatalk 2

daothanhduy1996 said:
This is great @jeffsf can u show me how to re-partition the "real internal" storage? I mean expanding the /system since u put the /data out of it.
Click to expand...
Click to collapse
Yes, you've hit on another of the reasons I've been exploring using the microSD for "live" storage. It's one thing to use potentially slow storage for photos that you basically write once or "app to SD" where you read the APK at boot time, make sure your ODEX in the Davlik cache is good, then generally read from the internal-flash cache. It is another when that memory is being read and written "constantly" when your phone is running.
The good thing is that once /data is not part of the internal flash filesystem, you don't have to worry about one ROM (kernel) thinking it begins at one place and another saying it starts at another. Previously, if one ROM had one /system size and another and a different one, the next partition, /data, would look to be corrupt when you swapped ROMs.
As a warning, not all users have fast microSD cards. Some that say "Class 10" on them really are dogs, especially for small reads/writes. The "Class" ratings are for sustained writes, as you would have with a camera recording video. If your ROM is "external /data" only, or even defaults to that, be prepared for a slew of "Your ROMs sucks. It is so slow." complaints.
You'll also need a way to automate formatting the card. It can be done on the phone, as long as you aren't trying to preserve any data.
As I recall, the layout of the MTD partitions is done in drivers/mtd/onenand/samsung_galaxys4g.h I would be careful not to move the partition boundary for efs, as you'd have to move the data it contains in your updater script. Repeating the warning about not moving the boot and recovery partitions is probably a good idea as well!
Your build tree may need some of these values, or at least think it needs some of these values. For example, device/samsung/aries-common from the CyanogenMod/cm-11.0 (KitKat) branch calls out NAND page sizes, partition sizes, and flash block sizes. I haven't looked in detail at your build tree so I can't comment on how it might handle things differently than the CyanogenMod one.

itzik2sh said:
Hi
I hope I don't ask anything silly, but please let me know if any of my assumptions is wrong :
1. I take FBi's251's AOKP milestone 6 (ICS 4.0.4)
2. 8GB SDCard was formatted to FAT32 (4GB) and EXT3 (4GB) using TWRP kernel
(Beastmode's proton kernel to be exact).
3. I would flash this kernel and it would move apps and their data to the sd-ext
without any special additions.
Thanks. I read the thread, but unfortunately 8GB SD is what i have and I think it should be enough.
Thanks again.
P.S - it's for 2 guys I already sold them my SGS4Gs. I want them to be happy...
Click to expand...
Click to collapse
AOKP should be fine. I haven't tried it recently, but it was the tree in which I did the early Hefe Kernel development.
As I understand it, you have a microSD with
partition 1: 4 GB FAT32
partition 2: 4 GB ext3
So that can work, but will need some tweaking of the init-on-fs.sh script. I intentionally didn't use the second partition as so many scripts gobble that up as sd-ext and do who knows what to it.
My first preference would be to reformat the cards, perhaps:
6 GB FAT32
1 MB ext2/3/4 (Yes, 1 MB, a sliver, choice of ext2, ext3, ext4 up to you)
2 GB ext4
since then the script will work without modification and if they install a third-party script that uses the second partition, it won't corrupt their data.
If you were to keep the formatting the way that it is now, you'd need to edit the mount commands in the script to look something like:
Code:
/system/xbin/busybox umount /data
/system/xbin/busybox mount -t ext3 -o noatime /dev/block/mmcblk0p2 /data
(removing the sd-ext mount)
I'm not sure what your expectations are, but all that the kernel and that script will do is mount a different disk partition on /data -- you need to manually move the data over (or restore from something like Titanium Backup). There may be some trickery in renaming that could be used with TWRP backups to restore from data.yaffs2.win to the new /data partition, but I haven't tried that at all.

Hi Jeff
Thanks for your quick reply, and sorry again for not seeing the Q&A thread.
I think making it :
partition 1: 4 GB FAT32 (sdcard)
partition 2: 2 GB ext3 (sd-ext)
partition 3: 2 GB ext3 (data)
partition 4: 1 MB (spare)
would be better and handle data as well. don't you think ?
Would it be worth doing with a "Team" micro-SD card (class 6 I believe) ?
Thanks.

I haven't tried a Class 6 card, but my gut feeling is that it will be dicey. I didn't "commit" to using /data on microSD until I had tried it for several days using Titanium Backup's ability to move both apps and app data to the external card. I would try that first, especially as the phones in question aren't going to be in your hands (I consider you an expert user, able to manage things outside the UI with ease).
I've attached some testing I did a while ago with Transcend and SanDisk cards. When you look at them, realize that the speed scale changes between them. I have a feeling that the real "performance" on a device is going to be related to relatively small reads and writes, not the ability to stream video to the card. I also don't know much about the Team brand, but I found that even some well-known brands didn't have the performance of the Transcend or SanDisk in the same category.
However you configure your cards, I would definitely recommend a journaling filesystem of some sort. I've had my microSD come loose inside the phone. The journal will at least help to reduce any filesystem corruption should that happen.
You don't need the fourth partition -- I have it there to be able to keep rsync backups for fast ROM swapping.
.

Regarding the apps data, have you tried exploring the Mount2SD script ?
sent from me

I've tried a couple of the scripts out there in the past. Since backing up my data is very important to me, I trust the scripts in Titanium Backup to work well with its backup/restore strategies.
Mounts2SD looks like it has gotten a lot more sophisticated than it was when I tried it in the past. It sounds like something worth trying in its current state. At a quick glance (and not looking at the code), I'd personally make some different choices about features; enabling journaling, and being concerned about why lost+found was filling up (things should only appear there if the file system is found to be corrupt).

Related

[Q] ext2/ext3/ex4 and lynux-swap with incubus RLS14/15

Hi, I have been testing several NAND set-ups
-system to NAND and data to resized data,img
-system to resized system.img and data to resized data.img
-system to NAND and data to ext2
...
I am currently using NAND and data to ext2 partition, so all apps are installed there. After lots of reading I can not understand posts that are obsolete and posts that are not so I would appreciate if someone can explain me the basics and optimal setup for incubus superfroyo RLS14/15 roms:
I have now 4 partitions:
1) fat32,
2) 1,5G ext2 (app, app-private etc),
3) 1,5G ext2 (lost+found folder) and
4) 96M lynux-swap.
- How can I turn ext2 to ext3? do I need to do so? I have also read about ext4. Upgrading to ext3/ext4 applies to my 2) partition, to my 3) partition or to both? will I loose data stored? "there is no ext3/ext4 fs because there isn't the support on the compiled kernel. Ext3/ex4 are journal file system so are bad for limited writing device like nand or sd and thre is no good rease to use it" answered by l1qd1.
- How can I check if my lynux-swap is enabled and used by the rom?
- Do partitions 2) and 3) really need to be <1,5 G? why so?
- Can I take apk from apps folder in partition 2) in case I want to keep them for future fresh installs?
- What is lynux-swap optimal size? a 1,5G partition would be worse than 96 M? Why?
- Which tools are you using with incubus roms to manage installaion location and similar functionalities?
Another big mark I have is about deoxeding installed aps (not belonging to the ROM). Should I do it? why? how?
Pretty basic stuff I guess for experienced users & programmers, but I am new to lynux and android. Have read lots of things but it is difficult to learn by myself what would work with our Polaris and incubus ROMS and dzo/kk kernels,
Stick to ext2 man, you won't turn your old engine to 240mph on a Ford Model T.
You're not getting some major boost if the hardware dosn't use it, so I'd stick with ext2.
And you also want Super FroYo on your ext2 partition, yes? I'm here to help.
- How can I check if my lynux-swap is enabled and used by the rom?
adb shell
Code:
free
if on swap you have 0 it isn't enabled.
Code:
swapon /dev/device
to enable it or i suggest you tu use compcache.
- Do partitions 2) and 3) really need to be <1,5 G? No
- Can I take apk from apps folder in partition 2) in case I want to keep them for future fresh installs? Yes but not all apk support this
- What is lynux-swap optimal size? a 1,5G partition would be worse than 96 M? Why? Too Big = more sparse but it's a problem only for real disk so you can create a swap big as you want but it's unuseful (100 M is enaught)
i suggest you to switch to my kernels because are more updated and kk move to another device.
Yah l1q1d I love ur kernels. Eager for more !
l1q1d, I am testing your kernel as you advised me. I could apply the wifi patch without problems using your androiupdate18-09-10, as you told me some time ago they are both 2.6.25.
However I do not manage to turn linux-swap on: that's what I do: I install ubuntu, I use G-Parted to create partitions on the sd card. When I do so, the third partition is always shown as linux-swap in G-Parted but when I test adb shell -> parted -> print, it always shows as ext2. I can not dismount and can not swap on it.
The other way round, if I deleted all partitions with G-Parted and create the partitions with mkpartsfs or if I use mkfs to change the third partition from ext2 to linux-swap, then sometimes I can swap on it (directly on adb shell or with G-Parted) but when I unplug the device will tell me the card is empty and will not be able to mount it, access it from ubuntu or from the device. If I reboot then, the system will hang until I install both data and sysetm to nand. This happens no matter if I activate or not from the polaris or even if I switch on or off usb mode. The card at that point is useless. I guess the partition table or some other basic file is messed.
Could you please explain a little more how can I come with a 13.5G fat32 partition, a 2,4 ext2 partiions and a 0,1 lynux swap swapped on partition??
I really need to test this set up, since with the standard set-up (system to nand, fat32 for files and ext2 for installed apps I can not install all apps I use since performance drops significantly).
regards
well, ... dumb me, maybe with compcache you are referring to launch a script?
where do I get this compcache.sh? how do I launch it? from adb? from the terminal? from the sd card?...

howto apps2sd as ext4

Ok. So lots of talk about ext for apps2sd and how it's being mounted as ext2 even if you formatted to ext4 etc.
Also talk about how journalling hurts performance and such. We'll tackle all those points here.
1. Howto fix the mounting of your ext partition in the meantime till your mod updates their software.
A. Pre-requisites
You must have already partitioned your sd card with an ext4 fs for apps2sd. You can do this in recovery or some other app.
You should also get the program file expert. It's awesome. But any filemanager that has root ability will work. You can do all this in terminal too so whatever floats your boat. I'll use file expert below.
B. Remount your system fs as read/write (not sure if it's actually needed since /system is mounted rw by most mods already... but it can't hurt). You can do this in file expert by hitting menu and selecting More, then the top option labeled "Mount", select read write. It should say success.
You can also do this in terminal but like i said above, i dont think this is absolutely needed but i always assumed it was so never tried this not doing it.
C. go back down directories using the back key till you hit /. Then goto /system/etc/init.d/
D. select S05mountsd (the S0# isn't important here so if yours is different dont worry). Once selected, hit menu and select file operations. Select permissions and change permissions to read/write all.
E. Open the file with a text editor of choice. Scroll down the file to the part that has the command with -t auto in it. It should be pretty obvious, and it's near the end.
Change -t auto to -t ext4. It doesn't matter if your fs is actually ext2 or ext3, mounting as ext4 is always better. The ext4 block allocator and general code is more efficient even if you dont use ext4 features.
You may also want to add an option to the options list data=writeback. This disables journal caching of actual data and only caches metadata. This is really integral to performance on such a slow medium like sd cards and we'll discuss that later.
Save your file and exit.
F. Reboot your phone. You should now have your sd-ext mounted as ext4.
2. data=writeback and why?
there are multiple modes of journalling available to ext4. The default is ordered. This means that there is a specific order that information is written to the fs to ensure that nothing is lost that is said to be written. This means metadata about the fs and file data is both cached in the journal. Safe but slow.
data=writeback still allows crash protection but means you may lose actual newly written data. Your fs wont be corrupt, but your file may not have gotten those last updates you were writing and had not synced yet. It's a pretty decent compromise.
There are other forms that offer better performance but basically remove journal integrity and we're not concerned with those.
There are also options that determine the interval of journal syncing and you can find that information on ext4 man pages.
Why do we care so much about performance here? because sd flash is slow and finite. A journal file is like swap in that it is a static file that's contents get written to anytime you write to your fs. On a normal hdd, it's not noticeable really but on a class 6 SD card, you are going to notice having to write everything twice to your sd card. So we choose writeback mode to remove that double writing and only cache fs metadata updates so that the integrity of the filesystem isn't hurt, and only that particular file that we crashed prior to syncing gets effected. 99% of the time this is fine and perfectly safe and way better than nothing.
3. So if journalling can hurt performance by using up write bandwidth to a medium we are writing other stuff on, wouldn't swap be bad too?
Yes. Swap should only be put on sd cards if you absolutely need it or your phone wont work. Aside from stressing the card, the bandwidth to read/write is extremely small for something you basically have to be interactive with and move to and from ram. Additionally android complicates matters by managing memory at a higher level than the kernel and this means that swap is ignored as a portion of memory. So while technically userspace apps deal with swap transparently, the low memory manager of android will operate as if you didn't have swap...which defeats the purpose.
Use swap as a last choice.
Also, the ability to make swap partitions and swap files is a common issue in linux-land. It's best to use a partition as this removes fs overhead but it becomes even more of a concern when you put it on an ext4 fs with journalling active. With default settings, a swap file will be considered just another file and the journal will cache the data and metadata updates (very bad for performance). if you use swap on an ext4 fs that's actually mounted as ext4 you _NEED_ to make the data option writeback. You will be very disappointed if you dont.
4. Other important notes:
If you use any ext4 specific options like extents, you will no longer be able to read the files written by recovery programs that have not been updated to mount fs's as ext4. Also, just enabling extents doesn't convert data on the fs to use them. You have to write the files while the option is enabled to see their benefit. This is more easily done by putting the card in an actual linux computer and mounting with the correct options and copying the data from the filesystem and then back again ....not for the novice. Though any new files written will automatically have extents even if you dont redo all current data. So best to bother with that after a fresh install prior to restoring apps.
You may also be thinking... Why do i even need a fat fs, i can make the whole thing ext4 and it will be awesome! You would be right, it would be awesome. But it's not so easy. A couple things have to be done in order to make everything written world rewritable and accessible on such a partition. you would have to setgid to a group like "sdcard" to a directory in this new fs and give it rwx group permissions and then have all users current and future become part of that group and mount bind the directory to /sdcard. Needless to say, recovery apps would have to also be updated. Then you could make your main sd partition any fs your kernel supports.
Nice post, cm7 and diet gb I build already have -t ext3 set, do you think ext4 would make much difference?
ext4 has a better block allocator and other features both backwards compatible and ext4 specific. There's really no reason to not mount ext2/3 and 4 as ext4
Thanks for the answer, This is also in the kernel I compile,
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT23=y
CONFIG_EXT4_FS_XATTR=y
Yes, i began my work on the kernel tonight and noticed that in the latest kernels at least that ext4 is being masqueraded as ext2 and as i thought early on as might be the case, that the reporting of the partition as being mounted as ext2 is a bug that has been squashed in the newest vanilla kernels.
This is still an issue, but not a serious one. FS repair tools and such may bug out when trying to found out what fs they're dealing with as the kernel reports the wrong ext version but the functionality of the fs is not affected ( you still get journalling and all that jazz).
So this is less of a performance issue (cept the adding of data=writeback) and more of an issue with other programs needing to see the correct fs.
Ur Diet 09.05 still did not see ext4 partition by Titanium.
carz12 said:
Thanks for the answer, This is also in the kernel I compile,
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT23=y
CONFIG_EXT4_FS_XATTR=y
Click to expand...
Click to collapse
Sent from my Gingerbread on Sapphire using XDA Premium App
If the kernel you're using is one of the newer kernels (probably anything after 2.6.32...but you should be using something much newer) then it likely doesn't even have ext2 or ext3 compiled in. It's all just ext4 like it should be. The issue you still may have however is that the kernel reports the lower revision extfs because ext4's driver accepts the ext4 fs but the kernel is checking for ext2....
Basically, we are asking if this is an ext2fs. The ext4fs driver answers cuz it's all there is and it's masquerading as ext2 and ext3 and ext4. So it looks and sees ext4 and says, hey, i can read this and returns YES. Now the answer yes was to the question of ext2, so that's what gets reported everywhere, but internally, ext4 knows it's got an ext4 fs. mount options that normally would error out with -t ext2 are accepted because the fs driver isn't really ext2 and it knows the fs isn't either so the mount options pass.
This is a kernel bug in an aesthetic and practical sense. Functionally it's all working as intended but other apps and users will get confused as to what exactly is the filesystem, ext2, ext3 or ext4. It can't know without probing the fs itself. Which is stupid for many applications.
Supposedly the latest kernels have a patch to fix this to correctly report the correct fs revision of ext. Though perhaps that hasn't been pushed to linus's branch yet.
In any case, you still should be modifying the mount options to use data=writeback so you're not clogging up the little SD bandwidth you have with data caching in the journal. You really only need fs metadata caching so you dont bork the entire partition on a crash. data=writeback does that, but default is data=ordered.
thank you for such a good post!

[Q] SD-EXT on SGS4G with CM9?

I'm currently running bhundven's herring CM9 with no kernel modifications and CWM 6. I find that the internal storage for this phone is very low and only holds a small amount of applications, especially since many apps seem to not want to install at all (about 3/4 of the time I try to install things, I get either "Package invalid" or "Insufficient space available", which is extremely annoying and might be a separate problem).
Is there any way that I can get sd-ext to work on this phone with this setup? I'd rather not switch kernels (I'd love to get TWRP recovery but the flashable doesn't work for me and I don't want to switch kernels).
cpkelley94 said:
I'm currently running bhundven's herring CM9 with no kernel modifications and CWM 6. I find that the internal storage for this phone is very low and only holds a small amount of applications, especially since many apps seem to not want to install at all (about 3/4 of the time I try to install things, I get either "Package invalid" or "Insufficient space available", which is extremely annoying and might be a separate problem).
Is there any way that I can get sd-ext to work on this phone with this setup? I'd rather not switch kernels (I'd love to get TWRP recovery but the flashable doesn't work for me and I don't want to switch kernels).
Click to expand...
Click to collapse
I haven't used it but this app should do the trick.
https://play.google.com/store/apps/details?id=eu.codlab.int2ext
Let me know if it works.
I prefer Mounts2SD, which lets you completely configure things. I was running PACman with cache and dalvik offloaded which worked quite well. And free is a good price.
https://play.google.com/store/apps/details?id=com.spazedog.mounts2sd
That seems like it just switches the internal and external storage, not making an ext partition on the SD card. But can things like this really be done through an app? I thought these things had to be done through init.d or build.prop scripts.
Sent from my SGH-T959V using xda app-developers app
The app creates an init file. Or so it appears. Like I said I don't use it. It seems that raze does and I'd defer to him here. Either his app or the one I linked should work fine.
Thanks (given) to both of you. And any ideas on what else might be causing the invalid packages when downloading from the play store? It happens even though I have much more free app space than I would need (eg. I had 119 MB of free space and a 30 MB app download failed).
EDIT: Just tried using Mounts2SD, but it couldn't find the sd-ext partition. Do I need to create that manually, and how?
Sent from my SGH-T959V using xda app-developers app
Titanium backup had a feature to integrate app updates into the Rom.
Sent from my SAMSUNG-SGH-I547 using xda app-developers app
Another way is to create ext4 partition (about 1G is usually enough) on you SD card with free MiniTool Partition Wizard and then use Link2SD to link apps/dalvik to this partition. I've been using it like this for a long time and it works fine. There are plenty of guides on the Web how to do that.
I used CWM or TWRP to create the sd-ext partition. You need to create that first somehow... if MiniTool Partition Wizard will do it without wiping the sdcard, that's better than recovery though.
My method was boot to recovery, mount sdcard, copy everything to computer HD, unmount sdcard, partition sdcard with 2 GB sd-ext (because I wanted lots of space, but I'd probably cut it down to 1 GB next time), mount sdcard, copy everything back from computer HD, unmount sdcard, reboot to system. Then launch Mounts2SD, pick what format you want the sd-ext in (FAT or ext2 are the fastest, but you can take ext3 or ext4 if you're not going to just disable the safety features) and what stuff you want moved over.
Edit: Just found this link, which I haven't used but which explains how to do the sd-ext with MiniTool... apparently MiniTool DOES still wipe the partitions though, so you may as well just use CWM/TWRP and make your life easier.
http://forum.xda-developers.com/wik...#using_MiniTool_Partition_Wizard_Home_Edition
Theraze said:
I used CWM or TWRP to create the sd-ext partition. You need to create that first somehow... if MiniTool Partition Wizard will do it without wiping the sdcard, that's better than recovery though.
Click to expand...
Click to collapse
MiniTool will wipe the sd card to create the new partition as well. I wish there was a way to do it without wiping the card but there is not. So back that stuff up first.
Madein Cyberspace said:
MiniTool will wipe the sd card to create the new partition as well. I wish there was a way to do it without wiping the card but there is not. So back that stuff up first.
Click to expand...
Click to collapse
I used GParted to partition my SD card. NO WIPING. Move, resize, add partitions.
nevkuril said:
Another way is to create ext4 partition (about 1G is usually enough) on you SD card with free MiniTool Partition Wizard and then use Link2SD to link apps/dalvik to this partition. I've been using it like this for a long time and it works fine. There are plenty of guides on the Web how to do that.
Click to expand...
Click to collapse
Yes, but our herring kernel does not support EXT4 partition, I tried it myself
and it didn't work. I had to create EXT3 which is supported by almost all kernels.
Eh, my results varied. Worked fine for me with ext4. And worked fine for my wife as well.
Rebel_X said:
Yes, but our herring kernel does not support EXT4 partition, I tried it myself
and it didn't work. I had to create EXT3 which is supported by almost all kernels.
Click to expand...
Click to collapse
The OP says he's running CM9. That's what I'm running but I use Proton kernel as CM9 kernel has a video bug, and ext4 partition works just fine for me. Strange if Bryan really removed ext4 support, it's just a line in the config file.
Successfully made the partitions last night but my phone won't mount the SD card anymore. Was trying ext3, I'll try ext2 and ext4.
EDIT: Fixed the problem, changed my partition to ext2 and set both partitions to "Primary" (not sure which one did the trick).
cpkelley94 said:
Successfully made the partitions last night but my phone won't mount the SD card anymore. Was trying ext3, I'll try ext2 and ext4.
Click to expand...
Click to collapse
Make sure that you make the first partition Primary/FAT32. This will be your normal SD card. Just take about 1GB of space from it at the end. Then make second partition Primary/ext4 with size to the end of the card. You can try ext2/3 but I don't think it is really necessary.
MiniTool will NOT wipe your partition if you do it right.
dsexton had a guide posted on how to do it.
Is it worth making a swap partition? If I remember correctly it significantly degrades the life of the SD card (and microSD's are delicate as it is), and I don't know if it would significantly increase performance.
cpkelley94 said:
Is it worth making a swap partition? If I remember correctly it significantly degrades the life of the SD card (and microSD's are delicate as it is), and I don't know if it would significantly increase performance.
Click to expand...
Click to collapse
I also created 128MB swap partition, not supported too and not mounted.
I tried to used swapper2 app from the market, but it says not supported by
kernel. Now I lost that space till I feel motivated to format or repartition the SD
card again.
I am using hefe kernel btw on AOKP milestone 6-5.
No swap.
Sent from my SGH-T959V using xda app-developers app

SD Card partitioning on MTD ROMs

Hi There
Can someone explain what he\she did to partition SD card, and make all apps get installed on it.
Please note :
1. I don't want to use Titanium backup for this usage. I don't have the paid version and I'm tired of doing this one app at a time.
2. I saw some guides on the net, but they were all for GB.
(partition the microSD on PC using minitool) -can we use ext4 on our MTD ROMs ? What is the 1st partition for ? and the 2nd ?
(install busybox and super user) - Is it still needed ? (MIUI for example has LBE as su).
(install Link2SD) - Is it always in memory ?
(reboot and put partitioned SD card)
(Define Link2SD)
3. I also saw swapper instructions but I can manage with 170MB free RAM memory I get after removing all unnecessary system apps, and I remember ppl saying then that it kills the SDCard very quickly.
If someone has a clear guide or instructions that he knows work, that will be nice.
Thanks in advance.
Step 1. Partition your SD card to have a sd-ext partition. This can definitely be ext2 or FAT16. Anything else depends on your kernel. Most of them do support ext3 and 4, but... start with something fairly basic.
Regarding recoveries:
TWRP has always failed for me on this, so I'd avoid that.
This may be doable in CWM. I've seen reference to that newer versions of CWM removed the partition option, so you might need to flash an ICS ROM with an older kernel, repartition, and then flash back to the one you want.
Also note that if you use CWM to repartition, your SD-card will be wiped. So do a backup first.
Step 2. Install Mounts2SD. Either from XDA or the Play Store. Even if you do take it from the Play Store to get update notifications, I highly suggest grabbing the recovery script from the XDA thread so that you can get back your shifted applications without needing to re-download and install M2SD, since it likes to be on internal which means... shifted off.
Step 3. Open Mounts2SD. Grant SU rights at whatever point it asks for it during step 3. Hit the menu button. Go to Application Settings. Install the Startup Script. Tell it to use the built-in busybox as well, so that you don't need to install anything or worry about it failing. Back out of the Application Settings.
Step 4. Press on the Wrench to go into the actual specific settings. I currently have forced Cache, 1% Storage Threshold, Applications are the only bit moved, the File System Check is on and using the Ext4 Driver, 128KB Deadline for Internal and 4096 with Deadline for External, and Safe Mode is disabled. But decide on what you want yourself, set it, go back to the Eye to see your current info.
Step 5. Reboot.
Step 6. Wait 1-30 minutes for it to finish moving all your stuff around.
Step 7. Unlock your phone, open Mounts2SD, and make sure everything looks pretty on that first 'Eye' info tab. If you like it then close Mounts2SD and keep going on your merry way. If you don't like it or you've done something like offload your data and now your phone is wretchedly slow, go to the Wrench, change your settings, go back to the Eye, and reboot again. Repeat until satisfied.
I thought it would be simplier.
A few more questions:
1. If I partition SD on PC, then I don't need any partitioning on recovery so it should work fine even on TWRP or advanced CWMs. Am I right?
2. Why do I need scripts for? Isn't the app enough?
3. Why should/could it possibly slow down my device? TB 'move to SD' for all doesn't slow my device what so ever.
4. How and where do I see what partition is used for what?
5. How much RAM does the app take?
6. Have you tried other apps link2sd or something CM has built in I think.?
Thanks.
sent from me
New answers to new questions.
1. Skip step 1 if you've done it on your PC. I just suggested recovery as that's easy... if you've made your sd-ext partition on the PC, step 1 is done.
2. No clue on Link2SD. I use Mounts2SD instead since it lets me set things. It probably does the same thing though and sets a init.d script that gets run during startup.
3. True. For some reason though having all your data moved to sd-ext makes our phone go to a crawl. Same if you move off the dalvik.
4. That's in Mounts2SD. No clue how you can see if you're using Link2SD.
5. For Mounts2SD, none while it's being used, since it just runs as a startup script. The app is just to control the script.
6. Not successfully. I had tried 5 or 6 different apps back a year ago or so when I first started playing with sd-ext and Mounts2SD was the best and free, so... never looked back after that. Now you can also do some system-flag tweaking if you want to donate, but the sd-ext stuff is all free.
I was able to successfully partition SD and use mount2sd on 4.3 SlimBean.
however, it was rather slow.
CM 10.1 and CM10.2 by DJL. did not allow me to partition nor did they recognize SlimBean's partition even if I replaced them kernel (to NilTMT).
I'm currently using CM10.1 which is stable as a daily driver and manually swapping apps with TB, I hate it, but this is the best combination I've come so far.
I sold my wife's SGS4G and upgraded her to SGS3 and hopefully in a year I will do the same. it had its moments, but on the bottom line it's a pretty ****ty phone with its lack of internal mem...but hey, it drove so many of us to go deeper and deeper trying to understand and made us more tecnolgical and solution oriented.
Mounts2SD worked for me on CM10.1, so not sure why it failed for you. Ah well.
A few things I have found...
Yes, you can partition on Windows, but you're really asking for trouble. It's not too bad download Ubuntu or the like and you can boot off a USB stick without touching your Windows install.
The TeamAcid kernels that I know of handle ext2/3/4 file systems. All kinds of arguments as to which are better. I personally use ext4 and don't find it obviously "slow" for the way I use my phone.
That said, what the boot scripts (which are part of a flashed "kernel" for the SGS4G) actually do with a "special" partition is another story. In some cases the first stages of booting will look for special partitions and mount them in pre-configured places. For example, the second partition of the removable card might be mounted on /sd-ext/ in many CyanogenMod ROMs. Many (most?) SGS4G ROMs don't have these "special" mount rules defined.
Moving an app to SD using the "native" approach just moves the app and none of its data to the SD card. It won't for example, move 25 MB of mail from /data/data to your microSD
Moving an app to SD (or anywhere else) doesn't keep it from generating its classes in /data/dalvik-cache -- It isn't "free" to have an app on SD as far as internal storage goes, even if it doesn't write any data.
Moving an app to SD will absolutely slow down your boot time. It does it by creating a file that contains a file system that then gets read and mounted at boot time. You can watch the parade of them getting mounted using adb logcat. It can take a minute or two to mount them all. Once mounted, that double layer of file systems shouldn't slow you down too much, since it is basically a read-only kind of thing.
Scripts are required since you need to be able to "fake out" the operating system as to where things are stored for anything (except if you just use the native app to SD method). In most cases you need new partitions mounted before the Android part of the OS starts running.
Some scripts are more robust than others.
TitaniumBackup (paid version) has a way to move data to an external partition. It works like a charm for me (64 GB Sandisk UHS-1 / Class 10 microSD). It was very tweaky for me to get it to recognize the ext4 partition the first time. It can bulk-move app data to the partition. I don't know which, if any, of the other scripts move the data to an external partition.
On my phone, an ext4 file system can be significantly faster than the internal yaffs, especially for write. Alas, it usually seems to be read that is a killer for most things in an well-written app. On my phone, yaffs can be faster than ext4 for short reads. Who knows how this would play out in real-world usage.
Other things that TitaniumBackup can do that help free up internal storage, at least in the paid version, are:
Dalvik cache cleanup
Integrate system Dalvik cache into ROM
Integrate update into ROM
Convert to system app
I can confirm Link2SD works where Mount2SD fails, which is an ext3 partitioned sd-ext on AOKP. it doesn't get any simpler than that.
sent from me

[Q] Replace Internal Data Partition for External SD

Let me start with: I know that there have been many posts on this, but before you get mad, I was unable to find an answer to what I specifically want to do.
For reference: I am a software developer and sysadmin with a decent amount of Linux experience, but not a lot of android specific experience.
Now that the introduction is out of the way:
What I would like to do is completely remove the "USERDATA" partition (the "Internal SD card"), grow the "SYSTEM" partition to fill that space, and then mount my SD Card (external) as the SD Card that the system sees.
I'm currently on Cyanogenmod 10.1 but want to upgrade to 11 soon.
The reason I want to do this is because:
I have all if my apps that I can set to install to SD Card
Both "internal" partitions are full (only about 200MB is available for pictures/etc. and I can no longer update apps)
Camera (and pretty much everything else as well) stores to the Internal SD card by default
If the system partition was 1.1+1.4=2.5GB and all of my apps were "installed" to a real SD card, it would be a lot more comfortable.
So, here's what I am thinking *might* work (maybe not in the right order, though?):
Point the fstab entry for the internal SD card to the external SD card
I have the PIT file. I will delete the "USERDATA " and grow "SYSTEM" to fill the space
When I write it out in steps, it seems pretty simple...
My concerns:
Will a ROM update (to CM11) re-partition back to the old way (and, in the process, break a bunch of stuff)?
I don't ever plan to go back to stock android or change to another ROM (other than upgrades).
Thanks for reading this long post and for any insight you may be able to provide.
--mobrien118
It's a wonderful idea if it works.
Sent from my SAMSUNG-SGH-T769 using xda app-developers app
Modifying partitions is a bit dangerous.
But I have to ask you why do you need another GB of /system storage?
There was a line you can put in the build.prop that flips your ext. SD with the internal one on cm10 I believe.
This'd interest me if I could get rid of usbdisk and sdcard0 merged.
It would need the phone to be repartitioned though, causing issues with the backups and ROMs.
You may even have to compile cm from source.
Its a lot of trouble
Sent from my SAMSUNG-SGH-T769 using Tapatalk
I just did so on S4 Mini with cm-11 Android 4.4.
First I was thinking of using symlinks and/or bind mounts to redirect to the the external sdcard, but that's a bit of a hassle because
1) Since 4.2: both emulated and external storage is mounted with a fuse layer on top not supporting symlinks
2) Since 4.4: no more global write access on external storage
So moving data was the simplest solution. Besides providing (much) more space my sdcard is also around 20% faster in sequential writes: 8.5 MB/s internal vs 10.5 MB/s external. Is it really 2014?
I haven't yet decided what to do with the original data partition, so for the moment I left it unused. Hence I haven't touched the internal partition table.
Quick summary
partition sdcard (gdisk)
I recommend using GPT, this lets you work with partition names rather than numbers. For the sake of still having an "official" external sdcard I made two partitions. Keep in mind that it's usually the first partition which gets automatically mounted as external sdcard. So I made the 2nd partition the new home for data. This partition however has to be manually specified in the ramdisks fstab which involves flashing the boot partition.
format the new partitions (mkfs.ext4)
copy the original /data directory tree to the new data partition
extract initrd from boot.img (abootimg)
extract files from initrd (gunzip & cpio)
replace the /data entry in fstab pointing at your new data partition
re-pack initrd and boot.img (gzip, cpio & abootimg)
flash boot.img onto the boot partition (dd)
If you use recovery, you also have to edit it's fstab (analog to boot.img mentioned above)
done
Alternatively has anyone tried an init.d script? I see those scripts get executed before the mounting of data & sdcard
Meanwhile the original userdata partition got replaced by 3 new partitions: system2, cache2 & userdata2 which are now used for a dual boot ROM.
I've only changed GPT, not PIT. ROMs and Recovery don't use PIT, so as long as Heimdall/Odin isn't involved it should not cause any issues.
Hey guys,
So after read all that, I am also vry interested in what the OP has suggested. I get that the pit doesn't need to be affected, but as the OP asked, when flashing a new rom or updating an existing, would the partition be reformatted back to the way android handles it, ie; back to the system and data seperate and the sdcard not being used as the internal partition?
I am no developer and only have minimal knowledge in linux and android programing, but I am a quick study and any guide to help me sort this would be greatly appreciated.
Also I am about to get a second S4 mini specifcally for doing things like this so if I brick I don't care?
My next question is could it be possible to code the PIT file to do this for you so that you can just flash that through odin, but again would flashing roms affect this.
Cheers,
Sora.
aguaz said:
I just did so on S4 Mini with cm-11 Android 4.4.
First I was thinking of using symlinks and/or bind mounts to redirect to the the external sdcard, but that's a bit of a hassle because
1) Since 4.2: both emulated and external storage is mounted with a fuse layer on top not supporting symlinks
2) Since 4.4: no more global write access on external storage
So moving data was the simplest solution. Besides providing (much) more space my sdcard is also around 20% faster in sequential writes: 8.5 MB/s internal vs 10.5 MB/s external. Is it really 2014?
I haven't yet decided what to do with the original data partition, so for the moment I left it unused. Hence I haven't touched the internal partition table.
Quick summary
partition sdcard (gdisk)
I recommend using GPT, this lets you work with partition names rather than numbers. For the sake of still having an "official" external sdcard I made two partitions. Keep in mind that it's usually the first partition which gets automatically mounted as external sdcard. So I made the 2nd partition the new home for data. This partition however has to be manually specified in the ramdisks fstab which involves flashing the boot partition.
format the new partitions (mkfs.ext4)
copy the original /data directory tree to the new data partition
extract initrd from boot.img (abootimg)
extract files from initrd (gunzip & cpio)
replace the /data entry in fstab pointing at your new data partition
re-pack initrd and boot.img (gzip, cpio & abootimg)
flash boot.img onto the boot partition (dd)
If you use recovery, you also have to edit it's fstab (analog to boot.img mentioned above)
done
Alternatively has anyone tried an init.d script? I see those scripts get executed before the mounting of data & sdcard
Click to expand...
Click to collapse
I just managed to replace my internal sd with the external sd following your ruff guide. thank you very much! At first I struggled a bit getting it to work, because I had encrypted my data partition before -.- this seems to change something in the fstab / mounting / boot-up process, I couldn't get my S4 mini to boot with just changing the fstab.qcom in boot.img. With my recovery (TWRP) it worked from the start editing recovery.img's fstab.twrp /data mount point.
After decrypting(formatting) /data and re-editing fstab.qcom in boot.img it finally works I'm so happy! Enjoying a lot of space on my sdcard now!
usefull threads / information I learnt from:
Partition structure of S4 Mini
Encryption of ExtSD & some fstab information
Editing initrd
abootimg ReadMe
(Links last tried 28.05.2015)

Categories

Resources