K, time to give this a proper OP, if anyone wants any of the info that was here before you can look here
_________________________________________________________________________________________________
So, the whole idea here started with me reading an article on how part of the whole I/O problem with the transformer is partially caused by the hardware used as internal storage. I wanted to find out if this had any merit and I figured the best way to do it would be to "replace" the internal storage. I did this by mounting the /data partition to the exteral SD (which according to my research, my specific SD Card is better at writing speeds - allegedly the main problem with the transformer's internal storage hardware wise). Then I ran a bunch of benchmarks and have been running it that way for about 24 hours and so far it feels great. Anyone is welcome to give it a try, and hopefully with help, suggestions and feedback from the community, we can all take as much advantage of this idea as possible.
Before I go any further I want to give credit to those who helped me so far, because without them I would still be completely clueless, and not only have they helped be accomplishing what I got so far, but thanks to them I've also learned a bunch of things I didn't know before. So here it goes:
Rayman - For suggesting the method for mounting /data to the external SD.
lilstevie - For helping me get the new kernel flashed right.
Turge - For showing me how to properly repack the kernel.
Parastie - For suggesting doing the same thing to /cache (working on that now).
dagrim1 - For SQL patch and for suggesting a temporary remount (even though it didn't work it was a good thing to try).
_motley - For all his work on his awesome kernel.
_________________________________________________________________________________________________
Updates:
Update 1 (08-01-2012 File boot-data+cache+internal-AOKP6.1base.zip) :
Now both /data and /cache are moved to the external SD card. This means you need a third partition mmcblk1p3 in order to use this modification.
It will also mount the internal storage (previously inaccessible) to /mnt/sdcard_internal
It also attempts to (fail at this point) to mount the internal sd partition (what used to be /sdcard) to /sdcard/Internal_SD (which is why you will always see that folder get created but stay empty). If anybody knows how to make it work please advise.
Modified Lines:
init.cardhu.rc
Code:
# TweakerL MOD > original mount = mmcblk0p8 /data | mmcblk0p3 /cache
mount ext4 /dev/block/mmcblk1p2 /data wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
mount ext4 /dev/block/mmcblk1p3 /cache wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
# TweakerL MOD > added mounts for internal storage
mkdir /mnt/sdcard_internal 0000 system system
mount ext4 /dev/block/mmcblk0p8 /mnt/sdcard_internal wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
# TweakerL MOD > give access to internal SD from /sdcard
mkdir /data/media/Internal_SD 0755 media_rw media_rw
mount /mnt/sdcard_internal/media /data/media/Internal_SD wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
Update 2 (08-01-2012 About backing up/restoring in recovery) : - READ UPDATE 5
One thing that worried me was that by using this mod people wouldn't be able to backup their data partition properly, but now I know that it's possible to do it. It will only work on TWRP though since it has basic terminal access and keyboard. To do it, go into Advanced > Terminal and in there type:
umount /dev/block/mmcblk0p8
mount /dev/block/mmcblk1p2 /data
And until you reboot, any backup/restore should use the external SD data partition instead of the internal. The same should be doable with the cache partition in case you want to backup/restore that.
Update 3 (08-02-2012 File flashme-kernel-motley305-aokp-data+cache2SD.zip) :
Put together a flashable zip that will install motley's 3.0.5 aokp kernel using this mod. Works like a charm so far though I only tried flashing on TWRP. Also, internal storage can be accessed in /data2 and internal sd can be accessed in /sdcardi . Current changes are as follow:
Code:
# TweakerL MOD > move /data and /cache to external SD card || original mount = mmcblk0p8 /data | mmcblk0p3 /cache
mount ext4 /dev/block/mmcblk1p2 /data wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
mount ext4 /dev/block/mmcblk1p3 /cache wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
# TweakerL MOD > create mount for internal storage
mkdir /data2 0000 system system
mount ext4 /dev/block/mmcblk0p8 /data2 wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
# TweakerL MOD > symlink internal sd to a couple of easily accessible locations
symlink /data2/media /mnt/sdcard_internal
symlink /data2/media /sdcardi
Update 4 (08-03-2012 File boot-cm10-unofficial-data+internal.zip) :
Running the unofficial CM10 (no cherrypicks one) using this mod and so far it's pretty amazing. The rom itself is pretty stable and even snappier with /data mounted to external SD. Benchmarks are at the bottom. Current modifications:
fstab.cardhu:
Code:
#TweakerL MOD > Move /data to external SD and internal /data to /data2
/dev/block/mmcblk1p2 /data ext4 rw,nosuid,nodev,noatime,user_xattr,acl,barrier=1,journal_async_commit,nodelalloc,data=writeback wait
/dev/block/mmcblk0p8 /data2 ext4 rw,nosuid,nodev,noatime,user_xattr,acl,barrier=1,journal_async_commit,nodelalloc,data=writeback wait
init.cardhu.rc:
Code:
# TweakerL MOD > create mount for internal storage
mkdir /data2 0000 system system
mount_all /fstab.cardhu
# TweakerL MOD > symlink internal sd to a couple of easily accessible locations
symlink /data2/media /mnt/sdcard_internal
symlink /data2/media /sdcardi
Update 5 (08-03-2012 About backing up/restoring in recovery) :
So after doing some tests, and paying more attention to TWRP, I noticed something rather useful:
When you have this mod enabled, or whenever you have a mmcblk1p2 partiion, TWRP will have the sd-ext menu enabled. This means that to backup your data you can simply backup the sd-ext partition and to restore your data you can simply restore your sd-ext partition. No need to worry about manually switching the mount point for /data in recovery. I guess it was a whole lot easier than I thought.
Also congratulations and thanks to everyone who has contributed with this so far.
WE MADE IT TO FRONT PAGE ON XDA (08-03-2012)
_________________________________________________________________________________________________
Requirements:
There are a few things you will need to do in order for this to work right for you, and a couple of things you'll have to research before you even try it.
#1. Obviously, you have to be rooted/unlocked because you're not gonna be able to change much around otherwise.
#2. You MUST repartition your external SD. The kernel I've put together so far WILL ONLY mount /data to mmcblk1p2, which basically says "mount /data to the second partition in the external SD." also, the ramdisk expects that partition to be ext4, so essentially:
Make sure you have an external SD with at least two partitions and that the second partition is formatted to ext4. I personally use Gparted to repartition my stuff, but feel free to use whatever rocks your boat. Even if you're on windows you can still use gparted by using virtualbox, so I'm not gonna go look for a different windows solution.
#3. This is the research part... This will be beneficial or detrimental to each user depending on the SD card used. If you have a slow SD card this probably will do you no good. However, just because you have a class 10 SD card, that doesn't mean it will benefit you either. On my own research I have found that some class 6-10 SD Cards have extremely slow random write speeds, so if you happen to have one of those, even if it's a class 10, this might not be for you. This means that you're gonna have to do some research to find out if your SD Card will benefit you or not. You can always just give it a try, as far as I know this is entirely reversible, how easy or hard being just a matter of how bad you mess up on meeting the requirements and following the instructions.
#4. At this point (07-30-2012) I'm doing all this stuff using the AOKP milestone 6.1 kernel as base for my modified kernel, so if you're not using AOKP milestone 6.1, flashing my kernel might borke your system. You've been warned, feel free to proceed otherwise at your own peril.
_____________________________________________________________________________________________________________
Installation:
#1. Download attached file (boot-data2SD-AOKP6.1base.zip) and extract it to the root of your internal storage (/sdcard).
#2. Open a terminal.
#3. Type the following:
Code:
su
dd if=/sdcard/boot.blob of=dev/block/mmcblk0p4 bs=1
#4. Wait for it to complete.
#5. Reboot.
Upon rebooting you will know that it worked because it will look just as if you just flashed a new rom, that is, you'll get the device setup screen (assuming that the tablet booted at all lol). If you're planning to use TB to restore your apps, you'll probably want to copy the TB folder to your external SD's first partition so that you can copy it back once you're done with the device setup (at this point you will have no access - unless you manually mount it - to your internal storage).
_______________________________________________________________________________________
Reverting:
Follow the same exact steps for installation but use boot-default-AOKP6.1.zip instead.
_______________________________________________________________________________________
Optional:
#1. If you want to have access to everything you had on your data partition in the new data partition, you'll have to clone everything from one to the other. To do this, make sure that your new data partition (the one in your external SD) has enough storage space to fit everything you currently have in your data partition (the one in your internal storage). Then run the following command in your terminal.
Code:
dd if=dev/block/mmcblk0p8 of=dev/block/mmcblk1p2 bs=4096 conv=notrunc,noerror
BEWARE that if you have a lot of stuff this can take quite a while and even though I've read a way of getting the progress for this in Linux I'm not sure that you can check the progress on Android.
_______________________________________________________________________________________
Next steps in development:
#1. Move /cache as well.
#2. Find out what happens with recovery backups when the partitions are changed.
#3. Attempt to apply mod to motley's kernel.
#4. Create a script that is run on boot to eliminate need for replacing the kernel.
#5. With help from the community, find the best SD Card for this.
#6. Run the modified system for a while to have a good feel for performance benefits
#7. Come up with other interesting uses for this other than getting better I/O (maybe an easy - kinda easy - way to dual boot with ubuntu, maybe other stuff, dunno).
_______________________________________________________________________________________
How can I set my kernel to do this?
I didn't do a whole lot, and it's not like I want it to be a secret, so as I modify things I'll try to keep the steps listed here so that anyone modifying their own kernel who would like to try this modification can go ahead and do it.
You'll need to know how to unpack/repack a kernel. Turge has a SUPER EASY explanation here on how to do it on windows (I'll pack together the necessary binaries for linux later, maybe).
Mount /data to the second partition in your external SD (formatted as ext4 filesystem):
After unpacking the kernel navigate to the folder that has the ramdisk and open it
(DON'T USE ANY ASCII BASED TEXT EDITOR BECAUSE IT WILL PROBABLY MESS THINGS UP I USE NOTEPAD++)
Around line 26 change:
Code:
mount ext4 /dev/block/mmcblk0p8 /data wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
to
Code:
mount ext4 /dev/block/mmcblk1p2 /data wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
_______________________________________________________________________________________________________
SD Cards tested:
Samsung 32GB Class 10 MicroSDHC High Speed Memory Card - Very Good Results
SanDisk® microSDHCTM 8GB Memory Card - Very Good Results
"Either way, with this mod, the tablet feels like it should have right from the start. It's speedy and responsive, and apps being installed don't stall the system." - Turge - Post #59
_______________________________________________________________________________________________________
Benchmarks:
/data mounted to mmcblk0p8 (Internal Storage):
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
/data mounted to mmcblk1p2 (External SD):
RL Benchmark WITHOUT dagrim1's sql patch as per request:
/data mounted to mmcblk0p8 (Internal Storage):
/data mounted to mmcblk1p2 (External SD):
*Important thing to note: When running the benchmark with data in the internal SD it was about 220 seconds in the first run, then about 180, then about 130 and finally 118; whereas running it from the external SD was consistenly between 63 and 65 seconds every time. I think this more than proves that A) Asus used a cheap I/O storage, B) No matter what software changes are made, more than likely running the rw partitions from a better I/O storage, i.e. an external SD is a good idea.
As promised here are benchmarks on a JB rom (Unofficial CM10). Also sorry it took me a while to get these, I was going to use eos3 but I started getting random reboots. Then I decided to try cm10, and I messed up a flash and had to redo a bunch of things. Anyway, the only change here is the mod itself (no custom kernel or anything). Though one thing to note is that I moved /cache back to the internal partition after some thought that this allows /data and /cache to be written at the same time to different locations thus lowering the bottleneck.
/data mounted to mmcblk0p8 (internal storage):
/data mounted to mmcblk1p2 (external storage):
Now, as you can see, JB did bring a major improvement to I/O, bringing the benchmark down from about 115sec to 68 (almost reaching the modded ICS at 60 seconds). But as I expected, better software works better on better hardware and now the modded JB is running at 50 seconds instead of 60. Next I'm going to put dagrim1's sql patch and see how low the benchmark goes. Also will be posting the modded blob in just a little bit for anyone who wants to use it on CM10.
We don't have sd-ext it's an old trick when phones had very little /data partitions, you have the possibility to create a sd-ext partition on an external sdcard and mounting it as a secondary data. (like opt partition on Linux).
To see what block device is data just run 'mount' command in terminal emulator. I don't have my device here.
sdcard cache is already set to 2048 if I'm correct.
Your script would mean creating a sd-ext partition on an external sdcard, modify fstab to have it correctly mounted then applying the script.
Not really easy for common users.
I would rather look at kernel drivers (not I/O schedulers but drivers handling with file system format) but it's quite a hard work.
Hmmm...
Was talking to Rayman and it doesn't actually seem that hard to do... Just gotta change the init.cardhu.rc in the ramdisk to mount /data to /dev/block/mmcblk1p2 instead of /dev/block/mmcblk0p8
The thing is, that while I know every step that I have to take to get it done, I haven't used linux in forever and quite honestly I couldn't even compile blobtools right now if I wanted to to extract the ramdisk from the boot blob to make the necessary change... so yea anyone who knows how to edit a kernel should be able to do it, and then just repack it as a blob... I'll probably look into it later, but if anyone wants to type the terminal commands for to to get/compile blobtools I'll appreciate it...
As in just a mount of data to mmcblk1p2?
Would a temp solution (just to check if it works) be to remount data manually? (Tried it, to mmcblk1p1 btw since 1p2 didn't seem to exist for me, but it still mounts to mmcblk0p8.
Using:
mount -o remount,rw -t ext4 /dev/block/mmcblk1p1 /data
(as su in terminal)
dagrim1 said:
As in just a mount of data to mmcblk1p2?
Would a temp solution (just to check if it works) be to remount data manually? (Tried it, to mmcblk1p1 btw since 1p2 didn't seem to exist for me, but it still mounts to mmcblk0p8.
Using:
mount -o remount,rw -t ext4 /dev/block/mmcblk1p1 /data
(as su in terminal)
Click to expand...
Click to collapse
Reason why mmcblk1p2 didn't work is because you have to repartition the sd card to have an ext4 partition... personally what I did was take my 32gb sd card and have the first partition as a fat32 partition for storage and set the rest to an ext4 partition... also, you have to do that because the /data partition is already expected to be an ext4 partition on most of the current ROMs... Trying to set it without doing that most likely won't work.
Also, another thing that's important is that for this to be beneficial you have to have an SD Card with higher random write speed than your internal storage speed... my internal storage speed is about .25 mb/s and my sdcard is about 1.5mb/s so there should be a big difference... Oh and if you happen to have a class 10 sdcard that doesn't necessary mean that it has high random write speed... you actually have to go look up the specs or run benchmarks on it.
TweakerL said:
Reason why mmcblk1p2 didn't work is because you have to repartition the sd card to have an ext4 partition... personally what I did was take my 32gb sd card and have the first partition as a fat32 partition for storage and set the rest to an ext4 partition... also, you have to do that because the /data partition is already expected to be an ext4 partition on most of the current ROMs... Trying to set it without doing that most likely won't work.
Also, another thing that's important is that for this to be beneficial you have to have an SD Card with higher random write speed than your internal storage speed... my internal storage speed is about .25 mb/s and my sdcard is about 1.5mb/s so there should be a big difference... Oh and if you happen to have a class 10 sdcard that doesn't necessary mean that it has high random write speed... you actually have to go look up the specs or run benchmarks on it.
Click to expand...
Click to collapse
Thanks, makes sense yeah... will have to check if it's worth the hassle for now. Not at this moment anyway, but interesting concept...
Stuck... again...
So I figured how to unpack the boot.blob, then unpack the boot.blob.LNX, then decompress the ramdisk... made the necessary change to init.cardhu.rc... compressed the ramdisk to the same format it was before, repacked the boot.blob.LNX, repacked the boot.blob... dd if=blob of=dev/block/mmcblk0p4 seek=28 bs=1 ... and ... nothing... reboot and where you're supposed to get the quick progress bar nothing seems to happen... I'm assuming I messed up on the recompressing ramdisk/packing the boot.blob... but I'm not sure how...
Anyway... I'll post exactly how I did it tomorrow so maybe someone with more experience can help me figure out where I messed up...
But so far, I wanna say thanks to rayman and lilstevie for all the help they've given me so far with this idea.
TweakerL said:
... compressed the ramdisk to the same format it was before, repacked the boot.blob.LNX, repacked the boot.blob... dd if=blob of=dev/block/mmcblk0p4 seek=28 bs=1 ...
Click to expand...
Click to collapse
Just wondering, why did you choose to use seek=28?
I believe the TFP will need the first 28 header signature to be there in order to flash through the staging paritition (p4).
Your other option would be to flash using fastboot:
1. If you've installed the AndroidRoot.mobi bootloader (if you have nvflash), then you can directly flash the boot.blob.LNX file, as this is a raw image.
fastboot -i 0x0b05 flash boot boot.blob.LNX
2. If you don't have AndroidRoot.mobi bootloader, then I suggest you get NVFlash working first and get a backup... if not, you can use the following to flash the blob:
fastboot -i 0x0b05 flash boot blobfileyou'vecreated
3. Use fastboot to flash to the staging partition:
fastboot -i 0x0b05 flash staging blobfileyou'vecreated
TweakerL said:
So I figured how to unpack the boot.blob, then unpack the boot.blob.LNX, then decompress the ramdisk... made the necessary change to init.cardhu.rc... compressed the ramdisk to the same format it was before, repacked the boot.blob.LNX, repacked the boot.blob... dd if=blob of=dev/block/mmcblk0p4 seek=28 bs=1 ... and ... nothing... reboot and where you're supposed to get the quick progress bar nothing seems to happen... I'm assuming I messed up on the recompressing ramdisk/packing the boot.blob... but I'm not sure how...
Anyway... I'll post exactly how I did it tomorrow so maybe someone with more experience can help me figure out where I messed up...
But so far, I wanna say thanks to rayman and lilstevie for all the help they've given me so far with this idea.
Click to expand...
Click to collapse
I've repacked the boot.img for the Prime before to add init.d support so I'll post my method and the files needed in a few minutes once I get to work. It'll involve getting cygwin installed (with Perl support I believe) if you're on Windows.
Would it be better to move cache and maybe dalvik cache (assuming the SD random read/write is faster then internal memory) ? Since you're only moving data and leaving cache on internal, that'll still hit the issues of having bad IO. Moving cache (which I believe would have more random access) I think would be better.
Thoughts?
dagrim1 said:
As in just a mount of data to mmcblk1p2?
Would a temp solution (just to check if it works) be to remount data manually? (Tried it, to mmcblk1p1 btw since 1p2 didn't seem to exist for me, but it still mounts to mmcblk0p8.
Using:
mount -o remount,rw -t ext4 /dev/block/mmcblk1p1 /data
(as su in terminal)
Click to expand...
Click to collapse
Thanks for the idea, I tried to do that but nothing seemed to happen (checking on file manager /data partition is still taking the same amount of space as it did before). It would've been a really good way of testing this whole thing though
kokopuphz said:
Just wondering, why did you choose to use seek=28?
I believe the TFP will need the first 28 header signature to be there in order to flash through the staging paritition (p4).
Your other option would be to flash using fastboot:
1. If you've installed the AndroidRoot.mobi bootloader (if you have nvflash), then you can directly flash the boot.blob.LNX file, as this is a raw image.
fastboot -i 0x0b05 flash boot boot.blob.LNX
2. If you don't have AndroidRoot.mobi bootloader, then I suggest you get NVFlash working first and get a backup... if not, you can use the following to flash the blob:
fastboot -i 0x0b05 flash boot blobfileyou'vecreated
3. Use fastboot to flash to the staging partition:
fastboot -i 0x0b05 flash staging blobfileyou'vecreated
Click to expand...
Click to collapse
I used seek=28 out of despair and by lilstevie's suggestions... dd with or without seek had the same exact result, the staging just ignoring the whole thing lol...
Sounds like a plan (flashing with fastboot)... I've got one dumb question though before I do that (and yea i've got nvflash setup and all the backups and stuff). How do I actually go about restoring the system with NVFLASH if I go and borke the system ? XD
Turge said:
I've repacked the boot.img for the Prime before to add init.d support so I'll post my method and the files needed in a few minutes once I get to work. It'll involve getting cygwin installed (with Perl support I believe) if you're on Windows.
Click to expand...
Click to collapse
That would be much appreciated, I don't mind steps for windows or linux, I'll go either way
Parastie said:
Would it be better to move cache and maybe dalvik cache (assuming the SD random read/write is faster then internal memory) ? Since you're only moving data and leaving cache on internal, that'll still hit the issues of having bad IO. Moving cache (which I believe would have more random access) I think would be better.
Thoughts?
Click to expand...
Click to collapse
I agree that moving the cache is a good idea, one of the main reasons why I'm testing with /data though is that it will be much easier to have solid evidence of whether this works or not that way since all the benchmark apps seem to benchmark on the /data partition. I know benchmarks aren't real world results, but if I can run benchmarks on the same partition and it's 5 times faster on the SD card than on the internal memory, I think it should mean something. After that, if there are positive results, I'm thinking of moving both /data and /cache partitions and run that way for a while to see how well it performs, and then to run with just the /cache moved and see how that performs.
Turge said:
I've repacked the boot.img for the Prime before to add init.d support so I'll post my method and the files needed in a few minutes once I get to work. It'll involve getting cygwin installed (with Perl support I believe) if you're on Windows.
Click to expand...
Click to collapse
Here are the steps for repacking the boot.img. Some involve running the commands via cygwin, others involve running them via the Windows Command Prompt.
The instructions for installing cygwin, extracting and repacking the boot.img were found here: http://www.freeyourandroid.com/guide/extract-edit-repack-boot-img-windows
Once you have setup cygwin, extract the attached files in a folder under your "home" folder in cygwin.
copy boot.blob to the same folder and run the following via the Windows Command Prompt to extract the boot.img from the boot.blob:
Code:
BlobUnpack.exe boot.blob
ren boot.blob.LNX boot.img
From the cygwin bash terminal window, switch to the same folder and run the following to extract the ramdisk from the boot.img:
Code:
./extractboot boot.img
You now have an out/ramdisk folder that contains the files you want to edit.
Once done, repack the ramdisk and kernel into boot_new.img with the following command (via cygwin once again):
Code:
./packboot
then from the Command Prompt repack boot_new.img into boot2.blob using the following:
Code:
blobpack -s boot2.blob LNX boot_new.img
You can now flash the boot.blob to the staging partition via a command in updater-script:
Code:
package_extract_file("/boot.blob", "/dev/block/mmcblk0p4");
or by using adb while in recovery/android:
Code:
dd if=/sdcard/boot2.blob of=/dev/block/mmcblk0p4
Did anyone think of running iotop? If we know what part of /data is contributing to the stalls, maybe an interesting idea would be to just mount that part of the tree on SD?
tyvm will get on it now, will report back any results
Sent from my Transformer Prime TF201 using Xparent SkyBlue Tapatalk 2
what's iotop?
Though regardless, the problem I'm trying to deal with is the fact that apparently, the storage hardware in the Prime has limited I/O capabilities, namely random write speeds, regardless of software. Because of this the stalls are at least partially caused by the "where" the /data is rather than the "content" in the /data.
Sent from my Transformer Prime TF201 using Xparent SkyBlue Tapatalk 2
TweakerL said:
what's iotop?
Click to expand...
Click to collapse
ffs. Why do I bother?
tshoulihane said:
ffs. Why do I bother?
Click to expand...
Click to collapse
You know, I can just google it, but the fact that you care enough to post your opinion but not enough to explain it is the kind of mentality that keeps people who could potentially contribute to the community from doing so because they have to go research all over the internet, possibly going through bad information, for something that might be very simple. Read a few posts up and you'll see the right kind of mindset. Turge could've just*given some halfassed response and sent me on a wild goose chase but instead he took the time to explain in a way that anyone with any amount of knowledge could understand...
And I hope that since you can't bother to give an useful response, that you can't bother wasting you "precious time" justifying and complaining about how people ask questions that they could just look for elsewhere...
Alright so I have achieved Dual Boot :victory:
THIS IS NOT KEXEC .
It's a simple hack or probably an elegant one.
We can probably achieve multiboot but that is not important.
There are some other things which will be ironed out but thats for later.
Thread Rules :
No Thank you or How Do I do it or nooby questions.
This thread is exclusively for Developers, Enthusiasts and/or Professionals.
Knowledge of Linux and Terminal is MANDATORY.
Dual Partitioned SD card. Second partition preferably
Linux Installed on your computer.
Rubbish posts will be removed .
Save some pride by not being a n00b.
Currently I have planned two types in my mind.
Type 1: Dual Booting ROMs with Same Boot Images - Completed
This hack works across ROMs which use same kernel with same ramdisk... ICS ROMs series , LXP ROMs who use the LXP kernels.. If there is even slight difference in the ramdisk (esp. the init.rc) ,you wont be able to boot ROMs.
Type 2: Dual Booting ROMs with Same kernels but different Ramdisks- Therotically completed.
Post 1: Intro
Post 2: Prepare SD Card and Images
Post 3: Prepare Ramdisk and ROM Installations
Post 4: Installation and switching ROMs
Post 5:Ramdisk Mod
Post 6 : Multiple Mounts/ MultiBoot
Post 7: FAQ
Problems :
Partitioning SD card is annoying and not fruitful
Second SD card partition might be used as second SD card on First ROM.
Solution"
Use loop Images.
I WOULD RECOMMEND USING ANY LINUX DISTRO FOR MAKING A LOOP IMAGE. Because LINUX !!!
Preparation:
Dump Images and formatting.
Make dump images
Code:
dd if=/dev/zero of=system.kdpr bs=4096 count=100000
Will you give you 400 MB image
Code:
dd if=/dev/zero of=data.kdpr bs=4096 count=200000
Will you give you 800 MB image.
Mount Images (as root)
Code:
losetup /dev/loop0 system.kdpr
Code:
losetup /dev/loop1 data.kdpr
Format images(as root)
Code:
sudo mkfs.ext4 -T ext4 -b 4096 -m 0 -J size=4 -O ^huge_file,^has_journal,^resize_inode,^ext_attr /dev/loop0
sudo mkfs.ext4 -T ext4 -b 4096 -m 0 -J size=4 -O ^huge_file,^has_journal,^resize_inode,^ext_attr /dev/loop1
tune2fs -c 100 -i 100d -m 0 /dev/loop0
tune2fs -c 100 -i 100d -m 0 /dev/loop1
You have two ext4 formatted images system.kdpr and data.kdpr ready.
Copy those images to sd-ext folder.You can mount /dev/mmcblk0p2 on a folder and directly push these images via adb push
OR copy images to SD card and copy to second partition.
Either way the system.kdpr and data.kdpr should be in root of the second SD card partition.
Assuming you have mounted second sd card partition on /data/sd-ext.
Run this command
Code:
touch flag_kdpr
The Images are now ready and loaded :victory:
Now is the time to hack the boot image.
Unpack Boot image and navigate to ramdisk folder
Navigate to the lines in init.rc where partitions are mounted .
Comment off or remove the lines mounting system and data
For stock ICS it is in init.semc.rc
Code:
#mount yaffs2 [email protected] /system
#mount yaffs2 [email protected] /system rw remount
#mount yaffs2 [email protected] /data nosuid node
v
add a line
Code:
exec /sbin/mount_fs.sh
now create a bash script named mount_fs.sh as follows
Bash:
#!/sbin/sh
mount /dev/block/mmcblk0p2 /res/sdext
flag_boot=`cat /res/sdext/flag_kdpr`
if [ ${flag_boot} -eq 1 ]
then
mount /res/sdext/system.kdpr /system
mount -o remount,rw /res/sdext/system.kdpr /system
mount /res/sdext/data.kdpr /data
else
mount /dev/block/mtdblock0 /system
mount -o rw,remount /system
mount /dev/block/mtdblock1 /data
fi
make a folder named /res/sdext or choose mount point of your choice
We will be controlling the mount point and boot via the file flag_kdpr.
Using this flag we can also achieve MultiBoot
Repack the boot image.
Installing Secondary ROM
Open the zip and extract the updater script .
Remove the lines for mounting/formatting system and data.
Repack the zip
Mount sd-ext
Run these commands in terminal
Code:
mount /sd-ext/system.kdpr /system
mount /sd-ext/data.kdpr /data
Install the zip ROM.
ROM will be installed in the dump images.
Booting to secondary ROM:
In the recovery or first ROM run this command
Code:
echo 1 > /sd-ext/flag_kdpr
OR
Code:
echo 1 > /res/sdext/flag_kdpr
and reboot
Booting to primary ROM:
In the recovery or first ROM run this command
Code:
echo 0 > /sd-ext/flag_kdpr
OR
Code:
echo 0 > /res/sdext/flag_kdpr
and reboot
Stage 2 : Ramdisk Mod .
This is actually theoretical, but it should work anyway. @nobodyAtall 's recovery for locked bootloader works in a similar fashion.
This is for LXP+ kernels or kernels who use init.sh to load the ramdisk archives.
Steps .
Preparation :
SD Card
Add a folder named ramdisk in root of second SD card
Code:
mkdir ramdisk
Add ramdisks in this folder
Add a flag for ramdisk
Code:
touch flag_ramdisk
Make a script mount ramdisk.sh
Bash:
#!/sbin/busybox sh
flag_ramdisk=`cat /sdext/flag_ramdisk`
if [ ${flag_ramdisk} -eq 1 ]
then
busybox cpio -i < /sdext/ramdisk/abc_ramdisk.cpio
elif [ ${flag_ramdisk} -eq 2 ]
then
busybox cpio -i < /sdext/ramdisk/pqr_ramdisk.cpio
else
busybox cpio -i < /sbin/ramdisky.cpio
fi
Ramdisk of Primary kernel
Edit init.sh
create directory
Code:
mkdir -m 755 -p /sdext
Mount second SD card partition before loading the ramdisk
Code:
mount /dev/block/mmcblk0p2 /sdext
Comment or delete the line loading kernel.
Replace/add with
Code:
busybox sh /sdext/ramdisk.sh
Unmount Second sd card
Ramdisk will "theoretically" load.
Handling Multiple Ramdisks and Multiple Mounts.
Multiple Ramdisk mod is useful when.
You have to test a new ramdisk
You have to run alternative ROM on a same kernel(e.g MIUI)
Load custom recovery for alternative mount points (CM12 ,Secondary ROM)
Dual/Multi ROM is useful for
Alpha/Beta testing
For the lulz
Both of these mods are independent of each other.
You can use Primary Ramdisk with Ramdisk mod and Secondary Ramdisks with mount mods
Multi Boot is similarly implemented. Except you need lot of space in second partition ,each around 1-1.5 GB per system-data combo.
Some "friendlier" ways to dual Boot.
Method 1
Noob Friendly Instructions for Dual Boot.
I have done most of the heavy lifting
You need to flash the kernels above first.
Currently only Radium is supported for primary ROM.
But you can install ANY ICS ROM as secondary.
Requirements :
Basic Notepad Skills.
Dual Partition SD card Exceeding 1.2GB atleast.
Battery % atleast above 70%
Patience
Download
https://www.mediafire.com/folder/aiv828ivuumrk/Dual_Boot_Zips
Download all zips in this folder.
Definition
Dual_Boot_Install_400.zip : 400MB system + 400 MB data
Dual_Boot_Install_600.zip : 400 MB system + 600 MB data
Dual_Boot_Install_800.zip : 400 MB system +800 MB data
Mount.zip : To Mount The secondary system/data before installing ROMs
prim.zip : Boot to Primary ROM
sec.zip :Boot to Secondary ROM
Setup Dual Boot:
Go to recovery
Go to mounts & storage
Format sd-ext
Flash any ONE of the Dual_Boot_Install_Zips
Patience part comes here. Depending on how your SD card is ,it takes 5-10 minutes to copy.
ROM Preparation
Extract the updater script of your ROM zip in your desktop.
Open it in notepad++
Delete the lines mounting and formatting system and userdata like these
unmount("/system");
format("MTD", "system");
mount("MTD", "system", "/system");
Click to expand...
Click to collapse
Copy back the updater script in the ROM folder
Copy ROM to SD card
ROM installation:
Run Mount.zip
Run The ROM installer
Finished
Before Installing Zips below ,Make sure sd-ext is NOT mounted in mounts and storage.
Booting to primary ROM
Run the primary.zip in recovery OR
OR
mount sd-ext and run
Code:
echo 0 > /sd-ext/flag_kdpr
in adb shell
Booting to secondary ROM
Run the secondary.zip in recovery.
OR
mount sd-ext and run
Code:
echo 1 > /sd-ext/flag_kdpr
in adb shell
Those huge blank images can be fit in such a small zip file. There is no data so it can be compressed to the Max.
Method 2
Even more easier Dual ROM installation. This type of stuff can only be achieved on the Zero Layout
Noob Friendly Instructions for Dual Boot.
Requirements :
Dual Partition SD card Exceeding 1.2GB atleast.
Battery % atleast above 70%
Patience
Download
https://www.mediafire.com/folder/aiv828ivuumrk/Dual_Boot_Zips
Download all zips in this folder.
Definition
Dual_Boot_Install_400.zip : 400MB system + 400 MB data
Dual_Boot_Install_600.zip : 400 MB system + 600 MB data
Dual_Boot_Install_800.zip : 400 MB system +800 MB data
Mount.zip : To Mount The secondary system/data before installing ROMs
prim.zip : Boot to Primary ROM
sec.zip :Boot to Secondary ROM
clone2.zip :cloning Primary ROM to Secondary ROM
Setup Dual Boot:
Go to recovery
Go to mounts & storage
Format sd-ext
Flash any ONE of the Dual_Boot_Install_Zips
Patience part comes here. Depending on how your SD card is ,it takes 5-10 minutes to copy.
ROM INSTALLATION :
Install Secondary ROM as you install any ROM
Finish installation
Don't reboot.
Mount sd-ext in mounts and storage
Flash clone2.zip
[optional]Watch Anime
After installation finished
Install Primary ROM.
Finish Installation
Clone Zip basically clones your running ROM as secondary ROM. This stuff beats nandroid backup !!
Booting to primary ROM
Run the primary.zip in recovery OR
OR
mount sd-ext and run
Code:
echo 0 > /sd-ext/flag_kdpr
in adb shell
Booting to secondary ROM
Run the secondary.zip in recovery.
OR
mount sd-ext and run
Code:
echo 1 > /sd-ext/flag_kdpr
in adb shell
Those huge blank images can be fit in such a small zip file. There is no data so it can be compressed to the Max.
Lagfix after a while.
After 5-7 boots , Secondary ROM starts lagging.
fsck is needed to be performed from the reccovery to fix lag.
Commands :
Code:
e2fsck /res/sdext/data.kdpr
e2fsck /res/sdext/system.kdpr
Or just add it to mount scripts before mounting.
@karandpr,is there any possibility to dualboot some roms with different kernel layout or version (like multiboot on newer phone)?
ryanrinaldhi said:
@karandpr,is there any possibility to dualboot some roms with different kernel layout or version (like multiboot on newer phone)?
Click to expand...
Click to collapse
Nope. On fly layout change is impossible.
Even when you change layout ,you need a fastboot erase ,or the consequences can be weird.
Version change is possible.
anonymous had a kernel which can boot ICS , CM9 ,CM 10 & MIUI JB.
Multiboot off his hybrid kernel is very possible.
I am exploring the possibility of Kitkat and lollipop since both are versions 3.4 . Not sure if it can happen but worth a risk.
Hy!
I have a mi2s and this phone is come to separated partitions in its internal drive. It has separated data and sdcard partition. My sdcard partition not mounted for some reason.
I want to keep this partition system, I just want to either mount the sdcard partition, or resize them without loseing data. (I can delete the sdcard partition but I want the data partition untouched, I had a long fight till this rom started to work with google play store, and I dont really want to remach it after all my apps are installed... Fun thing that after the first boot both partitions were mounted, after my first reboot only the data.)
I tried:
adb mount - adb sees it Android not sees it
write it to the fstab.qalcom - its on the / if I reboot the phone its loaded from somewhere again (I know its a ramdisk), my modifications are not permanent on there
I have basic linux knowlage and I started to dig into it, but I cant google out a general solution.
My questions:
How can I mount a fs like the usb otg from adb/android shell?
Can I edit the fstab file in its permanent store on an installed rooted device? And if I can where?
If I place new lines to the fstab on rootfs how can I tell the system to "reload" it?
Can I extend an ext4 partition from adb without loseing its data? *
* I have the required tools like parted from xiaomi forum, I cant post the link but you can google it with "Mi2S extending size of storage partition stillka".
Any help appreciated, and sorry for my english I'm not native.
So the basics:
If you can mount it from adb its a half win!
Try search the correct block partition and mount it with -t, add the correct file system and don't try auto it.
After you can mount it, you need to start an sdcard process its in /system/bin/sdcard. I had to see the custom rom implementation for that, in cm u need to param it "sdcard from to 1023 1023", but in samsung devices the to is hardcoded, and you nedd to do some sed magic.
After that your android programs will see it as a valid sdcard partition.
The harder way:
Wrap it to a startup script.
Add this script somewhere to run at bootup.
I'm still working on it, but I'm closer and closer. After I have the final solution I will write here once more.
I get so much help from there:
http://forum.xda-developers.com/showthread.php?t=2467048
If somebody want to do this:
After few hours of trying to mount the filessystem in boottime (in CM 12.1 its a hard work), i gave up, and went to a repartitioning way.
BE CAREFUL YOU CAN BRICK YOUR DEVICE IF YOU HAVE NO IDEA WHAT IM TALKING ABOUT!
I merged 2 tutorials:
reboot phone into CWM, connect phone to PC
connect to phone over adb and check if you are root
mount system
umount cache
umount data
copy content of partition_tools.zip into /system/bin and add executable attributes if necessary
Run parted on your device: parted /dev/sdX
Change display unit to sectors: unit s
Print current partition table and note the start sector for your partition: p
Delete your partition (won't delete the data or filesystem): rm <number>
Delete your partition (the second one we will delete data from there): rm <number>
Recreate the partition with the starting sector from above: mkpart primary <start> <end>
Recreate partition 27 (the last) mkpartfs primary ext2 3070 15758
name 26 userdata #we have to set back partition labels
name 27 storage
Exit parted: quit
Check the filesystem of 26: sudo e2fsck -f /dev/sdXX
Resize filesystem 26: sudo resize2fs /dev/sdXX
restore partition 27 with:
tune2fs -j /dev/block/mmcblk0p27
e2fsck -fDp /dev/block/mmcblk0p27
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p27
e2fsck -fDp /dev/block/mmcblk0p27
Of course in parted print you can see your original partition layout and this case it is possible that you have other partition numbers (my 26 partition is labeld by userdata and 27 with storage, and I gave more space to userdata from storage without loseing any data from userdata).
You can download the partition_tools.zip from the original miui forum, try to search to mi2s extending size of storage partition. (yes it will work with other devices too)
Hi
my phone is lg k10 android 6.0 and rooted
for me only mounted fat32
when I formatted ext4 microsdcard and insert on phone show message "can't use sd card. tap to set up for use"
when click this message my microsdcard formatted fat32.
How to mount ext4 formatted MicroSD card on Android 6.0?
Thanks
So you need ext4 for symlinking purposes eh?
Anyway , if your device supports ext4 , depends on vendor , you can try to mount it manually
Root is required.
In adb ,
Code:
-adb shell
-su
-df
- cat /proc/partitions
when you know the partition for your external sd ,
Code:
mount -o bind "path to partition" /storage/sdcard1
If this works , you want to add this as a script to run at boot or create a init.d script by your own and give it 0755 permission.
Cheers
-Edit
If it didnt work , try this , it may be a little complicated
https://forum.xda-developers.com/showthread.php?t=2424900
akash14darshan said:
So you need ext4 for symlinking purposes eh?
Anyway , if your device supports ext4 , depends on vendor , you can try to mount it manually
Root is required.
In adb ,
Code:
-adb shell
-su
-df
- cat /proc/partitions
when you know the partition for your external sd ,
Code:
mount -o bind "path to partition" /storage/sdcard1
If this works , you want to add this as a script to run at boot or create a init.d script by your own and give it 0755 permission.
Cheers
-Edit
If it didnt work , try this , it may be a little complicated
https://forum.xda-developers.com/showthread.php?t=2424900
Click to expand...
Click to collapse
I want use exfat because for big files size 4g
but not mount exfat
I want use format exfat Instead fat32
can I or must use custom rom?
123xdagsm said:
I want use exfat because for big files size 4g
but not mount exfat
I want use format exfat Instead fat32
can I or must use custom rom?
Click to expand...
Click to collapse
I need you to be particular with your wordings ..
Do you need ext4 sdcard to be mounted or exfat?
PS:
For File Size larger than 4gb , you can try NTFS , It is supported natively by my device.
Try formatting sdcard as NTFS and then insert into device.
If it shows any problem or doesnt mount , try this
Code:
-su
-ntfs-3g /dev/block/mmcblk1p1 /mnt/sdcard/external_sd
-vold
If this works , try making an init.d script with the above code , to mount sdcard everytime at boot
Cheers
akash14darshan said:
I need you to be particular with your wordings ..
Do you need ext4 sdcard to be mounted or exfat?
PS:
For File Size larger than 4gb , you can try NTFS , It is supported natively by my device.
Try formatting sdcard as NTFS and then insert into device.
If it shows any problem or doesnt mount , try this
Code:
-su
-ntfs-3g /dev/block/mmcblk1p1 /mnt/sdcard/external_sd
-vold
If this works , try making an init.d script with the above code , to mount sdcard everytime at boot
Cheers
Click to expand...
Click to collapse
It does not matter, I just want to support big size file 4g
I format ntfs but not work and type commands show error "
sush: ntfs-3g: not found"
I format ext4 too and test. command
# mount -o bind /dev/block/mmcblk1p1 /storage/sdcard1
and make director /storage/sdcard1 but show error"
mount: Not a directory"
123xdagsm said:
It does not matter, I just want to support big size file 4g
I format ntfs but not work and type commands show error "
sush: ntfs-3g: not found"
I format ext4 too and test. command
# mount -o bind /dev/block/mmcblk1p1 /storage/sdcard1
and make director /storage/sdcard1 but show error"
mount: Not a directory"
Click to expand...
Click to collapse
try this
Code:
-su
-cd /storage/
-mkdir sdcard1
-cd /
-mount -o bind /dev/block/mmcblk1p1 /storage/sdcard1
akash14darshan said:
try this
Code:
-su
-cd /storage/
-mkdir sdcard1
-cd /
-mount -o bind /dev/block/mmcblk1p1 /storage/sdcard1
Click to expand...
Click to collapse
not work show message again
"mount: Not a directory"
I use terminal for commands
I guess due to marshmallow's strict policies , you are not being able to mount NTFS,
I will suggest you to format card as ext4 using EaseUS Partition Manager and then insert sdcard in your device.
Ext4 is natively supported by linux and I dont think it should cause you problems.
Cheers , Pressing that Thanks button wont harm you
I don't know lg k10 android 6.0 not support formats exfat,ntfs,ext4 for micro sdcard.
Does anyone else have a comment to fix the problem?
akash14darshan said:
I guess due to marshmallow's strict policies , you are not being able to mount NTFS,
I will suggest you to format card as ext4 using EaseUS Partition Manager and then insert sdcard in your device.
Ext4 is natively supported by linux and I dont think it should cause you problems.
Cheers , Pressing that Thanks button wont harm you
Click to expand...
Click to collapse
Gonna try this.
akash14darshan said:
So you need ext4 for symlinking purposes eh?
Anyway , if your device supports ext4 , depends on vendor , you can try to mount it manually
Root is required.
In adb ,
Code:
-adb shell
-su
-df
- cat /proc/partitions
when you know the partition for your external sd ,
Code:
mount -o bind "path to partition" /storage/sdcard1
If this works , you want to add this as a script to run at boot or create a init.d script by your own and give it 0755 permission.
Cheers
-Edit
If it didnt work , try this , it may be a little complicated
https://forum.xda-developers.com/showthread.php?t=2424900
Click to expand...
Click to collapse
Would you tell me how to access the adb?
Cheers