[How-To] data2ext for Reborn, Froyo 2.2 and CM7

the_maplebar

Well-known member
Jan 18, 2011
171
53
0
Visit site
The goal of this guide is to have everything you need to know to run data2ext on Reborn ROM, CM7 and it should work with any custom ROM with a compatible kernel.

Tested Working ROM's
Reborn ROM Drew Walton's CM7 thkraven's CM7 GRom


Does Not Work With
Stock Sprint ROM Opti-ROM (Darktremor's app2sd is built in use that instead see instructions on the first post [ROM] Opti-ROM v1.1.1 built-in apps2sd and storage management!


If you have tried these instructions on another ROM let me know and I will update the list of what works and what doesn't.

Prerequisites
  • one of the working custom ROMs listed above
  • Xionia Recovery or ThunderC Recovery
  • A fast SD card (preferably class 6 or higher and 8GB or larger, a quality class 4 will probably work too)

Steps To Move /Data to SD-EXT
  1. Backup your SD card if you have anything on it.
  2. Reboot into recovery and format your SD card.
    Select Advanced and then Partition SD Card
    For EXT partition choose 1024 MB, for SWAP choose 0
  3. Download data2ext zip and copy it to the root of your SD card.
    Select the correct data2ext zip
    For Reborn, GRom or other VD based ROM's with Picasticks Kernel use data2ext-V4-modified.zip For CM7 based ROM's use data2ext4-V4.zip
  4. Boot into recovery and flash the data2ext zip.
  5. Reboot into the ROM and make sure SD-EXT is not mounted. From ADB shell run
    Code:
    mount|egrep mmcblk0p2
    If that command returns anything unmount SD-EXT by running
    Code:
    umount /dev/block/mmcblk0p2
  6. Format the ext partition by running these commands from ADB shell:
    Code:
    mke2fs -m0 -b4096 /dev/block/mmcblk0p2
    tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2
    e2fsck -yf /dev/block/mmcblk0p2
    tune2fs -o journal_data_writeback /dev/block/mmcblk0p2
    tune2fs -O ^has_journal /dev/block/mmcblk0p2
  7. Activate data2ext by running this from ADB shell. Reborn/VD based ROMs will see some errors about modules already being loaded
    Code:
    data2ext --enable
  8. Reboot, Restore your SD card contents
  9. Profit

Steps To Move /cache/dalvik-cache to /data/dalvik-cache on SD-EXT
  1. Mount the /system partition R+W with adb by running
    Code:
    adb remount
  2. Using adb shell remove the script that moves /dalvik-cache to /cache.
    For Reborn/GRom run the command
    Code:
    rm /system/etc/mvdalvik.sh
    For CM7 run the command
    Code:
    rm /system/etc/init.d/01mvdalvik
  3. Reboot into recovery and wipe the /cache
  4. Reboot, this will most likely take a while to rebuild the /cache and /dalvik-cache

I didn't come up with any of these procedures, I just went through the process of doing this on my phone in CM7 and Reborn so I decided to post a consolidated set of procedures for everyone.

Special Thanks to
TheGrammarFreak and a bunch of others at XDA-Forums LG Optimus V Wiki Takenover83 and other from Optimus V forums babbyboy80 for testing on GRom All the active users here who have worked to figure this out, especially: glitchsta, blackops1125, basketthis, Magicman08, lichan, acromack, manny29
 
Last edited:

the_maplebar

Well-known member
Jan 18, 2011
171
53
0
Visit site
FAQ

  1. Will this work with terminal instead of ADB?
    Yes, just be careful to enter everything correctly. It's easier to copy and paste with ADB. There is one difference where it says to remount system as R+W. The terminal command for this will be:
    Code:
    # mount -o remount,rw -t yaffs2 /dev/block/mtdblock5 /system
  2. I have 1 GB of internal storage now but I'm still having problems with the market running out of memory?
    These roms move /dalvik-cache to /cache to make more room in /data. We need to move dalvik-cache back to data or the sd card to free up room in /cache for the market downloads. See the bottom half o the How-To for instructions on moving dalvik-cache.

    here is another thread that discusses moving the dalvik-cache to free up more room. This includes a flashable zip that will move the dalvik-cache for you. (for CM7 roms only). I haven't tested it, but it looks to me like this zip is using ext2 instead of ext4.

  3. I have a different Rom will this work?
    Yes it should. You just need to have ext4 support which XioniaRedux and the latest custom kernel's have. Try it and let me know I will update the list.

  4. I have a different Rom do I need to move /dalvik-cache?
    I don't know. To check where your dalvik-cache is from a terminal or ADB shell run. If this returns anything other than "No file or directory found" then your dalvik-cache is in /cache and should be moved
    Code:
    ls /cache/dalvik-cache


    [*]I am using CM7 and /cache/dalvik-cache still has a bunch of files in it?
    It turns out that even after you delete /system/etc/init.d/01mvdalvik the system apps on the ROM will be put in /cache/dalvik-cache. Any user apps (from the market) will go to /data/dalvik-cache so you shouldn't run out of room when downloading lots of market apps. This is probably a good thing as it means the system apps are still on internal /cache memory
 
Last edited:
  • Like
Reactions: CardcaptorRLH85

DoesItMatter

Well-known member
Dec 3, 2010
294
37
0
Visit site
I know its been mentioned in other posts, but won't you run out of cache space way before you use up the 1GB?

Most of these roms have the dalvik-cache -> /cache tweak, which increases amount of space in /data,
but also means that your dalvik-cache will have a space limitation as well.

For optimal benefit, I think you would also need a dalvik-cache -> ext tweak as well.

Then you could truly use upto 1GB of storage space for apps / data, etc.
 

basketthis

Well-known member
Nov 22, 2010
1,470
473
0
Visit site
Nice! ;)

EDIT: To elaborate on the comment by DoesItMatter: I've always suggested using the cache2sd method as it doesn't produce market errors. I do know that the cache method works with cm7 roms but I'm not sure that it will work with reborn. However, it probably wouldn't take much l, if anything, to get it to work.

The important part of this whole process is to get the card partitioned and formatted to ext4. From there, either solution can be tried. :)

EDIT 2: IIRC, the two (data2ext and cache2sd) do not currently work together. So, its one or the other...
 
Last edited:
  • Like
Reactions: Jessicalt1

the_maplebar

Well-known member
Jan 18, 2011
171
53
0
Visit site
Thanks for the comments, I want to address this once I have tested the correct fix for it. While I was putting together the how-to I noticed the shell script that handles moving dalvik-cache to cache. Is that a good way to fix this problem? It looks like the files are:

Reborn:
/system/etc/mvdalvik.sh

CM7
/system/etc/init.d/01mvdalvik
 

DoesItMatter

Well-known member
Dec 3, 2010
294
37
0
Visit site
Per Edit2 - data2ext and cache2sd don't work together...

What if you did separate partitions for each of them?

Is the problem that they share a partition?

What if you did

Part1 - ext4 (data2ext) (1GB)
Part2 - ext3/4 (cache2ext) don't know if it needs ext4 (512MB)
Part3 - ntfs (rest of space)

Would that work? And yea, I could definitely see this needing a Class-6 or Class-10 microSD card!
 

blackops1125

Advisor
Mar 19, 2011
1,037
184
0
Visit site
Prerequisites
•one of the working custom ROMs listed above
•Xionia Recovery
•A fast SD card (preferably class 6 or higher and 8GB or larger)

Even though the higher class cards are prefered a GOOD class 4 card will work Just fine. Just make sure it is not a cheap one. Most of the ones that come with the phones are cheap ones and will often die if over taxed. Go and buy a good one they are fairly cheap!

Great job on the How-too guide for this.
 
  • Like
Reactions: Jessicalt1

basketthis

Well-known member
Nov 22, 2010
1,470
473
0
Visit site
So, how would one uninstall one of those to load the other? Or is it just a matter of

Code:
data2ext --disable

If you have data2ext running that will stop it and allow cache2sd to run (once flashed). Disabling cache2sd is a bit more of a process.

NOTE: I haven't had much spare time lately so I haven't been able to use my computer. Bring this limited it is hard to shed light on certain things without being able to examine the files. Hopefully someone can explain a little more about why they don't work together. I do know that they don't. :D
 

Jessicalt1

Lover of all things Andi
May 17, 2010
401
47
0
Visit site
You can also use ThunderC recovery.

Boot into recovery>Partition SD card>Partition SD (picked same options)

Once that is done,

Recovery>partition SD card>SD:ext3 to ext4

Flash zip, reboot into ROM, go to terminal emulator (or ADB) and enable.
 
  • Like
Reactions: DarkRival

acromack

Well-known member
Jan 10, 2011
300
49
0
Visit site
Hey, feel free to incorporate this info I put together a while ago... http://forums.androidcentral.com/lg-optimus-s-rooting-roms-hacks/102004-guide-data2ext-13.html#post1153618

It has a flashable zip with a script I modified that does the following:

- Moves dalvik-cache back into /data partition (it is normally in /cache, and fills it up pretty quick)
- Moves /data partition to /sd-ext
- Makes the links to new location of data using the rest of the data2ext script as normal.

Instructions are on the post as well, and just had to test it again as my phone puked all over the place (thanks to me messing with it and essentially screwing it up, requiring me to start fresh).

It is designed to work with any gingerbread build (right now, pretty much just CM7), and will end up moving both data and dalvik-cache to the sd-ext partition. I know people in this thread expressed concern over the cache, and this will handle it. The files left over in /cache won't cause an issue, because without dalvik in there, there's plenty of room. I have probably 150+ apps, and cache is only half full, data is half full (on a 1gb sd-ext partition).
 
  • Like
Reactions: dobbs69

Masterjakeway

Well-known member
May 26, 2011
159
10
0
Visit site
am I looking at any problems if I didn't format the card or the partition? I followed the guide skipjack linked to. But when I had went in to put in the commands it didn't take. I enabled anyways and it seems to work alright?
 

basketthis

Well-known member
Nov 22, 2010
1,470
473
0
Visit site
am I looking at any problems if I didn't format the card or the partition? I followed the guide skipjack linked to. But when I had went in to put in the commands it didn't take. I enabled anyways and it seems to work alright?

You are missing a very important step. You must format the partition to ext, preferably, ext4. It world the best. It may seem as if it is working but its not and can cause you some issues down the road...
 
  • Like
Reactions: Jessicalt1

DoesItMatter

Well-known member
Dec 3, 2010
294
37
0
Visit site
Now - with /data and /dalvik-cache -> SD - you have the un-used data space on the phone.

That portion should be faster access than SD-Card access

What if you format the un-used data portion to /swap

Will the droid software auto-mount and use the /swap on boot?

Wouldn't that give the phone a little more OOMF and mem space to use?
 

the_maplebar

Well-known member
Jan 18, 2011
171
53
0
Visit site
I added this to the FAQ section for moving dalvik-cache to the sd card on Reborn Rom. Let me know any comment or suggestions and I will modify it as necessary.

This part of the steps is a work in progress, I have tried it out now but I want to have it running for a while on my phone before I'm confident in it. That being said, MAKE A NANDROID BACKUP FIRST!
  1. Mount the /system partition R+W with adb by running
    Code:
    adb remount
  2. Using adb shell remove the mvdalvik.sh script (by removing this the dalvik-cache will be left on /data which is now on the sd card)
    Code:
    rm /system/etc/mvdalvik.sh
  3. Reboot into recovery and wipe the /cache
  4. Reboot, this will most likely take a while to rebuild the /cache and /dalvik-cache
  5. Verify that the dalvik-cache was moved (Optional), from adb shell run
    Code:
    ls /cache/dalvik-cache
    This should return "No such file or directory"
    Code:
    ls /data/dalvik-cache
    This should return a bunch of files ending in .dex
    Code:
    mount | egrep data
    This will show that /data is mounted at /dev/block/mmcblk0p2 the ext4 partition on your sd card
 

acromack

Well-known member
Jan 10, 2011
300
49
0
Visit site
Basically, after you delete the script that moves dalvik, it'll go back to its default location in data. That means when data is moved to sd-ext, so is dalvik.

So yes, your above instructions should work perfectly. PS, you should be confident in it. I've been running this setup for probably close to a month (or more), and it runs rock solid. If I have time to relearn it, I could pull that section out from the zip I made a while ago, and make a flashable zip that does just this. Right now it does this AND gets you data2ext.

BTW, looks like for reborn, the script in question is simply names mvdalvik.sh - for CM7 I know it's slightly different. And it's in a different location. If someone can verify the exact location/name for the script that moves dalvik for a froyo build (which is what I assume reborn is), then I can whip up flashable zips for both froyo and gingerbread that'll take care of moving dalvik. Then maybe comes new zips for data2ext if they need to be altered at all..
 
  • Like
Reactions: the_maplebar

Members online

Forum statistics

Threads
942,111
Messages
6,912,522
Members
3,158,234
Latest member
nayminthuyain888