Jump to content

USING LINK2SD TO USE INTERNAL SD AS EXTSD.


Guest elperroderoke

Recommended Posts

Guest elperroderoke

USING LINK2SD TO USE INTERNAL SD AS EXTSD.

I'm not a developer (THANKS TO BACKSIDE http://www.modaco.co...le-s2e-in-g300/ that gave me the clue) so I need some help to improve some things and test in other ROM's.

This was tested in GB stock ROM and ICS Stock too, so please test it in other ROM's to know if it works or it has to be done in other way (I think Link2 SD script is placed in init.d folder in ROM's that supports it).

This is just a simple guide to use the 2Gigas internal memory as EXT-SD so we can use the Link2sd program to move apps, davilk cache and libs to this space than normally is not used when we have the external SD card. This is similar to S2ext, but I like more the options that Link2sd gives us and the fact that it works on every ROM directly and works with FAT32.

First of all we need an SD, and we have to create 2 primary partition, the both of them must be FAT32. You can use Minitool Partition Wizard to make this, or Gpated in Linux

Now we will put this partitioned SD card in the phone and install Link2sd apk. Once we run Link2sd, the program will ask us to select the filesystem of the second partition on SD, just chose the one you used. Once the script is created by the program we will restart the phone.

Now using RootExplorer we will edit the file /system/etc/install-recovery.sh.

#!/system/bin/sh

#added by link2sd

LOG=/data/link2sd-install-recovery.log

echo "$(date) mounting..." > $LOG

mount -t vfat -o rw /dev/block/vold/179:34 /data/sdext2 1>>$LOG 2>>$LOG

mount -t vfat -o rw /dev/block/mmcblk1p2 /data/sdext2 1>>$LOG 2>>$LOG

mount >> $LOG

echo "$(date) mount finished" >> $LOG

And we will edit in this way (notice /dev/block/mmcblk1p2 is now /dev/block/mmcblk0p19)

#!/system/bin/sh

#added by link2sd

LOG=/data/link2sd-install-recovery.log

echo "$(date) mounting..." > $LOG

mount -t vfat -o rw /dev/block/mmcblk0p19 /data/sdext2 1>>$LOG 2>>$LOG

mount >> $LOG

echo "$(date) mount finished" >> $LOG

Now we will turn off the phone and we will change the partitioned SD card by one is not (our usual SD card) and restart the phone and is done. Open Link2SD and you will see that now you have a 2Gigas 2º partition that is mounted in /data/sdext2. Now use Link2SD normally to move all the data you want to this new partition.

Is not really needed to make the external SD to create the Link2sd script, you can paste the modificated install-recovery.sh file directly in /system/etc, and fix permissions and change woners (RWE-R E-R E, Owner ROOT and Group ROOT). Then you have to create manually the /data/sdext2 directory and restart the phone. The just run Link2SD.

I thouhg it would be a problem when you plug the phone to the PC and turn on USB Storage, because once the internal memory was mounted the linked apps will stop running, but is not.. Link2SD an the system still can access the files through /data/sdext2 at the same time that PC (Stock File Manager or the other file manger using /HWUserData folder can't do it). I linked Android Weather app and put its widget on the desktop, and even the internal memory was mounted, it still worked.

CWM Recovey an TW recovery (if selected), will include the internal memory (/datadata) in their backups and restores, so you don´t have to install or restore the linked apps manually.

Tested on GB (B892), ICS (B927) and INFUSION B927*

*Thanks to wso277.

Please let me now if this works in other ROMs.

Regards.

Edited by elperroderoke
Link to comment
Share on other sites

Guest Hogweed

There is actually no need to repartition the internal SD to use it with link2sd., See http://www.modaco.co...ncrease-memory/

(towards the end). CWM will backup and recover the unchanged partiition. You should be careful about mounting the drive on a PC though and what apps you have on the SD.

Edited by Hogweed
Link to comment
Share on other sites

Guest elperroderoke

I'm not telling to repartition the internal SD. You can chose if you want Fat32 or Ext4.

Fat32 has the problem that the internal Sd will be mounted and app linked will be stoped, but the Cwm backup will included and restore this partition.

Ext4 won't be mounted but Cwm won't backup or restore because it will try to mount it as Fat.

Regards.

Link to comment
Share on other sites

Guest Hogweed

Ah, I see. I thought you re-partitioned the internal card but, looking again, what you did was repartition the external card to get the scripts then edited it. I just created one script to perform the bind and didn't run link2sd on a real external card first so it never created its own.

Edited by Hogweed
Link to comment
Share on other sites

Guest elperroderoke
Ah, I see. I thought you re-partitioned the internal card but, looking again, what you did was repartition the external card to get the scripts then edited it. I just created one script to perform the bind and didn't run link2sd on a real external card first so it never created its own.

I don't know if is needed or not that link2sd creates de script, maybe once you have link2sd installed, put the edited script in the right place, so maybe is not needed using the partitioned external sd to create it and then edit.

I will try.

Regards.

Edited by elperroderoke
Link to comment
Share on other sites

Guest p4l1n0

Hi elperroderoke, could you please check EXT4 part again? I think you forget actually change blk1p2 for blk0p19 ....

if not sorry for alert

Link to comment
Share on other sites

Guest elperroderoke

I don't know if is needed or not that link2sd creates de script, maybe once you have link2sd installed, put the edited script in the right place, so maybe is not needed using the partitioned external sd to create it and then edit.

I will try.

Regards.

It did not work. The script must be created by Link2sd, not just paste.

Regards.

Link to comment
Share on other sites

Guest elperroderoke
Hi elperroderoke, could you please check EXT4 part again? I think you forget actually change blk1p2 for blk0p19 ....

if not sorry for alert

You were right, thank you.

Link to comment
Share on other sites

Guest Hogweed

It did not work. The script must be created by Link2sd, not just paste.

Regards.

All i did was mkdir the sdext2 in /data (it hadn't previously been created as I had never used link2sd in normal mode) and added /etc/init.d/11link2sd containing

#!/system/bin/sh

/system/xbin/busybox mount -o bind /HWUserData /data/sdext2

=========

And it worked. I have about 50 apps on it now.

Edited by Hogweed
Link to comment
Share on other sites

Guest elperroderoke

Thank you. Now it worket. All I had to do was create the /data/sdext2 folder manually, and Link2sd worked. So no needed to use the external Sd to "trick". Just put the edited install-recovery.sh in /system/etc.

I don't know, but I read init.d is not supported in stock Rom, at least directly.

Regards.

Link to comment
Share on other sites

Guest Hogweed

Yes no init.d in pure unmodified stock. I am running Paul's Modaco Gr2 which includes init.d support.

Edited by Hogweed
Link to comment
Share on other sites

Guest elperroderoke
As TeamWin recovery allows you to choose which partitions to backup & restore does it work with this method?

Could you please give me some link about this recovery.

Regards.

Link to comment
Share on other sites

Guest wso277

All i did was mkdir the sdext2 in /data (it hadn't previously been created as I had never used link2sd in normal mode) and added /etc/init.d/11link2sd containing

#!/system/bin/sh

/system/xbin/busybox mount -o bind /HWUserData /data/sdext2

=========

And it worked. I have about 50 apps on it now.

I'm goinf to try this, but when i tried it before (using the other thread) it gave me an error trying to mount. I didnt include the part about busybox.

EDIT: When i run the script with smanager i get a mounting error no such file or directory. I already created sdext2 in data. Using infusion rom.

Edited by wso277
Link to comment
Share on other sites

Guest Hogweed

The internal partitioning is different on ICS as I understand it. I'm happy with GB right now so I can't check what the internal drive is mounted as in ICS if it is not /HWUserData

Link to comment
Share on other sites

Guest wso277

The internal partitioning is different on ICS as I understand it. I'm happy with GB right now so I can't check what the internal drive is mounted as in ICS if it is not /HWUserData

So if i find where the internal card is mounted e just need to change the first directory?

Link to comment
Share on other sites

Guest wso277

Just found the directory: /mnt/sdcard2

It seems to be working but whenever i link an app that app stops working. Gets back to normal if i remove the link.

Link to comment
Share on other sites

Guest Hogweed

Just found the directory: /mnt/sdcard2

It seems to be working but whenever i link an app that app stops working. Gets back to normal if i remove the link.

You need the script to run at boot - Did you put the script in etc/init.d then reboot? If so then maybe another ICS difference

Edited by Hogweed
Link to comment
Share on other sites

Guest wso277

You need the script to run at boot - Did you put the script in etc/init.d then reboot? If so then maybe another ICS difference

Yes, i set it to run at boot and gave it root permissions. Link2sd shows the mounted card with 2gb and creates the link, but the app i link gives an error at start.

Link to comment
Share on other sites

Guest Hogweed

The reason I specifically say init.d is that I first used ROM Toolbox option to run script at boot. After boot everything was mounted correctly but the apps didn't work. Once I put the script in init.d it worked. ROM Toolbox script manager ran it too late in the boot sequence. You mentioned smanager earlier which is why I am checking.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.