Related
Here is the kernel with yaffs2 and MTD block support, I am missing some mtd util tools like nandwrite so i cannot continue. Those that have the tools like mkyaffs2image, nandwrite, flash_eraseall can try to create an image and mount it
here are the steps that i think should work:
# mknod /dev/mtd0 c 90 0
# flash_eraseall /dev/mtd0
# mkyaffs2image /data/data yaffs2.img
# nandwrite -p /dev/mtd0 yaffs2.img
# mkdir /data/data2
# mount -t yaffs2 /dev/mtdblock0 /data/data2
If you have the tools, please attach so we can continue.. Its getting late so I am going to bed, have fun
Download
yaffs2_support.tar
Oh my god! I was just about to post similar findings, what a coincidence!
I just had compiled a kernel with yaffs2 support. My idea was to modify /init.rc in the kernel to mount the partitions with yaffs2 instead of rfs. Problem: we can't just change the filesystem without backing up and restoring all the files inside. My idea was to do that inside the recovery. Mount a mountpoint, backup with tar to /sdcard, unmount, format with dd (in theory a partition filled with 0's is ok for yaffs2), mount again with yaffs2 and restore from tar.
I'm stuck at the point that I can't seem able to mount any partition with yaffs2 previously formatted (with /system/xbin/busybox dd if=/dev/zero of=/dev/block/stl10). If I mount (/system/xbin/busybox mount -t yaffs2 /dev/block/stl10 /dbdata) there is always an "Invalid argument" error. It happens with /dev/block/stl*, /dev/block/bml* and /dev/block/mmcblk*
I'm no kernel expert, neither I know a lot about yaffs2, but I think I read you can't mount a yaffs2 partition anywhere, it has to be an MTD flash device.
Anyway, I'm going to try with the tools you said. Wish me luck.
Thanks for your work rasdeep! Is it only YAFFS2 and MTD support that you added? Because the kernel already had support for EXT2 and EXT3.
darksnarfer said:
I think I read you can't mount a yaffs2 partition anywhere, it has to be an MTD flash device.
Click to expand...
Click to collapse
Does the kernel that rasdeep posted load the existng flash devices/partitions as MTD devices?
I think as a start you only have to worry about formatting the /dev/block/mmcblk0p2 device which is mapped to the /data directory. With the new lag fix we are only moving directories stored in /data and that is what gives a big performance improvement. RyanZA did tests and found that the /dbdata partition was already quite fast and I don't think we have to worry about the /system partition etc. because we don't really write to them.
I think after a new firmware flash the /dev/block/mmcblk0p2 (mounted as /data) will be safe to format into YAFFS2 without loosing anything important.
I think these are the steps we can do:
1. Flash new firmware with repartition option on to erase everything.
2. Boot into recovery and format /dev/block/mmcblk0p2 as YAFFS2 filesystem.
3. Copy on new a init.rc script which will mount /dev/block/mmcblk0p2 to /data as a YAFFS2 filesystem and not a RFS filesytem to get much faster speeds.
bub181 said:
Does the kernel that rasdeep posted load the existng flash devices/partitions as MTD devices?
Click to expand...
Click to collapse
Just checked, there isn't any /dev/block/mtd* so I guess the kernel still can't see them as mtd.
/data is on the internal SD not in NAND so will we be able to use yaffs2 at all? I was working on formatting to EXT4 and adding the init.rc to match as well as compiling with EXT4 support, but if yaffs2 works, I'm fine with that.
modifying the init.rc is secondary because that is easy.. the main problem now is to be able to manually setup yaffs2 to mount properly.. if everything works like it should, init.rc can be change in matter of seconds
its funny now u said mtd not found.. i know we can mknod /dev/mtd* but there should be /dev/mtdblock* when booting with kernel right? hmm.. something to investigate further..
keep suggestions and finding coming, we may hit something that i've missed
problem is im lacking those tools that will do write to flash directly.. for example nandwrite.. anyone has that can share so i can try more stuff?
also, are my steps for "preparing" yaffs2 partitions/image correct? if anyone familiar with yaffs, please give some insight
raspdeep said:
modifying the init.rc is secondary because that is easy..
Click to expand...
Click to collapse
Do you need to recompile the kernel to modify the init.rc? If not could you post some instructions on how to do it please? I would like to try some things in there before /data gets mounted as a RFS filesystem.
bub181 said:
Do you need to recompile the kernel to modify the init.rc? If not could you post some instructions on how to do it please? I would like to try some things in there before /data gets mounted as a RFS filesystem.
Click to expand...
Click to collapse
i'm afraid so for now until someone found a way to extract the initramfs from later kernel and restore it back after modification..
I think it would be easier to start out with EXT2 since we can easily format that. Just as a proof of concept. I'm planning to do so tonight. Then I'll add support for EXT4 formatting and try that.
raspdeep said:
problem is im lacking those tools that will do write to flash directly.. for example nandwrite.. anyone has that can share so i can try more stuff?
Click to expand...
Click to collapse
Have you seen these pages rasdeep? They seem to describe how to create the YAFFS filesystem. Also, are there any /dev/mtdblock* devices using the kernel that you created? According to what I read elsewhere it is supposed to create both /dev/mtd* and /dev/mtdblock*. I think we have to use /dev/mtdblock* to create the new filesystem.
http://processors.wiki.ti.com/index.php/Create_a_YAFFS_Target_Image
http://processors.wiki.ti.com/index.php/MTD_Utilities
http://processors.wiki.ti.com/index.php/Put_YAFFS_Image_to_Flash
Also, I know that the Nexus One uses YAFFS2 for its internal filesystem. Maybe someone has worked out a way to write a new image file for that and we can use what they have learnt?
Can we potentially use this kernal (with the right tools) to format the NAND in YAFFS2 instead of RFS? Then still have way of flashing firmware onto it?
If so, that would be awesome and it would seem to have the least draw backs.
Currently the A2SD lag fix requires an external microsd card, and the one click lag fix, mounts a EXT2 image ontop of the RFS NAND, and that could drastically affect NAND life.
This is great !!!
Thank you raspdeep and all the devs here, this is one step closer to a stable kernel and a permanent genuine solution for the lag problem as far as a n00b like me understands
cheers !
Daemos said:
Can we potentially use this kernal (with the right tools) to format the NAND in YAFFS2 instead of RFS? Then still have way of flashing firmware onto it?
If so, that would be awesome and it would seem to have the least draw backs.
Click to expand...
Click to collapse
Not if we can't mount the NAND as a MTD-device instead of STL-device.
Daemos said:
Currently the A2SD lag fix requires an external microsd card, and the one click lag fix, mounts a EXT2 image ontop of the RFS NAND, and that could drastically affect NAND life.
Click to expand...
Click to collapse
Say what? /data/ is mounted on the internal SSD, not the NAND. /dbdata/ is however mounted on the NAND. Just do a df -h and you can see all the mountpoints.
Also, mounting and using a ext2-image that reside on an rfs-partition will not damage your drive. The rfs filesystem is still the one used to store the image itself (the ones and the zeros), even though you write it inside an image that uses another filesystem.
I stumbled upon these documents while Googling for STL-devices:
http://www.samsung.com/global/busin...y/downloads/LinuStoreII_GPL Compliance_10.pdf
http://www.samsung.com/global/busin...ionmemory/downloads/RFS_130_Porting_Guide.pdf
I haven't had the time to read them through yet. But if there's a porting guide, there must be a way to reverse it
Go go reverse engineers!
Is it really necessary to format the NAND with another filesystem? /dbdata seems fast enough as it is. Wouldn't it be enough (and easier?) to only convert the internal SD to yaffs2?
Quote from someone that knows a lot more than I do:
yaffs2 won't work on a sdcard
Click to expand...
Click to collapse
http://twitter.com/wesgarner/status/20805997718
So right now we have /data that is mounted in the second partition of the internal sdcard (mmcblk0p2), where all the critical files are stored (data, dalvik-cache, etc..) but we can't use yaffs2 there because it's not MTD.
We could, however, format and mount the other partitions (/system, /dbdata, /cache, etc...) with yaffs2, but that might not help because there isn't many heavy read/write there. And we should figure out how to make the kernel see them as /dev/block/mtdblock* instead of /dev/block/stl*.
rasdeep, can you share the .config for the kernel you used? I managed to get some mtd devices (atleast in /proc/mtd) but they were virtual devices. Maybe we need some more options enabled in the kernel.
Also, anybody knows why there are /dev/block/stl* and /dev/block/bml* they seem the same though.
darksnarfer said:
Also, anybody knows why there are /dev/block/stl* and /dev/block/bml* they seem the same though.
Click to expand...
Click to collapse
According to http://www.samsung.com/global/busin...ducts/fusionmemory/Products_XSR_Brochure.html
STL and BML are independent layers for managing I/O to the NAND devices
STL manages the sector translations while BML manages the invalid blocks (whatever that means)
Did any of you notice that in init.rc there are many references to yaffs2 ? Perhaps in engineering Samsung did use it ?
Chainfire said:
Did any of you notice that in init.rc there are many references to yaffs2 ? Perhaps in engineering Samsung did use it ?
Click to expand...
Click to collapse
Yeah, I think they are just android standard (maybe they took them from a template) and commented to use their better(?) filesystem.
darksnarfer said:
Quote from someone that knows a lot more than I do:
http://twitter.com/wesgarner/status/20805997718
So right now we have /data that is mounted in the second partition of the internal sdcard (mmcblk0p2), where all the critical files are stored (data, dalvik-cache, etc..) but we can't use yaffs2 there because it's not MTD.
We could, however, format and mount the other partitions (/system, /dbdata, /cache, etc...) with yaffs2, but that might not help because there isn't many heavy read/write there. And we should figure out how to make the kernel see them as /dev/block/mtdblock* instead of /dev/block/stl*.
rasdeep, can you share the .config for the kernel you used? I managed to get some mtd devices (atleast in /proc/mtd) but they were virtual devices. Maybe we need some more options enabled in the kernel.
Also, anybody knows why there are /dev/block/stl* and /dev/block/bml* they seem the same though.
Click to expand...
Click to collapse
Ok, so what filesystem does the internal SD use currently? Would it help if we change that to EXT4? That would emulate the current mimocan fix, but without having to use an external SD card.
Hi!
I found this script / mod:
flash this from recovery:
hxxp://mediafire.com/download.php?znwywidvo9s6ayn
does this:
su
cp -rf /system/media /sd-ext
rm -rf /system/media
ln -s /sd-ext/media /system
and also drops a script in init.d to mount the ext partition at boot time.
Click to expand...
Click to collapse
My question is:
How can i symlink the complete mediafolder to the ext3 partition.
I think, the quoted script isn't necessary, cause the ext3 partition is mounted on every startup, so i only need the command to put in the terminal emulator.
Or can someone modify the app2sd+ script, to make it flashable?
It's annoying, that my customsounds (on the FAT32 partition) won't be played, when the phone is mounted as an usb storage...
Thanks in advance.
ToM
PS: ****! Made an [QUESTION] before, but the forum uses prefixes... plz remove @ mod / admin. thx
Any ideas in here?
Hope this is in the right section, I need help from a developer on this as I don't quite understand what is needed to do this.
I use Gingervillain and the DT a2sd. What I want to do is move my /cache (not dalvik cache but the partition itself) to ext.
I have the commands all ready to do this and that aspect works fine (thanks to help from droidzone).
However, as its sharing the ext partition with DT, when I mount cache there, the apps don't work. Added to which if a market app is downloaded, it downloads the apk to the cache folder I created on ext fine. When it attempts to intall, it fails.
I assume (with my limited knowledge) that there is a conflict here due to multiple mounts on the same partition. I initially thought my mount cache command needed to with the same options that DT mounts, but cant find that reference in his script or the files it calls.
So I have created a 2nd ext partition, but I dont know how to use it. I thought it would automatically be mmcblk0p3, but I cant find it that way using adb.
I know data2ext uses multiple partitions for sqlite etc, but cant for the life of me work this out.
Can anyone point me in the right direction please?
The aim of this is to develop myself a cache2sd solution. I have searched around a lot but can't find one. I thought CM had one but cannot find that either.
Further to this, ls /dev/block lists mmcblk0p3
However,
Code:
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p3 /system/sd
Returns
Code:
failed: Invalid Argument
but
Code:
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /system/sd
Works fine.
Does anyone have any idea how I can use the second EXT partition at all or any tips or info please?
format
rootSU said:
Does anyone have any idea how I can use the second EXT partition at all or any tips or info please?
Click to expand...
Click to collapse
format mmcblk0p3 in ext4 format and mount it
susmaz said:
format mmcblk0p3 in ext4 format and mount it
Click to expand...
Click to collapse
Better 2.5 years late than never
Although that would not have been the answer.
Why do you need this 2nd partition??
If i understnad correctly you want the cache on a ext partition, so the play store can download to this partition and than install the apk to intern bzw. The prim ext??
I did a search on this as I was curious. I remember seeing in the merges about ext4 being supported for CM7 and a google search and forum search came with nothing. I was able to find information about ext4 replacement for Samsung phones such as Galaxy S and Nexus S.
I posted this on the EVO forum as someone there had a similar question:
tiny4579 said:
teh roxxorz said:
CM7 uses ext 4, so I believe the answer is yes. I believe it is formatted.
Click to expand...
Click to collapse
I actually am not sure if it defaults to ext4. I found this thread when I was about to post the same thing asking in the Dinc forums. I run CM7 RC4 and a simple mount command from the terminal shows ext3 instead of ext4.
For me /system and /data are yaffs2 and /data/data is ext3.
EDIT: Looked at it again, /system and /data/data are yaffs2 and /data and /cache are ext3. Anyone know how to format in CWM?
Click to expand...
Click to collapse
I'm thinking if I could nandroid backup, reformat ext3 as ext4 and then restore, it should work for me. I know at least the Tiamat kernel currently supports ext4.
Any ideas?
Anyone? I'm curious if at least doing this could help performance as I believe ext4 is definitely faster than ext3.
Sent from my ADR6300 using Tapatalk
So I tried a nandroid backup then formatting /system /data and /cache using CWM 3.0.0.8 and restoring backup but no change. /system and /data/data are still yaffs2 and /data and /cache are still ext3. I think if I use mke2fs with the correct options it might work. I remember seeing support in CM7 for it and the kernel I'm using definitely supports it.
EDIT: So this is more of a because-I-want-to project than because I think significant improvements will be made. Next step would be to see if I can use a command line format using adb in recovery.
I converted ext3 to ext4 for /data and /cache as follows but when I reboot it mounts as ext3 (maybe I have to reflash rom?):
From adb shell:
Code:
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p1
e2fsck -fpDC0 /dev/block/mmcblk0p1
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2
e2fsck -fpDC0 /dev/block/mmcblk0p2
The best post for this is:
http://forum.xda-developers.com/showthread.php?t=534714
Still trying to convert /system and /data/data to ext4.
For anyone reading, the file to be edited is /init.inc.rc which is part of the ramdisk so the actually ramdisk needs to be modified or any changes will not stick on a reboot. It proves quite challenging. Maybe the rom or kernel do not prefer ext4 over ext3.
tiny4579 said:
For anyone reading, the file to be edited is /init.inc.rc which is part of the ramdisk so the actually ramdisk needs to be modified or any changes will not stick on a reboot. It proves quite challenging. Maybe the rom or kernel do not prefer ext4 over ext3.
Click to expand...
Click to collapse
Can you provide instruction on how to change /init.inc.rc ? Thanks !
vikstk said:
Can you provide instruction on how to change /init.inc.rc ? Thanks !
Click to expand...
Click to collapse
I can actually do something a little simpler than that.
Basically I took Chad's 4/19 kernel and extracted the file and edited it and put it back in. It took a bit of work to figure it out. Thanks to Chad and Conap I got it working. If I missed anyone else I apologize.
The prerequisite for this to do anything is to make sure you have actually converted the current ext3 partitions to ext4. You can check by running mount from adb or terminal emulator.
Then flash the below zip which will load Chad's 4/19/11 kernel and also allow mounting as ext4. If you want a different kernel you can just flash over it and it should still be ext4. If you want to undo it just wipe and reinstall any ROM.
http://dl.dropbox.com/u/31805083/2.6.37.6-incredikernel-gb-4192011-ext4.zip
WORD OF WARNING: if you do this, wiping /data from recovery will not actually wipe data. AND if you install a new ROM, via clean or dirty flash, chances are your large /data partition will go all screwy on you. It did for me. If I flashed anything, it tends to cause boot loops or hangs at the boot animation.
If you are dirty flashing anything, I would first get as much off of the large /data as you can to get it to 2 GB or less, then drop it on top of your 2 GB /data partition, then dirty flash, let everything come back up and get stable then repeat these steps starting at step 2 to blow away your large /data and then mirror your 2 GB /data to your large /data.
The problems I had could be related to xposed, but I am not 100% certain on this. It is my best guess from looking at my logcat (doesn't actually indicate a crash in there, but has a lot of stuff related to xposed).
These steps are more for the non-flashaholics amung us OR people who flash new stuff but roll back to nandroid. Once you pop the larger /data onto any ROM, your nandroid will likely not play nice with it anymore as your larger /data is not restored from a nandroid.
And the normal "warranty is now void" and "if things break, it isn't my fault" disclamer stuff too. But I'm running this right now and liking it (except when I go to jump to KK it may not be happy with me... gonna need to do some testing to nandroids work properly AND so I can flash ROMs without blowing everything up... thinking it is just the dalvik that is unhappy, but I am uncertain at this time)
I was having issues with my /data partition getting full on me after getting new ROMs set up. This was irritating me and I came to the conclusion that 2 GB was just not enough space for some of the larger apps out there. So I went ahead and started investigating and testing how to get /data onto the external SD card.
2 complications arise:
1) it needs to be in ext4 format to preserve permissions
2) it needs to be swapped post boot AFTER the sd card is mounted (potentially, I have not fully tested this).
So this becomes a multi step process. What you need:
1) an external SD card that is at least 2 GB in size if not larger (I recommend larger simply because what is the point of having it on external storage if you aren't gaining any extra space)
2) a SGH-T989D (I do not have an SGH-T989 to test it with BUT I am confident it will work with that one too)
3) some partitioning software on your PC (I recommend EaseUS or AOMEI, but use whatever you are comforatble with)
4) latest version of busybox installed on your phone
So, the steps to do this:
1) partition your external SD card into at least 2 partitions, where your second partition will be used for /data. The first partition automatically mounts to /storage/sdcard1, but partition 2 will NOT auto-mount. You do not need to format this if you do not want to. This is up to you how you do it.
2) Run the following commands from either adb shell OR android terminal:
su
mke2fs /dev/block/mmcblk1p2
mkdir /storage/sdcard1/PARTITION2
mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard1/PARTITION2
rsync -HpogEvrl /data/* /storage/sdcard1/PARTITION2
busybox umount -l /storage/sdcard1/PARTITION2
mount -o remount,errors=continue /data
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
chown system:system /data
restorecon /data
brief explaination of the above commands:
su - switch user to root
mke2fs - format the block device as ext4
mkdir - make directory
mount -t ext4 - mount a block device of type ext4 from /dev/block/mmcblk1p2 to /storage/sdcard1/PARTITION2
rsync -HpogEvrl - copy files from /data/* to /storage/sdcard1/PARTITION2 preserving all attributes (including owner and group)
busybox umount -l - use the busybox version of umount to do a lazy unmount of /storage/sdcard1/PARTITION2. this will unmount it even if files are locking it
mount -o remount,errors=continue /data - remounts the data partition telling it to continue instead of kernel panic if there is any errors reading or writing to that mount point
and the next command is actually 2:
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
this does a lazy unmount of /data and then mounts /dev/block/mmcblk1p2 to /data with the appropriate parameters for the /data parameter
chown system:system /data - This gives system ownership of /data instead of root as is originally done
restorecon /data - we do this just in case the userdata partition has been reset.
3) OPTIONAL delete the directory /storage/sdcard1/PARTITION2. This is just cleanup, it is not neccessary to do.
When you reboot your phone, your /data directory will remount to the 2 GB partition as it did originally. To remount it to your newly created /data partition, run the following 2 commands:
su
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
Now, you can make this into a nice and easy startup script by following these simple steps from adb shell or android terminal (NOTE this assumes that your ROM supports userinit.d and init.d):
su
cd /data/local/userinit.d
echo "#!/system/bin/bash" > dataswap
echo "if [ -e \"/dev/block/mmcblk1p2\" ]" >>dataswap
echo "then" >> dataswap
echo "busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data" >> dataswap
echo "chown system:system /data" >> dataswap
echo "restorecon /data" >> dataswap
echo "fi" >>dataswap
chown root:shell dataswap
chmod 777 dataswap
and now when you reboot your phone you will have your external SD cards partition 2 as your /data directory.
If your phone has init.d support, look in your /system/etc/init.d folder for a script named "90userinit". If it is not there, you will need to either make it and have it run userinit.d OR change the line:
cd /data/local/userinit.d
to
cd /system/etc/init.d
mount -o remount,rw /system
now for the warning stuff:
1) I strongly recommend that you do NOT put this into your /data/local/userinit.d folder until you are 110% certain that it worked on your device with your ROM. The reason for this is if it fails and you don't have it in that folder, simply reboot and your phone is back to using /data from partition 25 on your internal memory
2) I strongly recommend you do a nandroid before you begin. That way in the very slim chance that something goes horridly wrong, you can recover
3) I strongly recommend you back up your external SD card before you begin resizing your partitions. Resizing partitions may result in data loss.
4)I take no responsibility for any data loss
5) I have ONLY tested this on a SGH-T989D running HellyBean (Android 4.3). I cannot make any comments on other ROMS, but as long as the ROM has busybox, root, and init.d support, this should work.
6) If you get ANY ERRORS from ANY of the above commands, stop everything and either post in this thread or start over. I have done this twice on my phone to make sure that the steps are as solid as I know how to make them. The only thing I haven't fully tested is putting it into a startup script.
One thing I notice, sometimes when you unmount and remount /data, any data changes in your currently running apps (ie you get a text message while doing this or you start a game up while /data is being sync'ed) may cause odd data issues when the two swap and may cause your phone to jump back to the boot animation. If this occurs, try waiting approximately 1 minute OR until adb shell drops out; whatever comes first. At that point, something has likely gone sour. Reboot your phone and things will be back how they were prior to step 2 (step 1 is permanent until you change that).
Questions, comments, suggestions? Please leave them in the thread, not in PM. If I get any PM's about this thread, I'll do my best to answer, but I may end up posting your PM in this thread to help others.
EDIT: cleaned up the instructions a little and added in some recommended steps (the chown and restorecon) and removed the waiting to mount /data as that just makes things unhappy long term.
EDIT: added error handling in case mmcblk1p2 does not exist to the startup script. If it does not exist, it will now NOT swap the partitions. So as a failsafe, if your phone gets stuck at the boot animation, you can power it down, remove the SD card and power it back up to boot with your default /data partition. This should not need to be done, but there is a chance that your SD card could die or your new /data partition get corrupted, this will allow you to recover safely and will likely only require you to re-create your data partition and NOT have to re-do your whole ROM due to something going bad on the big /data.
Dang...found a bug: it looks like if you leave it for a few days or reboot our something(have not narrowed it down yet) some apps stop working... investigating it and should have a solution sometime tonight... sorry to all those who have tried this... if you have not done much, I'd suggest switching back to normal /data until I get the bug sorted out. My best guess is that reboot doesn't unmount the partition cleanly but I'm not positive...
bmg002 said:
I was having issues with my /data partition getting full on me after getting new ROMs set up. This was irritating me and I came to the conclusion that 2 GB was just not enough space for some of the larger apps out there. So I went ahead and started investigating and testing how to get /data onto the external SD card.
2 complications arise:
1) it needs to be in ext4 format to preserve permissions
2) it needs to be swapped post boot AFTER the sd card is mounted (potentially, I have not fully tested this).
So this becomes a multi step process. What you need:
1) an external SD card that is at least 2 GB in size if not larger (I recommend larger simply because what is the point of having it on external storage if you aren't gaining any extra space)
2) a SGH-T989D (I do not have an SGH-T989 to test it with BUT I am confident it will work with that one too)
3) some partitioning software on your PC (I recommend EaseUS or AOMEI, but use whatever you are comforatble with)
4) latest version of busybox installed on your phone
So, the steps to do this:
1) partition your external SD card into at least 2 partitions, where your second partition will be used for /data. The first partition automatically mounts to /storage/sdcard1, but partition 2 will NOT auto-mount. You do not need to format this if you do not want to. This is up to you how you do it.
2) Run the following commands from either adb shell OR android terminal:
su
mke2fs /dev/block/mmcblk1p2
mkdir /storage/sdcard1/PARTITION2
mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard1/PARTITION2
rsync -HpogEvrl /data/* /storage/sdcard1/PARTITION2
busybox umount -l /storage/sdcard1/PARTITION2
mount -o remount,errors=continue /data
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
brief explaination of the above commands:
su - switch user to root
mke2fs - format the block device as ext4
mkdir - make directory
mount -t ext4 - mount a block device of type ext4 from /dev/block/mmcblk1p2 to /storage/sdcard1/PARTITION2
rsync -HpogEvrl - copy files from /data/* to /storage/sdcard1/PARTITION2 preserving all attributes (including owner and group)
busybox umount -l - use the busybox version of umount to do a lazy unmount of /storage/sdcard1/PARTITION2. this will unmount it even if files are locking it
mount -o remount,errors=continue /data - remounts the data partition telling it to continue instead of kernel panic if there is any errors reading or writing to that mount point
and the last command is actually 2:
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
this does a lazy unmount of /data and then mounts /dev/block/mmcblk1p2 to /data with the appropriate parameters for the /data parameter
3) OPTIONAL delete the directory /storage/sdcard1/PARTITION2. This is just cleanup, it is not neccessary to do.
When you reboot your phone, your /data directory will remount to the 2 GB partition as it did originally. To remount it to your newly created /data partition, run the following 2 commands:
su
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
Now, you can make this into a nice and easy startup script by following these simple steps from adb shell or android terminal (NOTE this assumes that your ROM supports userinit.d and init.d):
su
cd /data/local/userinit.d
echo "#/sys/bin/bash" > dataswap.sh
echo "while [ \`mount | grep -c sdcard\` -lt 3 ]" >> dataswap.sh
echo "do" >> dataswap.sh
echo "sleep 10" >> dataswap.sh
echo "done" >> dataswap.sh
echo "busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data" >> dataswap.sh
chown root:shell dataswap.sh
chmod 777 dataswap.sh
and now when you reboot your phone you will have your external SD cards partition 2 as your /data directory.
If your phone has init.d support, look in your /system/etc/init.d folder for a script named "90userinit". If it is not there, you will need to either make it and have it run userinit.d OR change the line:
cd /data/local/userinit.d
to
cd /system/etc/init.d
mount -o remount,rw /system
now for the warning stuff:
1) I strongly recommend that you do NOT put this into your /data/local/userinit.d folder until you are 110% certain that it worked on your device with your ROM. The reason for this is if it fails and you don't have it in that folder, simply reboot and your phone is back to using /data from partition 25 on your internal memory
2) I strongly recommend you do a nandroid before you begin. That way in the very slim chance that something goes horridly wrong, you can recover
3) I strongly recommend you back up your external SD card before you begin resizing your partitions. Resizing partitions may result in data loss.
4)I take no responsibility for any data loss
5) I have ONLY tested this on a SGH-T989D running HellyBean (Android 4.3). I cannot make any comments on other ROMS, but as long as the ROM has busybox, root, and init.d support, this should work.
6) If you get ANY ERRORS from ANY of the above commands, stop everything and either post in this thread or start over. I have done this twice on my phone to make sure that the steps are as solid as I know how to make them. The only thing I haven't fully tested is putting it into a startup script.
One thing I notice, sometimes when you unmount and remount /data, any data changes in your currently running apps (ie you get a text message while doing this or you start a game up while /data is being sync'ed) may cause odd data issues when the two swap and may cause your phone to jump back to the boot animation. If this occurs, try waiting approximately 1 minute OR until adb shell drops out; whatever comes first. At that point, something has likely gone sour. Reboot your phone and things will be back how they were prior to step 2 (step 1 is permanent until you change that).
Questions, comments, suggestions? Please leave them in the thread, not in PM. If I get any PM's about this thread, I'll do my best to answer, but I may end up posting your PM in this thread to help others.
Click to expand...
Click to collapse
So found a solution to crashing apps . Load up the play store and update your apps. Worked for me anyways.
Now to fix a potential mounting bug in the op, put any scripts on a different ext4 position such as/system/xbin or/system/etc/init.d.
I'll keep you posted if I find other bugs.
Sent from my SAMSUNG-SGH-T989 using xda app-developers app
Bleh new bug:
When you unplug it from a pc, it gets confused and you get io errors which cause it to crash back to the boot animation and get stuck there... too tired to debug out tonight but I'll poke at it tomorrow... thinking I may need to build a kernel module for this... or a custom kernel
Sent from my SAMSUNG-SGH-T989 using xda app-developers app
So the unplugging issue seems quite intermittent and I am unable to get consistent results with it. So I am not sure if it is a bug or not. I updated the OP to have error handling so you can pull your SD card out to mount the 2 GB /data that your phone normally does instead of your big one in the event that something goes wrong.
Hrm... so my testing and further development with this has taken a temporary pause due to my SD card dying on me. Stupid SD card... haven't even had it a year. Hoping I can find the reciept. But once I get it replaced, I'll be jumping in on this some more. I have a few cool ideas that we can do by moving partitions to external storage...
What's the deal with cause this would so help with games but is it possible to maybe if possible extend the internal storage
snt? from? sumthiN 4.4+ ?via a ?T989
hatememarkz said:
What's the deal with cause this would so help with games but is it possible to maybe if possible extend the internal storage
snt? from? sumthiN 4.4+ ?via a ?T989
Click to expand...
Click to collapse
From my testing it seems to work but puts a heavy load the sd card. And if your sd card fails you will lose some data.
I have not tested this on KitKat yet but that is my plan soon.
Sent from my SM-T310 using xda app-developers app