1. 2015 is going to be a great year for Android! Why wait??
    Samsung Galaxy Note 5 | Samsung Galaxy S6 | HTC One M9
  2. New Forum Created: Samsung Gear VR!

Link2sd tutorial for a fresh wipe


  1. benslgdroid

    benslgdroid rockstar Guide

    Introduction:
    When updating your rom or going to a new rom and using link2sd and you need to do a full wipe or you will run into errors, some say the recreate link scripts works but its never worked for me. So here is a step by step how to do it after its already been set up and you have a fresh wipe. (If you have not already had link2sd and partitioned your sd card go to http://androidforums.com/showthread.php?t=364833and follow that tutorial to get you started.)

    Getting started:
    To do a full wipe:
    First backup all your apps with titanium backup (if you don't have pro you can fallow these same steps just where it's at the batch restore you will have to restore one by one but everything else is the same)
    Next,

    1) Backup your apps with something like TitaniumBackup or MyBackup

    2) Download the BACKside ROM (or rom of your choice) zip file, the gapps zip file, place them on your sdcard

    3) Boot into recovery

    4) Make a backup

    5) Wipe cache, and under advanced wipe dalvik cache

    6) Under mounts, format boot, system, data, and cache

    7) Flash the BACKside ROM zip file

    8) Flash the gapps zip file

    9) Reboot your phone

    Instructions:
    When it asks for you to sign into Google when you first startup after flashing gapps select skip, you'll go back to it when your finished.

    First install titanium backup then link2sd. Then open link2sd it will ask you to select your ext, select the right one then reboot. Next open link2sd again push the menu key, then select settings then auto link,

    [​IMG]

    Next start titanium backup, push the menu key and select batch go to restore and select app and data (not system apps)

    [​IMG]

    Make sure you have selected what you want to restore and hit run. Wait until its finished, can be a while depending on the number of apps you have.

    Next go back to link2sd and select the location filter,

    [​IMG]

    Select linked,

    [​IMG]

    Then select filter,

    [​IMG]

    Next lib size,

    [​IMG]

    Next push the menu key and select multi select, look for the ones where the lib is not linked (it will have no arrow infront of it)

    [​IMG]

    Select all the ones where lib is not linked, (when lib is 0 there are no more lib files to worry about in the list) push the menu key and select create link,

    [​IMG]

    Make sure all the options are selected then push okand let it finish, then push back to exit multi select, then select location filter,

    [​IMG]

    Select on sd,

    [​IMG]

    If multiple apps are there push the menu key then multi select, select all the apps there, then hit the menu key and select create link

    [​IMG]

    Make sure all three option are selected then hit ok and it will move and link all those apps.

    Now your done, now go back and go to the market and install your Google apps and they will auto link as well.

    Advertisement
    :
    PMUSER, sushifor5, drew_t and 7 others like this.
  2. norwoodsteel

    norwoodsteel Member

    i love link2sd. been using it for 4 months and never had any problems. i've flashed every gingerbread rom [Jerry, Bobz, Mrg666, harmonia2, and even thatunknown and rarely heard from artist] and all updates.

    if Jerry releases a new update and i happen to be running Bobz's i go to backup and restore and restore Jerry's latest.
    i flash the update over this, wiping ONLY cache and dalvic cache.

    when it boots up there is a link2sd "mount warning" in the status bar.
    i go to link2sd and do NOT quick reboot
    i go to menu/ more/ recreate mount scripts, and then select my EXT in the pop-up [ext2 for me]
    it then tells you to reboot and i do so manually.

    when it boots back up everything is like it was before /except i have all the new stuff that Jerry [or Bobz or...] has just added
    benslgdroid likes this.
  3. benslgdroid

    benslgdroid rockstar Guide

    That doesn't work for allot of people including myself because every one of these phones are different.
  4. benslgdroid

    benslgdroid rockstar Guide

    Updated to explain what to do without titanium pro and how to do a full wipe. (Steps credited to jerryscript)
  5. AndyOpie150

    AndyOpie150 <strong> <a href="http://androidforums.com/optimus Contributor

    Great tutorial benslgdroid. The screen shots make it a lot easier to understand. Maybe you or MacFett could do the same thing in the "Link2SD and you" thread.
    Pics make everything some much easier to understand. I'll probably do it for mine as well.
    benslgdroid likes this.
  6. benslgdroid

    benslgdroid rockstar Guide

    That is a good idea.
  7. AndyOpie150

    AndyOpie150 <strong> <a href="http://androidforums.com/optimus Contributor

    I'm thinking of making a YouTube video for my "The Truth About ROM Manager" tutorial so those with the Hitachi screen will quit using it and causing the black screen in the recovery menu or worse; a double black screen- one in the recovery and another in the ROM.
    I've included the workaround in the tutorial and will include it in the video as well.

    I'm still going to take some screen shots for the tutorial.
    brotherswing and Atma like this.
  8. nijel

    nijel Well-Known Member

    Ben, have you ever tried copying Link2SD mount script to the new zipped ROM init.d folder and then updating the old ROM? That's how I update my ROM and never had problems with Link2SD, no need to recreate script after first boot. Link2SD even doesn't know what is happening.
  9. benslgdroid

    benslgdroid rockstar Guide

    How do you pull the script? Recreate scripts option has never worked for me.
  10. AndyOpie150

    AndyOpie150 <strong> <a href="http://androidforums.com/optimus Contributor

    Please tell us how to do this. This sounds like a really good idea. Remember though, a lot of members are not super techie/c++/linux types. That, and I'm a rock when it comes to new things, until I've done it at least once.

    Edit: Benslgdroid, the extension that the touch recovery made was ext. 3 not 4. I don't know if this is standard for CWMod recovery's or not. Just thought I throw that at you for future reference.
  11. nijel

    nijel Well-Known Member

    ext3 is the standard sd-ext type for CWM Recovery but you can force it to make ext2 or ext4 with some outside help:).

    Now modify ROM. It's easy.
    Copy the script 11link2sd from /system/etc/init.d folder to your PC. Open ROM.zip with 7zip and navigate to /system/etc/init.d in the zip. Drag and drop 11link2sd there. Now is the time to add/remove any files you want from the ROM before updating. Then open META-INF folder in the root of the ROM.zip and delete the three files in there:
    CERT.RSA
    CERT.SF
    MANIFEST.MF
    Do not touch "com" folder. Close 7zip. You have your new modified ROM.zip and it needs signing now. Download SignApk.zip, unzip it and just drag the new ROM.zip and drop it over sign.bat file. In few seconds you will have your new signed-ROM.zip in the same folder ready for flashing. That's it.

    I personally use more complex .bat file which in one step adds, removes and modifies many files in the ROM. Here is what I use for my ROMs before flashing, just to get the idea:):

    Code:
    @echo off
    IF [%1]==[] (
    color 0C
    echo ---------------------------------------
    echo "Don't run this batch file directly!!!"
    echo.
    echo Drag the zipped ROM in it...
    echo ---------------------------------------
    echo.
    PAUSE
    exit
    )
    color 0A
    IF EXIST "%~dp0log.txt" (del "%~dp0log.txt")
    IF EXIST "%~dp0signed_%~n1.zip" (del "%~dp0signed_%~n1.zip") > "%~dp0log.txt"
    IF EXIST "%~dp0framework-res\unsignedframework-res.apk" (del /Q "%~dp0framework-res\unsignedframework-res.apk") >> "%~dp0log.txt"
    IF EXIST "%~dp0%~n1" (rmdir /Q /S "%~dp0%~n1") >> "%~dp0log.txt"
    IF EXIST "%~dp0framework-res\framework-res_apk" (rmdir /Q /S "%~dp0framework-res\framework-res_apk") >> "%~dp0log.txt"
    IF EXIST "%~dp0framework-res\keep" (rmdir /Q /S "%~dp0framework-res\keep") >> "%~dp0log.txt"
    echo ------------------------------------------------
    echo Extracting original ROM...
    echo ------------------------------------------------
    echo.
    7z x -r %1 -o%~n1 -y >> "%~dp0log.txt"
    echo ------------------------------------------------
    echo Cleaning up the ROM......
    echo ------------------------------------------------
    echo.
    del %~n1\META-INF\CERT.RSA >> "%~dp0log.txt"
    del %~n1\META-INF\CERT.SF >> "%~dp0log.txt"
    del %~n1\META-INF\MANIFEST.MF >> "%~dp0log.txt"
    del %~n1\system\app\Calculator.apk >> "%~dp0log.txt"
    del %~n1\system\app\Gallery3D.apk >> "%~dp0log.txt"
    del %~n1\system\app\LatinIME.apk >> "%~dp0log.txt"
    del %~n1\system\app\SoundRecorder.apk >> "%~dp0log.txt"
    del %~n1\system\app\Music.apk >> "%~dp0log.txt"
    del %~n1\system\etc\init.d\05mountsd >> "%~dp0log.txt"
    del %~n1\system\etc\init.d\11mvdalvik >> "%~dp0log.txt"
    del %~n1\system\media\*.zip >> "%~dp0log.txt"
    del %~n1\system\media\*.mp3 >> "%~dp0log.txt
    echo ------------------------------------------------
    echo Copying custom files...
    echo ------------------------------------------------
    echo.
    xcopy "%~dp0system" "%~dp0%~n1\system" /E /Y >> "%~dp0log.txt"
    if errorlevel 1 (
    echo "An Error Occured, Please Check The Log (xcopy)"
    PAUSE
    exit
    )
    echo ------------------------------------------------
    echo Decompiling framework-res.apk
    echo ------------------------------------------------
    cd "%~dp0framework-res\tools"
    IF EXIST "%~dp0framework-res\framework-res_apk" (rmdir /Q /S "%~dp0framework-res\framework-res_apk") >> "%~dp0log.txt"
    java -jar apktool.jar d "%~dp0%~n1\system\framework\framework-res.apk" "%~dp0framework-res\framework-res_apk" >> "%~dp0log.txt"
    if errorlevel 1 (
    echo "An Error Occured, Please Check The Log (java)"
    PAUSE
    exit
    )
    echo.
    echo ------------------------------------------------
    echo Copying custom files...
    echo ------------------------------------------------
    echo.
    rem xcopy "%~dp0framework-res\mod_files\new_anim\*" "%~dp0framework-res\framework-res_apk\res\anim" /Y >> "%~dp0log.txt"
    rem if errorlevel 1 (
    rem echo "An Error Occured, Please Check The Log (xcopy)"
    rem PAUSE
    rem exit
    rem )
    rem echo.
    rem echo.
    rem echo ------------------------------------------------
    rem echo Now paste these two lines
    rem echo under the line of "shortAnimTime" in the file
    rem echo integers.xml which just have been opened for you,
    rem echo and Save it.:
    rem echo.
    rem echo      ^<integer name^="config_activityShortDur"^>150^<^/integer^>
    rem echo      ^<integer name^="config_activityDefaultDur"^>220^<^/integer^>
    rem echo.
    rem echo When done...
    rem echo.
    rem echo.
    rem clip < "%~dp0fresCopy.txt" >> "%~dp0log.txt"
    rem notepad "%~dp0framework-res\framework-res_apk\res\values\integers.xml" >> "%~dp0log.txt"
    IF EXIST "%~dp0framework-res\unsignedframework-res.apk" (del /Q "%~dp0framework-res\unsignedframework-res.apk") >> "%~dp0log.txt"
    echo ------------------------------------------------
    echo Building framework-res.apk
    echo ------------------------------------------------
    java -jar apktool.jar b "%~dp0framework-res\framework-res_apk" "%~dp0framework-res\unsignedframework-res.apk" >> "%~dp0log.txt"
    if errorlevel 1 (
    echo "An Error Occured, Please Check The Log (option 24)"
    PAUSE
    exit
    )
    rmdir /Q /S "%~dp0framework-res\framework-res_apk"
    IF EXIST "%~dp0framework-res\keep" (rmdir /Q /S "%~dp0framework-res\keep") >> "%~dp0log.txt"
    7z x -o"%~dp0framework-res\keep" "%~dp0%~n1\system\framework\framework-res.apk" >> "%~dp0log.txt"
    if errorlevel 1 (
    echo "An Error Occured, Please Check The Log (7z)"
    PAUSE
    exit
    )
    echo.
    echo ------------------------------------------------
    echo Raplacing with custom files...
    echo ------------------------------------------------
    echo.
    rem xcopy "%~dp0framework-res\mod_files\anim\*" "%~dp0framework-res\keep\res\anim" /Y >> "%~dp0log.txt"
    rem if errorlevel 1 (
    rem echo "An Error Occured, Please Check The Log (xcopy)"
    rem PAUSE
    rem exit
    rem )
    xcopy "%~dp0framework-res\mod_files\drawable\*" "%~dp0framework-res\keep\res\drawable" /Y >> "%~dp0log.txt"
    if errorlevel 1 (
    echo "An Error Occured, Please Check The Log (xcopy)"
    PAUSE
    exit
    )
    xcopy "%~dp0framework-res\mod_files\drawable-mdpi\*" "%~dp0framework-res\keep\res\drawable-mdpi" /Y >> "%~dp0log.txt"
    if errorlevel 1 (
    echo "An Error Occured, Please Check The Log (xcopy)"
    PAUSE
    exit
    )
    del /Q "%~dp0framework-res\keep\resources.arsc" >> "%~dp0log.txt"
    if errorlevel 1 (
    echo "An Error Occured, Please Check The Log (del resources.arsc)"
    PAUSE
    exit
    )
    7z a -tzip "%~dp0framework-res\unsignedframework-res.apk" "%~dp0framework-res\keep\*" -r -y >> "%~dp0log.txt"
    if errorlevel 1 (
    echo "An Error Occured, Please Check The Log (option 24)"
    PAUSE
    exit
    )
    rmdir /Q /S "%~dp0framework-res\keep" >> "%~dp0log.txt"
    echo ------------------------------------------------
    echo Zipaligning framework-res.apk
    echo ------------------------------------------------
    echo.
    IF EXIST "%~dp0%~n1\system\framework\framework-res.apk" (del /Q "%~dp0%~n1\system\framework\framework-res.apk") >> "%~dp0log.txt"
    zipalign -f 4 "%~dp0framework-res\unsignedframework-res.apk" "%~dp0%~n1\system\framework\framework-res.apk" >> "%~dp0log.txt"
    if errorlevel 1 (
    echo "An Error Occured, Please Check The Log (option 24)"
    PAUSE
    exit
    )
    del /Q "%~dp0framework-res\unsignedframework-res.apk" >> "%~dp0log.txt"
    cd "%~dp0%~n1"
    echo ------------------------------------------------
    echo Zipping the modified ROM...
    echo ------------------------------------------------
    echo.
    7z a -tzip -r unsigned_%~n1.zip -ssw -y >> "%~dp0log.txt"
    echo ------------------------------------------------
    echo Signing the new ROM...
    echo ------------------------------------------------
    java -jar "D:\Downloads\IE9 Downloads\Optimus V\APK Tools\Sign and Zipalign Apk\signapk.jar" "D:\Downloads\IE9 Downloads\Optimus V\APK Tools\Sign and Zipalign Apk\testkey.x509.pem" "D:\Downloads\IE9 Downloads\Optimus V\APK Tools\Sign and Zipalign Apk\testkey.pk8" "%~dp0%~n1\unsigned_%~n1.zip" "%~dp0signed_%~n1.zip" >> "%~dp0log.txt"
    if errorlevel 1 (
    echo "An Error Occured, Please Check The Log (Signing ROM)"
    PAUSE
    exit
    )
    cd "%~dp0"
    rmdir /Q /S "%~dp0%~n1" >> "%~dp0log.txt"
    echo.
    echo.
    echo.
    echo ------------------------------------------------
    echo Done^:-^) See log.txt for details.
    echo ------------------------------------------------
    echo.
    echo.
    echo.
    PAUSE
    
    EDIT: I forgot, I have this built into QtADB Update ROM Function. You select your ROM on /sdcard, check box "Copy Link2SD mount script to the updated ROM" and press "Update". Your phone will reboot to CWM recovery, 11link2sd will be copied to temporary location, cache and dalvik will be wiped, ROM will be flashed, 11link2sd will be copied back to the new ROM's /system/etc/init.d folder and the phone will reboot in Android. All in just one click. Can't get easiest than that.
    benslgdroid, AndyOpie150 and rooter1 like this.
  12. AndyOpie150

    AndyOpie150 <strong> <a href="http://androidforums.com/optimus Contributor

    Link to app is coming up "Not Found"
  13. nijel

    nijel Well-Known Member

    Sorry, fixed now.
  14. AndyOpie150

    AndyOpie150 <strong> <a href="http://androidforums.com/optimus Contributor

    Downloaded flawlessly.
  15. benslgdroid

    benslgdroid rockstar Guide

    Will be doing this on next update. Does your program work with blarfs recovery?
  16. nijel

    nijel Well-Known Member

    Yes, it does. Works with all CWM based recoveries that are looking for executing commands in /cache/recovery/extendedcommand file at boot.
  17. drew_t

    drew_t Active Member

    I just used this tutorial and found it very helpful; many thanks for putting it together. One question:

    It wasn't obvious to me what you need to do to go back and get the Google apps installed. Eventually, when I was adding a second Gmail account to the phone, it did bring up that page that shows you the Google apps, and I installed the ones I need. But if there's some other way to bring that page up, you might want to add it to the tutorial.
  18. benslgdroid

    benslgdroid rockstar Guide

    There isn't other than open the market
  19. sushifor5

    sushifor5 Well-Known Member

    This is a great tutorial by ben, and good thread! Ben walked me through my first (and thus far, only) wipe and rom flash with restoring link2sd as my top priority...his instructions were flawless. Thx!
    benslgdroid likes this.
  20. Crake

    Crake Well-Known Member

    Please my friends, help me!

    First of all i noticed that Google Play and Gmail applications have disappeared from my Android 2.3.4.

    Then i understood that my sd card was somehow getting slow, so throw an application called "testdisk-6.14-WIP" i've backup all the contents of my partition used by Link2SD.

    Now i got a new sd card, and have done the restore of all my applications, but the ones that were on the Link2sd partition are not there.

    Can please someone tell me how can i copy them again, in order to have these applications working???
  21. benslgdroid

    benslgdroid rockstar Guide

    You have to partition the new card. Then what I did was the clean wipe method shown in this tutorial. Make your backups with your old card, then move everything to your pc, then partition the new one, then move everything to your new card, don't worry about copying the partition, then do the wipe and follow the tutorial.
  22. Crake

    Crake Well-Known Member

    Thanks for your help, but it was a lot easier if i simply copy the contents of the Link2sd partition to the new one, and then recreate all links from the dalvik cache on it, but i can't realise how...
  23. benslgdroid

    benslgdroid rockstar Guide

    That usually doesn't work. Only for a select few
  24. sushifor5

    sushifor5 Well-Known Member

    Hey ben, I forget...are we supposed to link gmail and market? i'm thinking no, but can't remember why...yes on maps, right? thanks!
  25. Crake

    Crake Well-Known Member

    That's my problem!

    I only miss the gmail and the market...
Loading...

Share This Page