Link2SD with S-ON? Yes, I did. - Android Apps and Games

This was driving me up a tree the last few days. I've dealt with Link2SD on quirky devices before, but this one forced me to understand just how Link2SD implemented the mount script, and hooray, I got it.
Now basically, I'm assuming you already know what Link2SD is for, and I'm also assuming that your S-ON device is already rooted and you have a custom recovery partition to the likes of TeamWin or CWM installed and functioning. For my device, I have a recently rooted HTC Desire 510 acquired from FreedomPop.
With the help of DiskInfo, I determined that this device supports ext4, so that's the filesystem I'm using.
____________________
So, What's the magic file anyway? (or, How does Link2SD Work?)
Link2SD has to mount the second SD partition rather early to make sure the files on it are accessible before Android starts looking for the apps. It does this by replacing an existing binary file with its mount script. Don't worry though, before replacing it, it renames the binary file and calls it at the end of the script. The file is:
/system/bin/debuggerd
That's it, and if you want to use Link2SD on your S-ON device (without resorting to quick-reboot every other boot, which on my device at least was spitting an error for every moved app or directory), you'll need to manually do the steps Link2SD would normally do automatically. You'll need to gather some info and other preparation. I'll provide a sample script (which came from my Proscan tablet), which you must edit to match your device information before flashing.
Here's the sample script. Save as "debuggerd" :
Code:
#!/system/bin/sh
#added by link2sd
LOG=/data/link2sd-debuggerd.log
echo "$(date) mounting..." > $LOG
sleep 2
mount -t ext4 -o rw /dev/block/vold/179:2 /data/sdext2 1>>$LOG 2>>$LOG
mount -t ext4 -o rw /dev/block/mmcblk0p2 /data/sdext2 1>>$LOG 2>>$LOG
mount >> $LOG
echo "$(date) mount finished" >> $LOG
echo debuggerd.bin launched >> $LOG
exec /system/bin/debuggerd.bin
You'll notice two mount lines, these are the ones in need of edit. What you'll need to find out:
* The 2nd SD partition type. If you did the partitioning, you should already know this one. As I already mentioned, I used ext4.
* The block number of the second SD partition. I like DiskInfo for that one. The script might be okay for your device, or it might not depending on how storage is set up. The desire was mmcblk1p2.
* The vold id of the second SD partition. Vold is the standard method of managing partition mounts in Android, so is Link2SD's preferred mount method. The block number line is only included as a backup in case the mount by vold id fails. If Link2SD is already installed (and it should be) and the mount script (supposedly) created, it will have already mounted the second partition, so you should be able to go into terminal and type
mount | grep sdext2
to retrieve this number. 179:2 is typical, but my desire was something like 179:58. Best to look it up.
Make the necessary edits, then save the file somewhere accessible to your recovery, such as the root of the sd card (first partition).
Double check the mount info in the script.
____________________
The manual install.
Now for the fun part. Reboot into your custom recovery.
Make sure /system and the sd card are mounted.
Enter the file manager.
Navigate to /system/bin.
Rename debuggerd to debuggerd.bin .
..This is to match the last (exec) line in the script, and what makes the mount stage a seamless insertion into the boot process.
Navigate to where you saved the replacement debuggerd script. Select Copy.
Navigate back to /system/bin and Paste. Confirm if necessary.
Once the custom debuggerd script is copied, you'll need to make sure it's executable. Run chmod on it, something like 755 will be fine. Confirm if necessary.
You also need to make sure the mount directory exists. Navigate to /data , if it doesn't already exist, make a directory called sdext2 .
That should be it. Reboot into the system. If everything is correct, you should boot normally with the second SD partition already mounted before the apps are loaded. I have so far been running Link2SD on the Desire for about a week, and have not run into any *unusual* problems.
____________________
Disclaimer.
This method was successful for me. Your mileage may vary. Editing the system partition always has some inherent risk. What you do to your device is on you; I will not be held responsible for a boot-loop, bricking the device, random interplanetary calls, or any other damages incurred, physical, monetary, or otherwise following your reading of this post. Proceed at your own risk.
---
Sent from my HTCONE using XDA Free mobile app

Having revisited this thread, I noticed I forgot a step, now fixed.
I still use this phone. A couple small glitches have developed over time which may be related to using a cheap sd card, but, basically I have an app with a bad id, it's disabled anyway so I just ignore it on boot (the I'm feeling lucky button). Also, if there is a glitch that prevents a proper shutdown, the second partition may get corrupted. It is impossible to boot with the card unmounted without causing a bunch of other app related issues, so the only way to deal with it cleanly is shut down, remove the card, and fix it on another computer (preferably linux), then reinsert the card before booting the device back up.
Also, after another week, "app data" on the card stopped working right: existing moves caused errors and new moves failed, so I just moved all app data back to internal. Again, this may be just related to using a cheap card, and it was around the same time the bad id occurred, so I'm sure there's some unresolved corruption that just plain isn't getting fixed without a factory reset. It's getting about time to do that, so if I can score a new card and some time to set it up, I'll post how it goes. Apps themselves, dolvik, and libraries continue to work on the sd card without issue on most apps.

Related

modified: Installing & Run application on sdcard

WARNING: Proceed at your own risk, this may damage your phone and/or make it unstable. This is for advanced users only and should only be attempted by those who understand the risks of the following changes
Original post: http://www.androidin.net/thread-1099-1-1.html
AS usual, this is for those WITH ROOT ONLY
Preparation:
1. Installed JF RC30 V1.2 (only if you are using JF RC30 1.2 , this is not compatible with RC8)
2. Make a NANDROID backup (you may get everything back to normal if the phone screw up)
3. A MICRO-SD card with 2 partitions divided : (1) a fat-32 partition, (2) a ext2, you need a linux/mac to format the sdcard with ext2 partition
* the fat 32 will be mounted as sdcard and the ext2 will be mounted as /sd for application data, make your own decision for the size*
4. insert the sdcard with 2 partition on the phone
5. set the phone to aeroplane mode for safe
Procedure:
1. adb pull /system/etc/mountd.conf /*somewhere you may want to back it up*
2. rm -f /system/etc/mountd.conf
3. using the modified mountd.conf, adb push /*the path of modified mount.conf */mount.conf /system/etc/mountd.conf
4. adb pull /system/init.rc /*somewhere you may want to back it up*
5. rm -f /system/init.rc
6. using the modified init.rc, adb push /*the path of modified init.rc*/init.rc /system/init.rc
7. reboot
8. busybox cp -a /data/app /sd/
9. rm -r /data/app
10. ln -s /sd/app /data/app
11. reboot
Now, the phone will install and run everyone on /sd, still mounting /sdcard as usual. It is possible that to mount or unmount /sdcard by usb without everything screwed up. Beware that your sdcard will be used as part of system, removing the sdcard may freeze the phone. If the phone get freeze because of removing the sdcard, plug the sdcard again and soft reset.
It is also possible that copy the application data to another card. If you want to change the sdcard, switch the phone off, mounting the sdcard to computer directory, copy the /sd partition to another sdcard with ext2 partition
Back to normal:
1. rm -f /system/etc/mountd.conf
2. adb push /*the backup of mountd.conf* /system/etc/mountd.conf
3. rm -f /system/init.rc
4. adb push /*the backup of init.rc* /system/init.rc
5. busybox cp -a /sd/ /data/app
6. rm -r /sd/
Change of mountd.conf:
changing /dev/block/mmcblk0 to /dev/block/mmcblk0p1
change of init.rc:
adding
insmod /system/modules/2.6.25-01843-gfea26b0/kernel/fs/ext2/ext2.ko
mknod /dev/mmcblk0p2 b 179 2 1000
mount ext2 /dev/mmcblk0p2 /sd noatime nodiratime
Any chance of this being simplified into the actual commands necessary for this!?
I'm a semi-noob at *nix stuff... I can format my SD card into 2 partitions, but I'm lost at step 4... What do we need to edit??
Changed step 4...just adb pull the mount.conf for editing..open the file in text editor..find "mmcblk0" and change it "mmcblk0p1" ..save the .conf...del the original one..push the new one to the original directory..
Yay. Now hopefully we can get this in an update.zip to flash
Yeah, I'm putting off doing this until someone makes an update.zip which I definitely know how to apply and get rid of if I screw anything up
REPLACES the internal memory...?
So the internal memory isnt used?
kinda the same trick as the browser cache and market cache, just a bit more complex as its an entire filesystem your moving, which wouldnt let the sys see the internal, mem, please correct me if im reading it wrong, Im not a total noob at linux but no guru dev either...
bhang
The internal memory is still used, just not for /data/app
19.rm -r /data/app
20.ln -s /sd/app /data/app
Click to expand...
Click to collapse
It should probably be /sdcard/app. In any case, this is a fairly complex mod that is not suited for Linux newbies. I would advise against folks considering this mod unless they understand and can test each step before attempting.
I agree and added a warning to the first post
Ummm yea, so what happens when you mount your sdcard for storage? I expect the phone goes crazy?
This tutorial, if you could call it that,(no offense) is really badly written and this process seems too risky for what you gain considering that if we are patient google will come out with this themselves.
Stericson
Stericson said:
Ummm yea, so what happens when you mount your sdcard for storage? I expect the phone goes crazy?
This tutorial, if you could call it that,(no offense) is really badly written and this process seems too risky for what you gain considering that if we are patient google will come out with this themselves.
Stericson
Click to expand...
Click to collapse
The procedure calls for two partitions on the microsd, one FAT32, other EXT. Theoretically it should work with mounting for mass storage. However, I agree that it's a rather sloppy hack.
There is talk about a similar strategy being officially implemented by the Android team. Instead of two partitions, it would be loopback mounted to a file in the FAT32. That would also provide some encryption security. See here. It's just talk though. Won't be a reality for at least a few months.
Well talk is certainly better than nothing...thanks for the info....
Stericson
I post a method withtout compiling the ramdisk.img but that do not force mounting the sd ext2 drive under rootfs but still workable...probably when i back to work I can compile 1 to flash
Am I the only one that thinks there are a few things that are getting 'lost in translation' here?
I'm not getting /sd mounted properly upon reboot...there's no way I'm going to continue attempting this till I see a better (no offense) tutorial or do a little more research on the command lines.
I would really shy away from this if you're an average user or don't know what mountd and init.rc files are used for....this could flat out wreck your phone.
TheDudeOfLife said:
Am I the only one that thinks there are a few things that are getting 'lost in translation' here?
I'm not getting /sd mounted properly upon reboot...there's no way I'm going to continue attempting this till I see a better (no offense) tutorial or do a little more research on the command lines.
I would really shy away from this if you're an average user or don't know what mountd and init.rc files are used for....this could flat out wreck your phone.
Click to expand...
Click to collapse
/sd is /sdcard (mount point for the micro sd card's partition)
I'm getting stuck right here:
8. busybox cp -a /data/app /sd/
9. rm -r /data/app
10. ln -s /sd/app /data/app
11. reboot
It's saying read only system blah blah, even though I have indeed mounted it is rw
pershoot said:
/sd is /sdcard (mount point for the micro sd card's partition)
Click to expand...
Click to collapse
No....no it is not.
/sd is a mount of the ext2 partition used for the 'copy' of /data/app (one of the things i disagreed with is picking /sd as a mount point for the second partition.)
/sdcard is the fat32 mount point...used as usual for mounting files.
IzzeLing said:
I'm getting stuck right here:
8. busybox cp -a /data/app /sd/
9. rm -r /data/app
10. ln -s /sd/app /data/app
11. reboot
It's saying read only system blah blah, even though I have indeed mounted it is rw
Click to expand...
Click to collapse
Type mount in adb shell and see if /sd is even mounted. I wasn't seeing it in my list. I don't think his mount command in the init.rc is correct, but I'm too busy with holiday stuff.
Don't rm -r /data/app if you have not 100% verified the copy works.
This line looks mangled (need flags in the args):
Edit: nevermind, looks like it should work in the init.rc
TheDudeOfLife said:
No....no it is not.
/sd is a mount of the ext2 partition used for the 'copy' of /data/app (one of the things i disagreed with is picking /sd as a mount point for the second partition.)
/sdcard is the fat32 mount point...used as usual for mounting files.
Click to expand...
Click to collapse
ahh yea. i just re-glanced over the instructions.
cool.
TheDudeOfLife said:
Type mount in adb shell and see if /sd is even mounted. I wasn't seeing it in my list. I don't think his mount command in the init.rc is correct, but I'm too busy with holiday stuff.
Don't rm -r /data/app if you have not 100% verified the copy works.
Click to expand...
Click to collapse
Yeah, don't see it. Hm.

paragon problem

Ok, i searched and couldn't find much about my problem with trying to partition my sd card to get ext2. when i try to partition in paragon it tells me this when i click on the sd card:
A new partition cannot be created on this hard disk. Most probably, all primary slots are occupied and there is no extended partition.
I tried reformatting the memory card to see if that would help, but it didnt change anything. So why is my sd card only allowing one primary partition? Is there any way around this problem? I tried on a 1gb card i had laying around and it will let me do it just fine, just not to my 8gb.
It doesnt work with Windows 7 either. And i tried compatibility modes.
You have to go into the advance mode. which is on the bottom of the main blue screen when you open it up. Then you have to delete the partition on your card. After that hit Apply(the green checkmark at top). right click on your sd where its says unallocated space and create the fat32 partition to the size you want and then use the rest of the space to create the ext2 partition no bigger than 2gb. When you have the two partitions hit apply and follow the directions it gives you. It mostly runs on its own at that point but you will need to restart the computer when it asks you to. make sure you do this through an adapter and not usb because it will show an error message after restart.
OK i deleted the partition but it only gives me the option to test the surface or something like that, i've tried the apply button twice now, and it just takes a few seconds and says its done, it says its unallocated now but when i explroe it in paragon i can see all my files still but it doesnt show on the computer anymore. it still has the same name and everything in paragon, but i still can't format it or create a partition, so right now i can't do anything else with it in paragon. in disk management i can see its there though and format it so i tried creating a simple volume on it leaving 100mb open for ext2 but after i do that i can't do anything else with the unallocated space in disk management and paragon still only sees the fat32 part of it, so i deleted the whole partition again and just did fat32. is my sd card just pure **** or what?
DO this
I had the same problem till today until i first formatted sd to single partition ie. fat 32 and then used my phone to partition it using the following steps-
You will need to download the attached file
and dump mke2fs and sdsplit or http://www.mediafire.com/?d9ceg9sbi2g files on your sdcard
There should not be any data except the files you downloaded.
BEFORE WE BEGIN, THIS WILL ERASE YOUR SDCARD, BACKUP BEFORE YOU START!
Step 1 - We're going to Partition your sdcard
open terminal emulator
$ su
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
# busybox cp -a /sdcard/mke2fs /system/
# busybox cp -a /sdcard/sdsplit /system/
# cd system
# chmod 777 mke2fs
# chmod 777 sdsplit
******************************************
This is important! What size is your sdcard? If it's a 1gb and you want to share 50-50 then move to the next step and use 500m otherwise you have some very simple maths to do. 1gb is 1000mb (not actually but for simplicity...) if your card is 4gb and you want 500mb app space you need to specify 3500m. if it's 8gb and you want 1gb you would specify 7000m take the size you want for apps away from the size of your sdcard, add an m to the end and that is your magic number.
*******************************************
# sh sdsplit -fs MAGICNUMBER --pmke2fs /system/mke2fs
DOnt forget to put m after magic number like write 7000m instead of 7000
If all goes well you now have 2 partitions to your sdcard: you should get a message like this
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1 62 7277445+ b Win95 FAT32
/dev/block/mmcblk0p2 63 968 497983 83 Linux
If you have, congrats. my next post in this thread will explain how to move your application, but pat yourself on the back, the hardest bit has been done!!!!!!
If any error come on copying data back to sd like can't mount sd dont worry.
It should be good till creating ext2 partition.
If not please follow go back to the beginning and follow these steps exactly.
Step 2 Mounting you're new linux partition.
Ok dump init.rc and mountd.conf on your sdcard (the windows portion - which is the only part that will appear) I highly recommend at this point you copy a update.zip onto your card just incase everything goes horribly wrong
Open Terminal emulator
$ su
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
# mkdir /system/sd
# busybox cp -a /sdcard/mountd.conf /system/etc/mountd.conf
# busybox cp -a /sdcard/init.rc /system/init.rc
# reboot
I recommend a nandroid a before partition and wipe after partition.
Now everythings done. Download APPS to sd apps and move your apps.
COngrats.
.There may be other methods but others didn't work for me but this one did.
I also had the same problem exact same. I f****ed my sd with paragon and this saved me.
ok so after windows still wouldnt see the sd card in my computer, i checked it again and even though i assigned it a drive letter it didnt show up so i assigned it one again. so then the computer seen it so i decided to play with paragon again. this time though it let me partition it, idk why it was so goofy before but i got it setup now. i wanted to give 100mb to ext2 but since i have to use the slider i could only give 77 or 155, 77 a little low and 155 to high since the cards about filled as it is, so ill see how 77mb works. thanks for the help
do as said
Make it atleast 500 mb Will work better with it or u have to repartition it.

[Q] SD Card will not mount after ext4 part.

Attempting to partition sd card with ext4 -a process I completed multiple times successfully on a Nexus One, the process appeared to complete but now the phone will not mount the sd card. I've tried a wipe/reset, to no avail. I can still access and partition the sd card through adb, but the phone cannot mount it to format/partition, restore from recovery, partition sd-card from within ClockWork Recovery, nothing. I've re-partitioned the sd card through adb, which indicated a successful completion, but the phone still refuses to mount the sd card. If this weren't a Nexus S with it's cursed internal sd-card I would simply swap out the sd card with another or format it externally like all the google topics I pull up on the subject suggest.
Is this fixable or has the fused sd-card scenario become a liability?
Common Error messages:
Can't mount /sdcard
Can't mount /sdcard/.android_secure
Phone: Nexus S (US, T-Mobile, manufactured Dec. '10)
Recovery Img: ClockworkMod Recovery 3.0.2.4
Rom: CM 7.0.3 (now wiped, cannot put back on since sd card won't mount)
fstab:
/dev/block/mtdblock4 /cache yaffs2 rw
/dev/block/platform/s3c-sdhci.0/by-name/userdata /data ext4 rw
/dev/block/platform/s3c-sdhci.0/by-name/system /system ext4 rw
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard vfat rw
Can mount everything except the last one, /sdcard.
I've tried all the recommended procedures garnered from the first 10 or so pages in google, xda, cyanogem forum, etc:
Restore from nandroid: Not possible, can't mount the SD,
Wipe/Reset: can't wipe /media as sd card won't mount,
partition sd card from within Clockwork: indicates success but does nothing,
format from within clockwork: unable to mount,
repartition using adb: works, parted can see them, I can move files to from, but the phone will not mount,
clearing fstab: no effect,
Fastboot works, but I don't have the proper images. ADB works, as do the installed utilities. Have not tried ODIN as again, I don't have the proper images. Should I attempt to compile my own images from source?
Update: SOLVED, Microsoft Windows. To whom it may concern: I was able to mount the /dev/block/platform/s3c-sdhci.0/by-name/media from two different laptops running OSX and Fedora/Ubuntu then successfully been able to partition them with fat32 as the ClockworkMod (and maybe Cyanogen?) expect with 0 progress. Then I pulled out an old Windows machine, installed the JDK/ADK's +tools and performed the same procedure and that time it worked. I'm uncertain as to what particular quality a 'genuine' Windows formatting provides, but either this phone or the particular software combination I'm running require it. I was able to mount & re-partition the /sdcard in Clockwork, then manually remove rebuild them and upgrade to ext4 using tune2fs as usual. In the interim for work and such, I had to find a surrogate (for the SIM) and could only find and old k750i (which still had a full charge and worked flawlessly all day, btw). Wow phones used to be small.
I think I was missing something about the way ClockworkMod handles fstab, because everytime I would modify it specifically to the specs I passed to parted while creating the partitions with mkpartfs, it would either ignore or overwrite them. So be careful messing with the sd-card, the S's aren't like the One's in the sense that if you screw it (the sd-card) up or it goes bad you can't just take it out and format it in another machine/phone, you have to appeal to ClockworkMod. ODIN $ucks by the way, I found fastboot to be much more effective.
If you format the sd partition ext4, then you should change the fstab too.
from
Code:
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard vfat rw
to from
Code:
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard ext4 rw
or from
Code:
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard auto rw
The 2nd last entry there is the file system type.
Likely, this would have solved your problem.
Of course, I don't know, whether the recovery has the vfat type in fstab. You might have to change it there too. On my linux box auto works very well in fstab.
Of course, if you partition your sd partition ext4, you won't be able to use it as usb memory from windows. (At least I am pretty sure you can't, haven't tried)
Well of course I couldn't let it die, I went back and started tinkering again now that I have a way back. I can't change the fstab it seems, whatever I change it to gets over written everytime either Clockwork or the Rom starts. It's weird, I know I'm missing something and I don't know much about CWMod. (had Amon_Ra on the N1, which had the nifty fsupgrade script)
The 2nd last entry there is the file system type.
Likely, this would have solved your problem.
Click to expand...
Click to collapse
I'm quite familiar with unix style fs and fstab, it's the stubbornness I'm not used to. I'm also spoiled by vi and nano. CW has some nice scripts built in as well though.

[GUIDE][Using loop devices to workaround corrupt eMMC partitions]

Introduction
This workaround is for those of us (may only be me at this point?) who have bricked your Skyrocket by formatting a partition in an ICS-based kernel. This is where the kernel performed an MMC ERASE command and due to a bug in the eMMC firmware, the wear leveling data was corrupted.
The result is that accessing the affected section of eMMC causes the device to lock up. If we could find a way to avoid accessing those areas, the device might be usable again.
To further complicate matters, it seems that writing to the eMMC causes the problem to move around--probably because the eMMC tries to update the wear leveling data. As a result, any workaround needs to assume that no portion of the eMMC can be used for writable scratch space. That means it can't be used for /data, /cache, /tombstone, or "internal sd".
In this workaround, I create image files for the data, cache, and tombstone partitions on the external SD card. Then I modify the ramdisk to use the loop devices to mount these images as /data, /cache and /tombstone. The result is a bootable system.
The system obviously runs slower, but it is definitely tolerable. Usually the delay is noticed when opening an app for the first time. Another downside is that the "internal sd card" is gone and the "external sd card" is not USB mass storage mountable (since loop files are on it and therefore cannot be unmounted).
Thanks to seedub for the brainstorming session where we came up with this approach. I appreciate his Linux-fu.
Identifying If Important Partitions Work
On Skyrocket, for this workaround to be successful, we need at least the first 24 partitions to be okay. A few tests you should run:
Can you boot into download mode?
Can you boot into recovery mode?
In recovery, run "adb shell dd if=/dev/block/mmcblk0pX of=/dev/null" where X is 1-24. Do these all complete without error?
In recovery, can you install a ROM zip (e.g. CM9) without the device rebooting? (This is to test whether you can write to /system)
If the answer is "yes" to ALL of the questions above, then you are a candidate for this workaround.
Btw, always pull the battery and remove the USB cable before starting the above tests. Once the eMMC is locked up, it needs to be power cycled before it works again.
Creating The Image Files
You will need 1.5GB free. You can adjust the size of the data image to your liking. Boot into recovery and run the following commands in an "adb shell":
Code:
# Create an area on your SD card for the image files
mount /sdcard
cd /sdcard
mkdir emmc_workaround
cd emmc_workaround
# Create the data image file (1 GB - normally on /dev/block/mmcblk0p25)
dd if=/dev/zero of=/sdcard/emmc_workaround/data.img bs=1024 count=1048576
busybox losetup /dev/block/loop0 /sdcard/emmc_workaround/data.img
mkfs.ext4 -m 1 /dev/block/loop0
busybox losetup -d /dev/block/loop0
# Create the cache image file (297 MB - normally on /dev/block/mmcblk0p26)
dd if=/dev/zero of=/sdcard/emmc_workaround/cache.img bs=1024 count=304128
busybox losetup /dev/block/loop1 /sdcard/emmc_workaround/cache.img
mkfs.ext4 -m 1 /dev/block/loop1
busybox losetup -d /dev/block/loop1
# Create the tombstone image file (64 MB - normally on /dev/block/mmcblk0p27)
dd if=/dev/zero of=/sdcard/emmc_workaround/tombstone.img bs=1024 count=65536
busybox losetup /dev/block/loop2 /sdcard/emmc_workaround/tombstone.img
mkfs.ext4 -m 1 /dev/block/loop2
busybox losetup -d /dev/block/loop2
umount /sdcard
Modifying a ROM
We have to modify the ROM to make this work. With a lot of effort you might be able to modify a stock ROM, but I would recommend only modifying a built-from-source ROM. I used CM9 since, well, I am most familiar with it.
Here is the outline of the changes:
Disable the internal SD card on partition 28
Make the external SD card non-removable and disable USB mass storage for it
Rework the init scripts to mount the external SD card, attach the images to loop devices, and mount /cache, /data and /tombstone on their new loop devices
Apply patch #0001 (which is attached) to the device/samsung/skyrocket tree of CM9. See these build instructions: http://forum.xda-developers.com/showpost.php?p=25363482&postcount=3
Apply path #0002 if you want to move /cache to tmpfs instead of an image file. I'm still experimenting with this one.
Possible Improvements
I'm sure there are some ways to speed things up. I'll add to this list as we come up with more ideas.
Use smaller image files
Put /cache into a ramdisk -- probably would increase responsiveness a great deal (see patch #0002)
Repartition external SD card instead of using image files
so if some1 had a true brick where device can not turn on, this method still wont unbrick it
Mr. Top, you, sir, are a genius. Hopefully this will help us move forward with a possible unbrickable mod.
Sent from my SAMSUNG-SGH-I727 using XDA
Idea, What about cloning the whole emmc card boot partition and all to a microsd
vincom said:
so if some1 had a true brick where device can not turn on, this method still wont unbrick it
Click to expand...
Click to collapse
Yup. This is only for the Emmc lockup bug where it affects the data partitions,
Sent from my iPad using Tapatalk HD
tjsooley said:
Idea, What about cloning the whole emmc card boot partition and all to a microsd
Click to expand...
Click to collapse
That would definitely work if the boot partition of the Emmc was intact. I think partition #8. I don't know of a way to redirect the base kernel boot until it starts executing the init scripts.
Sent from my iPad using Tapatalk HD
In theory wouldn't you just have to change the memory address that the phone goes to when it first boots so it never looks at the original boot partition?
Sent from my SAMSUNG-SGH-I727 using XDA
Could you tell me what exactly causes this. So i can avoid it.
im currently on skyics latest leak with clock work mod touch recovery
i just would like to know what not to do. thanks
tpmullan said:
In theory wouldn't you just have to change the memory address that the phone goes to when it first boots so it never looks at the original boot partition?
Sent from my SAMSUNG-SGH-I727 using XDA
Click to expand...
Click to collapse
the memory address the pc points to on first boot/after resets is implemented in hardware iirc,,, bootstrapping etc.
Is there a way to unbrick this device without a JTAG using only the EMMC program? My answer to all the questions in this post is NO, my device does not turn ON at all but when I plug it into the computer, it shows on the Device Manager under COM7 port. I have installed the Qualcomm HS-USB QDLoader 9008 driver and it appears in EMMC software as in Download mode. I've searched on the internet and I cannot find a solution that is not using JTAG. Thanks for answering.

Idea for creating extra storage space

I have a good 2 GB of space that I am unlikely to use on the /data partition. So I created an 'sdcard' directory in there. What I'm trying to do is trick the system into believing that it's a second SD card. Can android support more than one? It's all good getting the directory to work as a secondary storage place, but the problem is, media scanner will not show pictures/music that are in that directory.
So my question is, is it possible to edit the ramdisk (init.rc) or vold.fstab etc or any other files, so the system is tricked into believing it's an actual storage card? I have tried making symlinks and doing directory bindings from /data/sdcard to /storage/sdcard1, but haven't had any luck.
Edit:
something like this maybe in init.rc??
symlink /storage/sdcard /sdcard
symlink /storage/sdcard1 /data/sdcard
export EXTERNAL_STORAGE /storage/sdcard
export SECONDARY_STORAGE /storage/sdcard1
I'm sure something is possible.
The nicest thing would be to have vold bind-mount a directory or loop-mount a filesystem image, but I'm not sure vold can do that at all and if it can I don't know what the syntax for that would be.
This would probably be a bit different between sense and aosp as it looks like vold is different.
You can easily bind-mount it yourself.
Either way, if you want to mount it on (say) /sdcard2 or anywhere on the root file system, you have to edit the ramdisk in the boot image.
But you can also mount it on top of /sdcard
mkdir /data/extra_sd
mkdir /sdcard/extra_sd
busybox mount --bind /data/extra_sd /sdcard/extra_sd
( ^^^-- I found that /system/bin/mount doesn't do --bind or -o loop and that busybox mount does.)
I tried this and it works. I have not yet experimented with putting it in an init.d script or so to mount it on boot and see if mediascanner scans it.
However, using this method you may corrupt stuff when you USB-mount your sdcard onto your PC. I'm not sure.
-Jobo
I've actually been trying numerous ways of mount bind all day. From init.d to repacking kernels with adjusted init.rc. Nothing worked.
The only way that works is using ScriptManager to run a busybox mount -o bind command at startup. It binds a subfolder in /sdcard/music to /data/media, where I've offloaded 1.5 GB of my music. I've rebooted many times and it seems to mount on time before messing up the media storage, and now I have 1.5 G extra SD space
Well, you could try "partitioning" the phone with LVM.
Which would actually be really interesting. I've got an extra gig of space in each of /system and /data that I'm not using. Being able to span that with /sdcard would be handy.
Actually, with that in place, you could combine /data and /sdcard into a single large partition and then just have both directories on that.
ardax said:
Well, you could try "partitioning" the phone with LVM.
Which would actually be really interesting. I've got an extra gig of space in each of /system and /data that I'm not using. Being able to span that with /sdcard would be handy.
Actually, with that in place, you could combine /data and /sdcard into a single large partition and then just have both directories on that.
Click to expand...
Click to collapse
That would be the ideal solution, which I have been hoping since day 1 becomes available from our phone, but does it not require S-OFF?
djsubtronic said:
That would be the ideal solution, which I have been hoping since day 1 becomes available from our phone, but does it not require S-OFF?
Click to expand...
Click to collapse
I don't think it should, since it's not changing the partition layout of the internal memory itself, just globbing it together and slapping virtual volumes on top with LVM. The biggest things are making sure that the kernel has LVM support and binaries built in and that recovery can get to those LVM binaries.
Perhaps I'm wrong though.
djsubtronic said:
I've actually been trying numerous ways of mount bind all day. From init.d to repacking kernels with adjusted init.rc. Nothing worked.
The only way that works is using ScriptManager to run a busybox mount -o bind command at startup. It binds a subfolder in /sdcard/music to /data/media, where I've offloaded 1.5 GB of my music. I've rebooted many times and it seems to mount on time before messing up the media storage, and now I have 1.5 G extra SD space
Click to expand...
Click to collapse
I really like the idea using data to get some extra space.
I tried "busybox mount --bind" via console and it works. Now i will have a look at ScriptManager.
But what happens if you are installing/updating a new ROM. Do you lose all your things located in /data?
regards
If you format /data then yes, obviously. You are only creating a "shortcut" to /data/folder.
Also, if you run out of space in /data/app/ you can move apps to /system/app instead.
I did that on my blade with a way too big /system/ partition and way too small /data/ partition
djsubtronic said:
I've actually been trying numerous ways of mount bind all day. From init.d to repacking kernels with adjusted init.rc. Nothing worked.
The only way that works is using ScriptManager to run a busybox mount -o bind command at startup. It binds a subfolder in /sdcard/music to /data/media, where I've offloaded 1.5 GB of my music. I've rebooted many times and it seems to mount on time before messing up the media storage, and now I have 1.5 G extra SD space
Click to expand...
Click to collapse
Could I get a hold of that script by chance?
Daiskei said:
Could I get a hold of that script by chance?
Click to expand...
Click to collapse
+1. Yes, please share.
One S | Xparent Blue Tapatalk 2 | Viper 1.2.1 | Bricked Beastmode
So updating a ROM without formating data partition should be no problem.
But for installing a new ROM i have to backup the folder in the data partition.
I tried to use ScriptManager, but this app seems to be bit overloaded.
After this i installed GScriptsLite.
In there i made a new script with something like this:
busybox mount --bind /data/myfolder /sdcard/myfolder
The script is not started automatically after a reboot, but after running the script via GScriptsLite the folder is mounted.
Yeah I suppose it could be difficult if changing ROMs, but I use CM only so I never worry about changing the data partition. But if I do, I just copy the /data/media folder onto my PC using adb pull, then do the wiping/flashing, and finally push the media folder back before booting the ROM.
As for the script, it's essentially just this one line:
Code:
busybox mount -o bind /data/media /storage/sdcard0/Music/Music2
I've kept the script file itself on the /data partition as well. In script manager I've set it to run the script as SU and on boot, and that's it. I've mounted it into a sub folder within Music since I use PlayerPro and it only adds music found within /sdcard/Music.
Yes, ScriptManager is a lot more complicated than GScripts, but it always mounts it automatically on boot so saves the hassle of having to remember to manually run the script if you ever reboot. Plus you only have to sort it out once then never open the app again if you don't want to

Categories

Resources