[Q] Replace Internal Data Partition for External SD - Samsung Galaxy S Blaze 4G

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)

Related

Alternative to Partitioning your SD Card?

Is there anyone out there who has simply created a image of an ext2 filesystem rather than physically partitioning the SD card?
I was thinking of creating an appstorage.img file and mounting via the loopback device in order to store apps on the SD card. This would allow me to keep the whole card as FAT32.
So on a linux computer, I'd do:
dd if=/dev/zero of=appstorage.img seek=500999999 bs=1 count=1
mke2fs -F appstorage.img
Then I'd copy the appstorage.img onto the SD card.
Finally I'd have to mount the new filesystem image on the phone....so using the terminal emulator app on the phone itself, I'd do something like:
mkdir /appstorage
mount -o loop appstorage.img /appstorage
mv /data/app/* /appstorage
ln -s /appstorage /data/app/
Not sure if I'd need to load an ext2 module first. If so, I'd want to insert that on bootup of the phone. Would I insert that in one of the rc.init or rc.local files to be run at boot?
Same for the mount command?
The problem is that at boot time, /data/app needs to be available the same time the ext2.ko module of a non-rooted phone becomes available.
JesusFreke added ext2.ko support into somewhere before that point. (I just checked, it's in the system.img flash file; found it in JFs build environment)
In order to use your solution, which many people including me have contemplated, you need to have loop.ko available at that very point in time. That means building your own system.img image file and flashing it with fastboot.
Hope this helps!
Thanks...it does help, although that probably puts it beyond my capabilities. I don't think I'm up to building a custom system.img....maybe it isn't as difficult as I think.
This is similar to what LucidREM did, building a custom mod to the JF build?
Wonder if this would be included as part of the next official Android release from Google/TMobile? Obviously they can't/won't want to partition people's SD cards to expand app storage....seems the filesystem image is the only way to go.
Autarkis said:
The problem is that at boot time, /data/app needs to be available the same time the ext2.ko module of a non-rooted phone becomes available.
JesusFreke added ext2.ko support into somewhere before that point. (I just checked, it's in the system.img flash file; found it in JFs build environment)
In order to use your solution, which many people including me have contemplated, you need to have loop.ko available at that very point in time. That means building your own system.img image file and flashing it with fastboot.
Click to expand...
Click to collapse
Hmm...wait a second here....maybe I don't fully understand.
But looking at the modified init.rc from a thread about moving apps to the SD card, it appears that it is mounting files via loopback and then later directly doing the insmod of the ext2.ko module prior to mounting the ext2 partition on the SD card. Take a look:
Code:
on system
mount cramfs [email protected]/system/modules/modules.cramfs /system/modules ro
mount cramfs [email protected]/system/xbin/xbin.cramfs /system/xbin ro
insmod /system/modules/2.6.25-01843-gfea26b0/kernel/fs/ext2/ext2.ko
mknod /dev/mmcblk0p2 b 179 2 1000
mount ext2 /dev/mmcblk0p2 /system/sd noatime nodiratime
Am I missing something? Are the first two lines utilizing the loopback device already, meaning it would have been loaded previously?
bump. (very curious about this thread)
A bump from me too - last night I had to format my 8Gb SD card back to Fat32 and put myself back to the standard JF RC9 build - my G1 stopped reading my SD card's Fat32 partition and no matter how many times I formatted it or re-created the partition, nothing would work.
Only after FULLY formatting and loosing my my Ext2 partition on it did it start reading it again, causing my phone to fail to boot until I put the standard JF build back on and do a full factory reset.
This is a pretty fundamental flaw of the phone - is there really a technical reason why app's can't be run off a Fat32 SD card?
I am curious to this topic as well...
wont u need to edit a file? so it would auto remount if you reboot the phone?
For those that have installed the Debian distro on their phone, you are doing almost the exact same thing. You create a debian.img file and format it as an ext2 filesystem.
Then you mount it via the loopback device as an ext2 filesystem. But that is after your phone is already booted up in Android and running.
So the question is when the loopback module for the kernel gets loaded. From Autarkis post, he indicates the loading of the loop.ko module is a problem and would require a custom boot image.
But it looks to me like the loopback module is already loaded when init.rc is called...so I'm confused as to why this won't work.
I briefly tried it on the 1GB card that came with the phone, but gave up after a few minutes. Didn't seem to be working. Dunno...maybe I'll give it another go. But I have to believe that someone else has already tried this rather than go through the pain of partitioning.
Wouldn't you then have the same disadvantage as debian.img on FAT? i.e. that you couldn't unmount the FAT (on connection to a PC) as the ext2 partition image was still mounted.
I was thinking about doing the opposite; moving my debian.img over to within the (ext2) app partition to get around this very issue, I can't really work out why you are trying to introduce this problem!
digitalspaghetti said:
A bump from me too - last night I had to format my 8Gb SD card back to Fat32 and put myself back to the standard JF RC9 build - my G1 stopped reading my SD card's Fat32 partition and no matter how many times I formatted it or re-created the partition, nothing would work.
Only after FULLY formatting and loosing my my Ext2 partition on it did it start reading it again, causing my phone to fail to boot until I put the standard JF build back on and do a full factory reset.
This is a pretty fundamental flaw of the phone - is there really a technical reason why app's can't be run off a Fat32 SD card?
Click to expand...
Click to collapse
I think there's a couple reasons the phone can't install apps on a fat32 sd card. The biggest one is that you can't make symlinks to/from a FAT32 file system, meaning even if you were google and wanted to make it possible, it'd likely have to be an all or nothing deal and they didn't want to make the phone unusable/crash without an SD. For the average hacker here, it'd just be too difficult to make the operating system read apps from FAT32.

[SOLVED] Forced Close of core (or all) apps, Internal SD removed unexpectedly...

Hi All,
I got errors mentioned in the title and after few searches, found that there are few Galaxy SL owners who had got into this issue.
Currently Known Root Cause:
A hardware issue possibly due to a board issue or loose attachment of internal SD card to the motherboard (Grrrrrrr SAMSUNG!)
Symptoms:
- Suddenly core applications like phone/messaging start force closing (sometimes all open apps). Only a reboot will solve the issue.
- Sudden reboot of the phone after few hours of running (or even sleeping)
- Sometimes the restart itself hanging with a yellow message "Unknown Upload Mode"
- Message in status bar "Internal SD card has been removed unexpectedly" or "Internal SD card not accessible" or something like "Damaged SD card"
Known Solution:
1. Replacement of board from Samsung Service Center (Good for you if you are within the warranty period)
2. Do some hardware hack to remove the internal SD completely (http://forum.xda-developers.com/showthread.php?t=1651619)
I got this issue just after I finished my warranty period, and hence, I was trying to find if I can do something about this issue by my own. What I wanted was to actually swap my internal SD storage with a proper external SD storage. This is not same as the popular "swapping the internal and external SD card" topic, but that and something more as well!! This will solve the issue of force closes and sudden reboots (may still not solve issue of reboot getting stuck, but I assume phone will not need frequent reboot after solving first 2 issues!)
Galaxy SL has 3 partitions created in the card:
1. ext3 partition for data
2. another small FAT partition - (for what? not sure)
3. Third FAT partition which acts as the normal internal SD card (which is accessible when working as USB mass storage)
Intention here is to move all the partitions to the external SD. Looking at the mount points and vold.fstab, I could not find where the 2nd partition in the above list is mounted/used (If anyone knows, please let me know). So I decided to move atleast the ext3 (data) and fat (/sdcard) to the external SD.
Following are the steps I followed for doing the same:
WARNING!!!
1. Copy these at your own risk. I am not responsible if you brick your phone or lose your data/applications/settings or if the phone goes to a boot loop!
2. Do not continue if you do not understand what is written here
3. Doing this will change the /data partition. So wiping data partition in the normal way will not work (say from CWM). You may need to do 2 steps - wipe (internal) data normally (say using CWM), wipe (external SD) data manually by disabling the script mentioned in the procedure and wiping using make_ext4fs tool (steps are given in PART 3 of this post).
4. This has been tested only on CM9 Alpha 6-11 / rooted DDLF2. Theoretically it may or may not work on other ROMs, depending on other tweaks and changes in the system, no guaranty offered!
5. In case you mess it up, most of the time (but no guarantees!), you can recover by flashing from beginning using ODIN some base versions like KPE and then come to your normal ROM, followed by a nandroid recovery (so better do a nandroid backup before you try anything .
Pre-requisites:
- Rooted Phone
- Kernel with init.d support (and preferably ext4 as well if you want that)
- Basic ADB knowledge
- A blank micro SD card with at least class 4 (class 6 or greater preferred) speed and with sufficient capacity - say 8/16/32 GB
PART 1 - PREPARING THE EXTERNAL SD
--------------------------------------------------------------------
0. !!! FIRST !!!
Do a Nandroid Backup (and also other app level backups like Titanium or MyBackup)
Backup contents of your FAT partition (mmcblk0p1) - ie, the internal SD card card
Backup contents of your external SD card
1. Download sdparted-recovery.zip from web (http://forum.cyanogenmod.com/topic/6433-solved-messed-up-partitions-on-internal-storage - check messages like 11 to see the basic usage) and extract the contents
2. Using ADB, copy the extracted files in sdparted directory into /system/bin, change permission for all of them to 755 using chmod
3. Put a clean external SD card into the phone
4. In an ADB shell, run /system/bin/parted giving mmcblk1 as the target. Now resize the existing FAT partition (this is the first and default partition in the card). Tips:
print gives the existing partition(s)
help gives help on various options
for resizing and creating partitions, inputs should be derived from the initial print output (which gave the first and last points)
Eg: If card is 16GB, and you want to reserve 4GB for data, then resize the first partition to 12GB
5. Create a new partition of type ext2 with remaining size (say 4G in our case). Save and quit parted.
7. (Do this only if your kernel supports ext3/ext4) Run "tune2fs -j /dev/block/mmcblk1p2" to convert ext2 to ext3
8. (Do this only if your kernel supports ext4) Using ADB, copy "make_ext4fs" (attached) to /system/bin
9. (Do this only if your kernel supports ext4) Convert ext3 partition to ext4 using make_ext4fs ("make_ext4fs /dev/block/mmcblk1p2")
10. Now the partitions are ready
- They will be visible as mmcblk1p1 (FAT) and mmcblk1p2 (ext4) when you cat the /proc/partitions
- They will be visible as partitions 1(FAT) and 2 (ext4) in the print output of parted.
Confirm the above before proceeding further.
PART 2 - SWAPPING EXTERNAL AND INTERNAL SD
---------------------------------------------------------------------------------
1. Write a script, say 00remnt similar to the attached sample file which currently I am using (If you do not follow the script, better don't proceed. Else check if things are fine for your current base ROM settings)
2. Push this into /etc/init.d/ using ADB
3. Change permissions of the file to 755
4. If you need, copy the contents of your internal SD card FAT partition (/sdcard) to the external SD card FAT partition (/sdcard/external_sd or /emmc)
5. Use the popular (relevant methods) to swap the internal and external FAT partitions (which actually changes the vold.fstab contents). Normal search in the forum will give you the available methods - some ROMs support it as options, others have mods which will accomplish the same
5. Reboot and enjoy
Voila!!! Now the system is not using internal SD card (for most purposes) at all!! And your phone can now run for days without abrupt force closes and reboot. You still may get a message like SD card is removed/damaged, (and /emmc or /sdcard/exteranal_sd may become inaccessible - so better use it only as a temporary storage!). But you can safely ignore these messages as that is the internal SD card which we are not using anyway... Enjoy...
PART 3 - WIPING DATA PARTITION (in case you need this step later)
-----------------------------------------------------------------------------------------------------------
1. Change permission of the 00remnt to 644
2. Reboot the phone (now the phone will come up with default internal SD partition for data)
3. From ADB shell, execute "make_ext4fs /dev/block/mmcblk1p2" (see PART 1 on how to get this tool)
4. Change permission of the 00remnt to 755
5. Reboot the phone to recovery, wipe the /data as normal
rgds,
Dipu.
PS: If any one knows how our phone uses the 2nd partition in the internal SD card, please let me know... I am assuming that it is not used for any critical purposes (as my phone ran successfully for few days without any issue). May be it is used in some kernel/ROM, if so, please let me know.
Though i didn't understand a word(being an internee dentist) it will be useful to others.appreciate your efforts!!
Sent from my GT-I9003 using xda app-developers app
This is what i call a complete and useful guide.
This should become a sticky.. now... NOW!
+1 for sticky, superb info.
that would be a really nice sticky
i had the motherboard changed..
Thanks Dipu K for your efforts.
I've tried this solution in my I9003, and I have only a problem: When reboot the phone, /data is copied into de Ext4 partition on SD card, but all aplications have errors because isn´t possible to unmount /data,
Here is the messaje in remnt-log (only a few lines):
Code:
...
3. Make Directory --->
4. Mount new data partition from external SD --->
5. Copy the current files in /data
6. Remove current files in /data
7. Unmount /data
umount: can't umount /data: Device or resource busy
8. Remove dir /data as a safety measure
9. Linking external sd data partition as /data
10. Final Mount status --->
...
What can I do to correct this?
Thanks
bfsa said:
...
What can I do to correct this?
Thanks
Click to expand...
Click to collapse
Finally, I've changed a line on 00remnt, and seems to work properly: busybox umount -l /data 2>> /system/remnt-log
Where can I get make_ext4fs? Sadly the same case has happened to me...
Hi Guys.
I am using alpha 4 from last one month and experience was awesome but from last 1 week I am getting lot of FC for lot of services like exchange service gapps what's up camera and lot more. I am not sure why FC issue started happening from last one week.
History :
I was using CM 10 alpha 1 then alpha 2 then alpha 3 and now on alpha 4.
I really fed up with Force close issue from last one week . I tried reboot but still 80% of apps and services getting FC. Please guide me on this .
Sent from my GT-I9003 using xda app-developers app
Sent from my GT-I9003 using xda app-developers app
hi all, i have a galaxy i9003 with a corrupted or completely dead (not sure) internal memory chip. I have come to this conclusion after 3 days of trying to install custom and stock roms. I can access recovery and download mode but i cant install any ROM, the phone keeps rebooting after the SAMSUNG (whole screen black except SAMSUNG in the middle). All i have is atm this http://forum.xda-developers.com/showthread.php?t=1351056 installed on my phone via ODIN. I dont have knowledge about ADB, can somebody help me out with instructions more?
Pre-requisites:
- Rooted Phone
Click to expand...
Click to collapse
Is there a solution without a rooted phone or can I root it somehow, even if the there is a hardware defect? I got an error with /dev/block/mmcblk1p that rfs can't be written.
I have a problem. My friend gave me an i9003. Wipe is not working at all, even from Recovery. I connect the phone to PC and use the internal card, no matter what I do, changes don't apply. I copy/paste/delete/format/even odin flash, no good. Everything comes back as before reboot. What is it related to?
I used to have an i9000, but nothing applies to i9003. I flashed i9000 1000 times and at last got a mmcblk02 error, fixed it with external sd swap. I'm thinking of swapping emmc with sd on this one too, but cant install a rom from CWM, I can install CWM from ODIN though and can flash CFROOT too, but in CWM internal storage can't be mounted... Motherboard problem?
I will try to use this guide and report back soon...
allxx said:
I have a problem. My friend gave me an i9003. Wipe is not working at all, even from Recovery. I connect the phone to PC and use the internal card, no matter what I do, changes don't apply. I copy/paste/delete/format/even odin flash, no good. Everything comes back as before reboot. What is it related to?
I used to have an i9000, but nothing applies to i9003. I flashed i9000 1000 times and at last got a mmcblk02 error, fixed it with external sd swap. I'm thinking of swapping emmc with sd on this one too, but cant install a rom from CWM, I can install CWM from ODIN though and can flash CFROOT too, but in CWM internal storage can't be mounted... Motherboard problem?
I will try to use this guide and report back soon...
Click to expand...
Click to collapse
Please do send us a report, I'd appreciate it very much. Have to deal with a similar situation as well for an old i9003. I've tried to employ the steps mentioned here but could not get it to work as well.
Hi everybody!
Had to remove the internal SD to install everything on the external one by following the mentioned post. Nothing else worked.
http://forum.xda-developers.com/showthread.php?t=1651619
can anyone here recomended me custom rom that already with swap sdcard?
Dipu K said:
Hi All,
I got errors mentioned in the title and after few searches, found that there are few Galaxy SL owners who had got into this issue.
Currently Known Root Cause:
A hardware issue possibly due to a board issue or loose attachment of internal SD card to the motherboard (Grrrrrrr SAMSUNG!)
Symptoms:
- Suddenly core applications like phone/messaging start force closing (sometimes all open apps). Only a reboot will solve the issue.
- Sudden reboot of the phone after few hours of running (or even sleeping)
- Sometimes the restart itself hanging with a yellow message "Unknown Upload Mode"
- Message in status bar "Internal SD card has been removed unexpectedly" or "Internal SD card not accessible" or something like "Damaged SD card"
Known Solution:
1. Replacement of board from Samsung Service Center (Good for you if you are within the warranty period)
2. Do some hardware hack to remove the internal SD completely (http://forum.xda-developers.com/showthread.php?t=1651619)
I got this issue just after I finished my warranty period, and hence, I was trying to find if I can do something about this issue by my own. What I wanted was to actually swap my internal SD storage with a proper external SD storage. This is not same as the popular "swapping the internal and external SD card" topic, but that and something more as well!! This will solve the issue of force closes and sudden reboots (may still not solve issue of reboot getting stuck, but I assume phone will not need frequent reboot after solving first 2 issues!)
Galaxy SL has 3 partitions created in the card:
1. ext3 partition for data
2. another small FAT partition - (for what? not sure)
3. Third FAT partition which acts as the normal internal SD card (which is accessible when working as USB mass storage)
Intention here is to move all the partitions to the external SD. Looking at the mount points and vold.fstab, I could not find where the 2nd partition in the above list is mounted/used (If anyone knows, please let me know). So I decided to move atleast the ext3 (data) and fat (/sdcard) to the external SD.
Following are the steps I followed for doing the same:
WARNING!!!
1. Copy these at your own risk. I am not responsible if you brick your phone or lose your data/applications/settings or if the phone goes to a boot loop!
2. Do not continue if you do not understand what is written here
3. Doing this will change the /data partition. So wiping data partition in the normal way will not work (say from CWM). You may need to do 2 steps - wipe (internal) data normally (say using CWM), wipe (external SD) data manually by disabling the script mentioned in the procedure and wiping using make_ext4fs tool (steps are given in PART 3 of this post).
4. This has been tested only on CM9 Alpha 6-11 / rooted DDLF2. Theoretically it may or may not work on other ROMs, depending on other tweaks and changes in the system, no guaranty offered!
5. In case you mess it up, most of the time (but no guarantees!), you can recover by flashing from beginning using ODIN some base versions like KPE and then come to your normal ROM, followed by a nandroid recovery (so better do a nandroid backup before you try anything .
Pre-requisites:
- Rooted Phone
- Kernel with init.d support (and preferably ext4 as well if you want that)
- Basic ADB knowledge
- A blank micro SD card with at least class 4 (class 6 or greater preferred) speed and with sufficient capacity - say 8/16/32 GB
PART 1 - PREPARING THE EXTERNAL SD
--------------------------------------------------------------------
0. !!! FIRST !!!
Do a Nandroid Backup (and also other app level backups like Titanium or MyBackup)
Backup contents of your FAT partition (mmcblk0p1) - ie, the internal SD card card
Backup contents of your external SD card
1. Download sdparted-recovery.zip from web (http://forum.cyanogenmod.com/topic/6433-solved-messed-up-partitions-on-internal-storage - check messages like 11 to see the basic usage) and extract the contents
2. Using ADB, copy the extracted files in sdparted directory into /system/bin, change permission for all of them to 755 using chmod
3. Put a clean external SD card into the phone
4. In an ADB shell, run /system/bin/parted giving mmcblk1 as the target. Now resize the existing FAT partition (this is the first and default partition in the card). Tips:
print gives the existing partition(s)
help gives help on various options
for resizing and creating partitions, inputs should be derived from the initial print output (which gave the first and last points)
Eg: If card is 16GB, and you want to reserve 4GB for data, then resize the first partition to 12GB
5. Create a new partition of type ext2 with remaining size (say 4G in our case). Save and quit parted.
7. (Do this only if your kernel supports ext3/ext4) Run "tune2fs -j /dev/block/mmcblk1p2" to convert ext2 to ext3
8. (Do this only if your kernel supports ext4) Using ADB, copy "make_ext4fs" (attached) to /system/bin
9. (Do this only if your kernel supports ext4) Convert ext3 partition to ext4 using make_ext4fs ("make_ext4fs /dev/block/mmcblk1p2")
10. Now the partitions are ready
- They will be visible as mmcblk1p1 (FAT) and mmcblk1p2 (ext4) when you cat the /proc/partitions
- They will be visible as partitions 1(FAT) and 2 (ext4) in the print output of parted.
Confirm the above before proceeding further.
PART 2 - SWAPPING EXTERNAL AND INTERNAL SD
---------------------------------------------------------------------------------
1. Write a script, say 00remnt similar to the attached sample file which currently I am using (If you do not follow the script, better don't proceed. Else check if things are fine for your current base ROM settings)
2. Push this into /etc/init.d/ using ADB
3. Change permissions of the file to 755
4. If you need, copy the contents of your internal SD card FAT partition (/sdcard) to the external SD card FAT partition (/sdcard/external_sd or /emmc)
5. Use the popular (relevant methods) to swap the internal and external FAT partitions (which actually changes the vold.fstab contents). Normal search in the forum will give you the available methods - some ROMs support it as options, others have mods which will accomplish the same
5. Reboot and enjoy
Voila!!! Now the system is not using internal SD card (for most purposes) at all!! And your phone can now run for days without abrupt force closes and reboot. You still may get a message like SD card is removed/damaged, (and /emmc or /sdcard/exteranal_sd may become inaccessible - so better use it only as a temporary storage!). But you can safely ignore these messages as that is the internal SD card which we are not using anyway... Enjoy...
PART 3 - WIPING DATA PARTITION (in case you need this step later)
-----------------------------------------------------------------------------------------------------------
1. Change permission of the 00remnt to 644
2. Reboot the phone (now the phone will come up with default internal SD partition for data)
3. From ADB shell, execute "make_ext4fs /dev/block/mmcblk1p2" (see PART 1 on how to get this tool)
4. Change permission of the 00remnt to 755
5. Reboot the phone to recovery, wipe the /data as normal
rgds,
Dipu.
PS: If any one knows how our phone uses the 2nd partition in the internal SD card, please let me know... I am assuming that it is not used for any critical purposes (as my phone ran successfully for few days without any issue). May be it is used in some kernel/ROM, if so, please let me know.
Click to expand...
Click to collapse
Somebody's Samsung Galaxy SL i9003 had wiped the internal SD card by itself! Is this even possible that it just wipes/formats on it's own? Is there any advice? The contacts appear to still be there.

[MOD] Data2SD (Enhanced) - I/O Fix

At the suggestion of several users, I am forking the previous thread. I am planning on supporting several ROMs and this is the best course to keep everything organized and provide support.
What is this?
Background:
The speed of the flash memory in the Transformer line of tablets is very poor. This is very apparent when installing or updating applications from the Play Store, copying files over USB, or using an app that caches lots of data like a web browser. The tablet will hiccup and stutter due to the I/O bottleneck. Running Androbench shows random write speeds averaging less than .2MB/sec.
The workaround:
Utilizing a fast, class 10 microSD card, we can move the /data partition to something significantly faster. The /data partition is where apps are installed to and where they store their configuration information and data. By redirecting /data to these fast microSD cards, we eliminate this bottleneck from our devices. With a properly fast card, users have reported a complete elimination of I/O related hiccups and system freezes. I have based my enhancements on the initial work by TweakerL on the Transformer Prime. Credit to fordwolden to porting his work to the Infinity.
The enhancements:
Previous implementations of this mod had the internal data partition mounted to /data2, with the media subfolder (your internal user storage) only available via root apps. There were symlinks set up at /sdcardi, etc, but these still required root permission to access. This is due to permissions on the /data partition and applies to both /data and /data2. Google gets around this by creating a "virtual" sdcard that points to /data/media. I have created a second "virtual" sdcard that points to /data2/media. This mod creates the scenario below:
/data = ext4 partition on microSD (fast)
/data2 = ext4 partition on internal storage (slow)
New changes:
/data/media -> Virtual SD Card Daemon -> /storage/sdcard0
/data2/media -> Virtual SD Card Daemon -> /storage/sdcardi
/sdcardi -> Symlink -> /storage/sdcardi
/mnt/sdcardi -> Symlink -> /storage/sdcardi
/storage/sdcardi is the virtual SD card for the internal storage. You should see all the files you had saved to this space before using data2sd. These files should be accessibly by any standard non-root Android app.
Note to kernel developers: This mod is more than just changes to the kernel. In order for the internal storage to be properly mounted at /storage/sdcardi, I have modded the Virtual SD Card Daemon that comes with Android. The stock binary is /system/bin/sdcard. I made a copy, modified it using a hex editor, called it /system/bin/sdcardi, and included it in my flashable zips. If you wish to make a data2sd version of your kernel, you must include this file in your zip. Additionally, be sure to add the "service sdcardi" line to your init.cardhu.rc that I have in mine.
Installation
Requirements
1) Class 10 microSD, at least 8gb
2) A computer with card reader
3) Partitioning software. Recommended: gparted LiveCD
Instructions
1) Decide how big you want to make the ext4 partition for /data. Remember, this is going to be the space for installing applications AND the /sdcard space that games will use the cache their extra data. Kindle books, Dropbox files, pics from the camera WILL ALL GO HERE. Personally, I decided to make the ext4 partition the whole 64gb of my card.
The ext4 partition has to be partition #2 on the microSD card. Why? This is to give people with large cards the option of creating a FAT32 or NTFS area as partition #1. This allows the card to be read by a Windows or Mac computer using a card reader. I use my tablet as my card reader with the USB cable, so I wasn't worried about this. I used gparted to create a small 8mb unformatted partition as partition #1, then a second 64gb partition to fill the rest of the card. I formatted this second partition in ext4.
2) Format your microSD card - Download Gparted Live CD (http://goo.gl/dJQAu) and use Imgburn (http://goo.gl/33MY9) to write to disc. Boot to Gparted using your CD after setting the CD as the primary boot device in your BIOS. Once in Gparted, create the 2 partitions described above, the first partition is Fat32, the second partition is ext4 or ext2. Set both partitions to type: Primary.
3) Insert microSD into tablet and flash any data2sd kernel for your ROM. (Note: Flashing any ROM will overwrite your data2sd kernel. You will have to re-flash the data2sd kernel if you change ROM or even upgrade your current one) After booting back into Android, you should be greeted with the Setup Wizard. Remember, this is a fresh /data partition, so it's a clean slate. It's a good idea to take a TitaniumBackup** ahead of time. I am experimenting with ways to make the transition more painless.
**Note about taking a TitaniumBackup before switching to data2sd. After the conversion, your internal storage will be mounted to /sdcardi. By default, TitaniumBackup looks for previous backups in /sdcard not in /sdcardi. You have two choices. Copy the TitaniumBackup folder from /sdcardi to /sdcard and restart the app, or change the backup location to /sdcardi/TitaniumBackup in the app preferences. Either of these options should work fine.
Optional: Verify data2sd is working. Pick any method you like:
a) Open a file explorer such as Root Explorer, ES, etc. You should see /sdcard and /sdcardi and be able to browse the files within. /sdcard is your ext4 partion on the microSD while /sdcardi is the internal storage. You should able to copy data between them.
b) Download "Androbench" app from the market and run "micro" sdcard check, if you see 0.4mb/sec or more in random write you're on data2sd.
c) Power off your device, remove your microSD card, then power back on your device. You should received an error message "Encryption unsuccessful". Insert microSD and reboot to fix.
Uninstallation
Don't like data2sd? Just flash a non-data2sd kernel using recovery and when you boot back into Android your /data will be on the internal storage. This could also be accomplished by flashing your ROM on top of itself without wiping.
Troubleshooting
1) Grab the mount-data2sd.zip from the second post.
2) Boot into TWRP and flash the mount-data2sd.zip. This will mount the microSD as /data in recovery. It will allow us to wipe it, format, etc using recovery.
3) Wipe "Internal Storage". This will erase the entire ext4 partition on your microSD.
4) Flash ROM
5) Flash data2sd kernel for ROM
*CAUTION*: If you don't flash mount-data2sd.zip before your wipe, you will be wiping your internal memory.
Download data2SD kernels
These are flashable zips. It will disable journaling on the microSD ext4 partition. You do not have to do this manually! Flash these after flashing the ROM.
CyanogenMOD 10.1 - beta2: http://d-h.st/rOe (Based on 4-2 nightly and may behave unexpectedly on other builds)
CleanROM 3.2.2: http://d-h.st/sCa - WORKS WITH CleanROM 3.3!
clemsynTFUniversalCyano650GPUFsyncver3: http://d-h.st/duw
ClemsynTFUniversalStock: http://d-h.st/IBm
clemsynTFUniversal650GPUver7 (Stock/CleanROM): http://d-h.st/S4k
Recovery
I made a flashable zip to help the recovery console understand our modification. By default, if you go into recovery and do a factory reset, it is formatting the /data partition on the internal storage. The issue same applies to nandroids. We may be using the second partition of our microSD card for /data, but the recovery does not know this. It will look to the internal /data partition during backup and restores.
This zip does not make any modifications to your tablet or copy any files. It simply updates your recovery mount points. The changes are temporary and are lost during the next reboot. You will need to flash it each time you boot into recovery.
After flashing this zip you will be able to:
1) Wipe data / Factory reset. The /data partition on the microSD will be wiped
2) Backup and restore nandroids. The /data partition on the microSD will be backed up or restored.
3) Choose "Flash zip from internal sdcard" and browse the files on the internal storage
4) Access and flash zips from the microSD storage. Choose "Flash zip from internal sdcard" and notice the !microSD folder at the top. This is a symlink that will kick you over to the microSD storage. This !microSD folder appears on your internal storage after you flash this zip for the first time. It remains unless you delete it. Even so, next time you enter recovery this !microSD symlink will not go anywhere until you flash this zip.
Please report your experience with this.
http://d-h.st/pPe
This one too.
So this is basically flashable on CleanRom 2.3 right? Only thing wrong is that it doesn't show up in windows over USB? I can live with that as long as apps can read it in the Android OS itself.
can I use flash this on cleanrom 2.3 to diasable journalling on my ext4 partition
Diogenes5 said:
So this is basically flashable on CleanRom 2.3 right? Only thing wrong is that it doesn't show up in windows over USB? I can live with that as long as apps can read it in the Android OS itself.
Click to expand...
Click to collapse
Nope. This has changes to framework-res.apk which is ROM specific. I will post a CleanROM 2.3 version in a few minutes for you guys.
Thanks - Appreciate your hard work
---------- Post added at 08:46 PM ---------- Previous post was at 08:37 PM ----------
wow that was fast-thanks
---------- Post added at 08:58 PM ---------- Previous post was at 08:46 PM ----------
i was getting 6000 with clemsyn -I got low 5000's with this new mod
clownberg said:
i was getting 6000 with clemsyn -I got low 5000's with this new mod
Click to expand...
Click to collapse
This is not clemsyn's kernel, this is the stock CleanROM 2.3 kernel. I will mod clemsyn's latest kernel and post it for you.
Mistar Muffin said:
This is not clemsyn's kernel, this is the stock CleanROM 2.3 kernel. I will mod clemsyn's latest kernel and post it for you.
Click to expand...
Click to collapse
Unable to have it work with cleanrom. Boot loop
titou00075 said:
Unable to have it work with cleanrom. Boot loop
Click to expand...
Click to collapse
Use recovery to wipe the /cache partition. Due to the changes in framework-res.apk this may be necessary if you aren't coming from a completely clean install of a ROM.
I just booted to recovery and wiped my microSD /data partition. I also wiped /cache and /system. I installed CleanROM 2.3 and in the same recovery session I flashed the clemsynTF700ver22GPU650VC-data2sd kernel and it booted right up.
May be a stupid question but do you still need TWO primary partitions on the SD card (i.e., first is FAT32 while second is Ext4 and used by the mod)? If this isn't necessary or not possible, should the recovery (i.e., installation) files be placed in internal storage?
Forgot to mention I'm using Windows 7 MTP and CleanROM 2.3
Mistar Muffin said:
Use recovery to wipe the /cache partition. Due to the changes in framework-res.apk this may be necessary if you aren't coming from a completely clean install of a ROM.
I just booted to recovery and wiped my microSD /data partition. I also wiped /cache and /system. I installed CleanROM 2.3 and in the same recovery session I flashed the clemsynTF700ver22GPU650VC-data2sd kernel and it booted right up.
Click to expand...
Click to collapse
Ok thanks. Will do:thumbup:
Your Awesome, Thank you!
cheers
Thanks Gonna try this.
done the work install all three files in the OP, however it is taking a long time to boot....Can someone give me an idea as to how long this normally take onn first bootup after a fresh install?
please advise
tyfoxx
Couldyou make one for blackbean? i tried thecm 1029,but it doesnt boot. Would greatly appreciate it.
Sweet
I just ran every shortcut I could think of:
I used Mini partition tool to reduce reduce my 32 gig fat down to 16 gigs & then created a 16 gig ext4 partition.
Wiped everything in twrp and re flashed Clean 2.3 then the new zip.
All I can say is WOW.
Restored everything. Works great no more stalls and stable so far. Hope it stays this way. Now to focus on battery life.
Sent from my HTC Ruby using xda app-developers app
Diogenes5 said:
Restored everything. Works great no more stalls and stable so far. Hope it stays this way. Now to focus on battery life.
Sent from my HTC Ruby using xda app-developers app
Click to expand...
Click to collapse
Glad it's working! I've prepared a little treat for everyone to make our recovery lives a little easier. Need to test a few more things before I post!
I'm running CleanROM 2.3 and ClemsynTF700ver22GPU650VC (awesome combo, btw). If I want to use this MOD, should I need to flash first CleanROM-2.3-data2sd.zip and later ClemsynTF700ver22GPU650VC-data2sd.zip, right? Of course, also, formating my microSD using ext4.
Awesome work here Mistar!!!! Thank you so very much for this!!! Gonna replace my SanDisk 32gb Class 4 card with a SanDisk 64gb Class 10 before I run this on CleanRom. I'm super excited about this mod!!!!!! Thanks a million!!!!!!
Sent from my EVO 4G LTE using xda premium

[Q&A] 2 GB External Data -- Hefe Hook Kernel and others

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).

[MOD][2016-11-01][V3.01]TURBO DATA - Get an 8GB Data-Partition ...

TURBO DATA - Get an 8GB Data-Partition!​
Use SD-EXT as new Data partition​
presented by​
~~~~~~~~ delta-roh ~~~~~~~~ ​
HIT THANKS for delta-roh (1st post) ​And, please, don't forget to Rate this Thread - thank you!​
You love your Sensation, but:
The 1 GB of the data partition limits you?
You don't like Link2SD?
You don't want to use the to SDCard feature?
You don't want to use data2sd or similar scripts?
You are afraid of broken links?
Then this is the Turbo for your HTC Sensation​
Features of TURBO DATA
Version 3.01 (release date 01st Nov 2016)
new corrected error in cpio to support 2nd level subdirectories
new Mod for Ivanich CM11 to get Data on SD-Ext, but have Dalvik internally (FAST!!!) - refer to Post 2
Version 3.00 (release date 29th Mar 2015)
new now my Delta-Roh cpio.bat is integrated
new Delta-Roh cpio without cygwin! - all tools integrated als always
new No need of Windows 8.1 administrative rights (as for cygwin)!
new Now manual changes can be done to all scripts of the ramdisk
new Very easy handling!
new This version now also supports ViperS-Roms!
new If you like, you can download only the Delta-Roh cpio package (see below)
Version 2.02 (release date 02nd Mar 2015)
new now also handles .img (boot-Image files)
new added loop for performing patterns more flexible
new added patch check - exit if no pattern was found
new added ramdisk size check
Version 1.04 (release date 21st Feb 2015)
First Version by delta-roh
new handles normal flashable zip, that include a boot.img
new works fully automatically
new support of command line call
new Drag+Drop support
new A lot of checks to make the procedure safe
new Writes a logfile parallel to the screen output
new Does not change your original zip
new the resulting zip can be flashed directly
Click to expand...
Click to collapse
Idea:
Our beloved Sensation comes only with 1 GB of available internal memory and that is too less to work, even if you don't install a lot of games. When I tried several thinks (app2sd, app2sd-ext, Link2SD etc.) I recognized, that modern SD-Cards are very fast and our Sennsation has got a very good interface to suppport high speeds. Even better, the SD-Cards of SanDisk (SanDisk Extreme Pro, SanDisk Extreme Plus and SanDisk Extreme) are even faster, than the internal memory. Therefore I got the idea, to make a seperate external SD partition (SD-Ext) to the new Data partition. It works flawlessly and fast. But how does it work? The first step of the Android startup process is to mount the boot image and to mount a ramdisk, that is part of the boot image. In this ramdisk you will find the mount table for the primary partitions - it is called fstab.pyramid. Here you will find, that the data partition is mounted to /dev/block/platform/msm_sdcc.1/by-name/userdata or to /dev/block/mmcblk0p23. The only thing to do is, to change this to /dev/block/mmcblk1p2, which is the second partition of the SD-Card.
The attached ZIP now contains a Batch file together with all necessary tools to do this job for you completely automatically. It extracts the boot.img file from your flashable zip, extracts the kernel and the ramdisk.gz, unpacks the ramdisk, patches the fstab.pyramid as described above, repacks the ramdisk, repacks the boot.img, makes a copy of the original flashable zip, exchanges the boot.img in this new zip - done! You have got a new flashable zip, that will mount the second SD-Card partition as your new data partition. I do this with an 8 GB sd-ext partition and therefore now have got a Sensation with 8 GB of available internal memory - no need to care about memory or tools like Link2SD any longer!
Click to expand...
Click to collapse
Installation:
Take these steps:
the attached zip contains the batch and all needed utilities
extract the directory tree in the zip to a location on your Windows harddisk
place your flashable zip or boot-Image in the main directory which also contains this batch
open a cmd-windows by clicking "Start here.bat"
call "MakeNewImage" with your flashable zip or boot-Image: MakeNewImage <your-rom-or-image.zip>
or
just Drag+Drop your flashable zip or boot-Image to MakeNewImage.bat
after processing you will find the new flashable zip or boot-Image in the subdir "new"
all original parts (boot.img, kernel, ramdisk(.gz)) are in the subdir "original"
all new parts (boot.img, kernel, ramdisk(.gz) and your new flashable zip) will be in the subdir "new"
if you call the batch another time (or Drag&Drop a new image to MakeNewImage.bat, the complete subdirs will be deleted before processing the new fashable zip; the batch will then create the directories again with the new parts
if you like, you can make additional changes to the fstab.pyramid or init.rc ...
Click to expand...
Click to collapse
YOU MUST READ THIS OR YOU WILL BRICK YOUR DEVICE:
You have to know this - read carefully:
Tested with a lot of CM11 and CM12 Roms
It will only work for fashable zips that contain a boot.img, like @SultanXDA CM11, @ivanich CM12, @shantur CM12 - it will NOT work e.g. for @mike1986 Android Revolution, as this does not contain a boot.img.
ViperS 5.2.1 / Viper 5.3.0 do not work at the moment.
You should only make your sd-ext to the new /data partition if you have got a highspeed sd-card e.g. SanDisk Extreme-series; otherwise it will work, but your Sensation will slow down.
You need a sd-ext partition on your sd-card as second (!) partition (/dev/block/mmcblk1p2); create it within the recovery or use e.g. MiniTool Partition Wizzard and create a first partition as primary fat-formated and a second partition as primary ext4 formated. IF YOU HAVE NOT A SECOND PARTITION, YOUR DEVICE WILL NOT BOOT!
This is ONLY for the HTC Sensation/XE; it can work also for flashable images of other devices, but then you have to make your changes to fstab and/or init.rc manually!
After flashing the new image the /data partition will be created on the second SD-Card partition (sd-ext).
After booting for the first time you can restore a backup by using e.g. Titanium.
If you want to look at /data within the recovery you have to mount sd-ext and then flash the Aroma Filemanager; there you can see the complete data partition by browsing to sd-ext.
You can make a nandroid backup within the recovery. Note, that the sd-ext tar file is your (new) data partition.
If you want to go back, then just flash a nandroid of a former backup or flash a not patched zip and make a clean installation.
If your rom thread provides a seperate zip for the kernel, then have a look at the provided zip! If it contains a boot.img, then it has to be patched at first by using MakeNewImage.bat in the same way as with a complete rom. If the kernel zip does not contain a boot.img but only the kernel, then you can flash it directly.
If you want to wipe Dalvik-Cache you can't do it with the "wipe Dalvik"-command in Recovery; instead go into Recovery, mount sd-ext, flash the Aroma Filemanager or use the TWRP-Filemanager, navigate to the directory sd-ext (your new /data) and delete the directory dalvik-cache.
You can not restore a data partition from a former installation to sd-ext, because the tar file also stores the partition name and, therefore, does not restore a data file to the sd-ext partition, even it you rename the backup file. As said before: Make a clean installation and then restore via e.g. Titanium.
Click to expand...
Click to collapse
Thanks:
Special thanks to:
carliv (http://forum.xda-developers.com/member.php?u=5186178)
for mkbootimg.exe (https://github.com/bgcngm/mtk-tools)
GnuWin32 (http://gnuwin32.sourceforge.net/packages.html)
for sed.exe and grep.exe (libiconv2.dll, libintl3.dll, pcre3.dll, regex2.dll)
Igor Pavlov (http://www.7-zip.de/)
for 7z.exe and 7z.dll
Karl M. Syring (http://unxutils.sourceforge.net/)
for dd.exe, gzip.exe, od.exe, printf.exe, rm.exe, sha1sum.exe, tee.exe
@danishaznita for testing the first version
Click to expand...
Click to collapse
USE IT AT YOUR OWN RISK - NO SUPPORT! READ SECTION 'MUST READ' ABOVE CAREFULLY!​
DOWNLOAD TURBO DATA MOD V3.01​
DOWNLOAD Delta-Roh cpio Package V1.51 (already integrated in Turbo Data Mod)​
If you like my work, press​
THANKS for delta-roh ​
And, please, don't forget to rate this thread - thank you!​
If you want to use my work, please don't ask for permission, but leave my headers in my files, make a reference to me in your thread and respect the other persons in the thanks section, if you use their tools.​
copyright by delta-roh 2016
Reserved
Mod for Delta-Roh MakeNewImage-V3.01
EXPLICITLY for Ivanich CM11 ONLY!!!
This mod mounts a sd-ext partition to /data and leaves the dalvik-cache on the internal
memory. Therefore you will get e.g. an 4 GByte (depends ob your sd-ext partition size) data
partition and the original 1.1 GByte internal memory as additional and fast memory for
the dalvik cache. This is the fastest way regarding the porformance of the Sensation.
Installation:
- Download and extract "Delta-Roh MakeNewImage"
- start "MakeNewImage.bat" with "cm-11-20160810-UNOFFICIAL-pyramid.zip"
- answer the question "Do you want to auto-patch fstab [y/n]" with "n" (no) - don't close the command box!
- an explorer will open in the subdir of the new ramdisk, now do the following mods:
--- override the existing "init.rc" with the new one from this zip (Download below)
--- override the existing "fstab.pyramid" with the new one from this zip (Download below)
--- create a new directory "data0" in addition to the already existing data directory
--- copy/paste (press Ctrl-C then Ctrl-V) the file "data.attrib"
--- rename the new file ("data - Copy.attrib" or named similar) to "data0.attrib"
--- now you can close the Explorer and answer the question "Manual changes finished [y/n]" with "y" (yes)
Now you will get a "sdext_cm-11-20160810-UNOFFICIAL-pyramid.zip" that can be flashed.
NOTE: You will need a sd-ext partition on your sd-card.
DOWNLOAD Ivanich CM11 DATA MOD​
I think this a great idea, many thanks. I've been wanted to do it the since you mentioned the other day, I wanted a new phone too xD Well I did it today and then just seen your post. I did it on PC though (Linux) and mounted userdata as dalvik-cache so easy to wipe and maybe quicker loading (in theory). I may have mounted it differently to you (see screenshot), and are your attributes/flags the same?
hinxnz said:
I think this a great idea, many thanks. I've been wanted to do it the since you mentioned the other day, I wanted a new phone too xD Well I did it today and then just seen your post. I did it on PC though (Linux) and mounted userdata as dalvik-cache so easy to wipe and maybe quicker loading (in theory). I may have mounted it differently to you (see screenshot), and are your attributes/flags the same?
Click to expand...
Click to collapse
My Turbo Data mounts sd-ext to data (same to you) but don't mounts the old data to the dalvik-cache, because I have a SanDisk Extreme Plus and it is faster than the internal memory xD
BTW, my batch works completely with Windows and even without cygwin. At the moment I am working at a cpio batch that works with Windows without elevated rights and without cygwin as well...... xD
Question: what did you do to mount dalvik-cache to the original data partition? And which Filesystem manager did you use in the screen shots?
delta-roh said:
My Turbo Data mounts sd-ext to data (same to you) but don't mounts the old data to the dalvik-cache, because I have a SanDisk Extreme Plus and it is faster than the internal memory xD
BTW, my batch works completely with Windows and even without cygwin. At the moment I am working at a cpio batch that works with Windows without elevated rights and without cygwin as well...... xD
Question: what did you do to mount dalvik-cache to the original data partition? And which Filesystem manager did you use in the screen shots?
Click to expand...
Click to collapse
Yeah I must have the same SDcard as you by the sounds of it xD have so for ages and probably the reason I've been using Mounts2SD for so long but yeah got sick of it not working as expected as CM12/Android 5.x matures. Thanks to your idea/earlier post though and a bit of mucking around with it as I did have a few hiccups, eg. offset ramdisk address, all went well in the end and is quite a simple process once the know how. Over the time of using M2SD I felt like write speeds were slower (not actually tested but just how it felt) hence the reason why I use the f2fs file system on the sd-ext and I didn't want to leave my internal data partition all alone and unused. I was deciding and still am really for what to use it for, first ideas was for private storage or for app data but then I thought Dalvik-cache could be good because wiping it would be easier without modifying recovery or applying a script. I did this all on native linux (ubuntu) with a few binaries added, I was thinking of making a flashable zip to do the whole process if possible and I think it is but would be a bit of experimenting process and don't really have the time as yet and also you have got this underway already, so I probably wont. I don't mind posting the binaries I used and what I did if it will help, maybe you'd be into creating a version that doesn’t require a PC. The file manager I'm using is FX File Explorer (pro), I only just switched to it, well bout a month ago and I find it a good alternative to ES or Root explorer, it also has the material design theme which goes nicely with CM12 and has 90% of all the necessary features I need. I mounted internal data with fstab which I've attached for you and I've linked the /data/dalvik-cache/arm directory to it. You can name the internal data partition to whatever you like too.
This also could be good for those that corrupted their data partition too that was caused by the twrp recovery version from their site (not ivanich's version).
This is also good because I don't have to link things like Googles Drive cache to sd-ext anymore, for example it caches a copy into data say from a ROM downloaded with it.
Edit: Just checked my SDcard and it older than yours and probably not as quick but mines a 32Gb SanDisk Ultra SDHC-I and works fast enough for now.
hinxnz said:
Yeah I must have the same SDcard as you by the sounds of it xD have so for ages and probably the reason I've been using Mounts2SD for so long but yeah got sick of it not working as expected as CM12/Android 5.x matures. Thanks to your idea/earlier post though and a bit of mucking around with it as I did have a few hiccups, eg. offset ramdisk address, all went well in the end and is quite a simple process once the know how. Over the time of using M2SD I felt like write speeds were slower (not actually tested but just how it felt) hence the reason why I use the f2fs file system on the sd-ext and I didn't want to leave my internal data partition all alone and unused. I was deciding and still am really for what to use it for, first ideas was for private storage or for app data but then I thought Dalvik-cache could be good because wiping it would be easier without modifying recovery or applying a script. I did this all on native linux (ubuntu) with a few binaries added, I was thinking of making a flashable zip to do the whole process if possible and I think it is but would be a bit of experimenting process and don't really have the time as yet and also you have got this underway already, so I probably wont. I don't mind posting the binaries I used and what I did if it will help, maybe you'd be into creating a version that doesn’t require a PC. The file manager I'm using is FX File Explorer (pro), I only just switched to it, well bout a month ago and I find it a good alternative to ES or Root explorer, it also has the material design theme which goes nicely with CM12 and has 90% of all the necessary features I need. I mounted internal data with fstab which I've attached for you and I've linked the /data/dalvik-cache/arm directory to it. You can name the internal data partition to whatever you like too.
This also could be good for those that corrupted their data partition too that was caused by the twrp recovery version from their site (not ivanich's version).
This is also good because I don't have to link things like Googles Drive cache to sd-ext anymore, for example it caches a copy into data say from a ROM downloaded with it.
Click to expand...
Click to collapse
You mounted userdata to /dalvik-cache and I suppose you then changed the init.rc to link the dalvik-cache to /dalvik-cache - right?
delta-roh said:
You mounted userdata to /dalvik-cache and I suppose you then changed the init.rc to link the dalvik-cache to /dalvik-cache - right?
Click to expand...
Click to collapse
Yes that is correct.
Code:
# symlink dalvik-cache to internal location
symlink /dalvik-cache/arm /data/dalvik-cache/arm
hinxnz said:
Yes that is correct.
Code:
# symlink dalvik-cache to internal location
symlink /data/dalvik-cache/arm /dalvik-cache/arm
Click to expand...
Click to collapse
Why not this way?
Code:
symlink /data/dalvik-cache /dalvik-cache
delta-roh said:
Why not this way?
Code:
symlink /data/dalvik-cache /dalvik-cache
Click to expand...
Click to collapse
I did it this way because in the past, I've had issues with linking dalvik-cache to other locations due to SELinux but only on later versions of Android 5.x though.
But then again I haven't tried this approach with this configuration yet.
thanks delta roh..
so, at least how much R/W speed that need run this?
based on Sandisk Extreme spec, min speed is around 60MB/s for read. is it correct?
phan_tom said:
thanks delta roh..
so, at least how much R/W speed that need run this?
based on Sandisk Extreme spec, min speed is around 60MB/s for read. is it correct?
Click to expand...
Click to collapse
Sandisk Extreme is the highest u can go , i think any Class 10 sdcard can handle this , but with a little lower speed
Sent from my Note 2
phan_tom said:
thanks delta roh..
so, at least how much R/W speed that need run this?
based on Sandisk Extreme spec, min speed is around 60MB/s for read. is it correct?
Click to expand...
Click to collapse
The internal memory (original /data) has got about 30 MB/s read and about 15 MB/s write speed. The card has to match these values. But the speed declarations of the cards are allways higher, than they are in real life! A SanDisk Extreme matches these speeds in real live. The Extreme Plus and Pro are better and will give you REAL FUN!
Just try it - to have a Senni with e.g. 8GB internal memory is awesome!
danishaznita said:
Sandisk Extreme is the highest u can go , i think any Class 10 sdcard can handle this , but with a little lower speed
Sent from my Note 2
Click to expand...
Click to collapse
Right! Having 8GB of internal memory and no mem-problems any more is also worth a little bit less speed (in the case you got no SanDisk Extreme). BTW: Thank you for testing the pre-releases and did you try the release 1.04?
Unfortunately,
Your method does NOT suits me fine - extremely laggy and slow.
I have tried it with the latest ivanich CM11 and CM12 builds.
I have preliminary made an 8Gb ext4 partition on my 32GB class 10 MicroSD card.
I always set governor to intellidemand, clock to 1242MHz and use cfq for I/O.
Will test Links2SD method now.
Nevertheless,
keep up the good work!
ChimeyJimmey said:
Unfortunately,
Your method does NOT suits me fine - extremely laggy and slow.
I have tried it with the latest ivanich CM11 and CM12 builds.
I have preliminary made an 8Gb ext4 partition on my 32GB class 10 MicroSD card.
I always set governor to intellidemand, clock to 1242MHz and use cfq for I/O.
Will test Links2SD method now.
Nevertheless,
keep up the good work!
Click to expand...
Click to collapse
I tried the CM12 build of ivanich and it has got an extrem low performance of the runtime environment (in Antutu 77 compared to Sultans CM11 with 900) and I tested it with dalvik-cache in the data partition and not on sdext. It seems as if the runtime system was compiled with debug options.
delta-roh said:
I tried the CM12 build of ivanich and it has got an extrem low performance of the runtime environment (in Antutu 77 compared to Sultans CM11 with 900) and I tested it with dalvik-cache in the data partition and not on sdext. It seems as if the runtime system was compiled with debug options.
Click to expand...
Click to collapse
Huh I just downloaded Antutu from playstore to test myself, still on the same configuration and my score is way higher than you got on CM12 and even higher than your CM11 score, only ran the benchmark once so it not like the highest out of several either on stock frequency, governor, scheduler etc.
Will it work on viper sense5.0 and what if my mcard crashes because sometimes it stops working and I have to format my mcard. So what if it crashes will it affect my senny
cutejerk420 said:
Will it work on viper sense5.0 and what if my mcard crashes because sometimes it stops working and I have to format my mcard. So what if it crashes will it affect my senny
Click to expand...
Click to collapse
Nobody is able to answer these questions. Normally SD-Cards are absolutely stable. Make a regular nandroid backup e.g. every day.
hinxnz said:
Huh I just downloaded Antutu from playstore to test myself, still on the same configuration and my score is way higher than you got on CM12 and even higher than your CM11 score, only ran the benchmark once so it not like the highest out of several either on stock frequency, governor, scheduler etc.
Click to expand...
Click to collapse
Remarkable! Please post your configuration - do you use F2FS and on which partitions?
delta-roh said:
Remarkable! Please post your configuration - do you use F2FS and on which partitions?
Click to expand...
Click to collapse
I use f2fs on sd-ext and ext4 on userdata, I use the fstab which I posted earlier and added the symlink to init.rc, on line 319 to be exact xD
Unpacking, repacking and making boot image was done on Linux, not sure if that would make a difference though.

Categories

Resources