[Q] SD-EXT script for Android 4.2.2?

Picasso Lg

Member
Jun 22, 2013
37
9
0
Hi is there a script that increases internal storage via sd-ext for Cyanogenmod 10.1 (android 4.2.2)?
If so could someone link it to me?

I was using link2sd with King Evo ROM but not if I'm so result. Nor well but if I use function works.

If someone recommended I would appreciate any Script
 

engr_exxi

Senior Member
Nov 5, 2011
312
124
0
Manila
Create a file name 40int2ext then paste this.
Open notepad or notepad++.
Save file as 40int2ext
delete .txt extension at filename. (note you should set your pc to show extension file names)

You must have an ext partition at your sd card. I use ext4. You could choose among ext2/3/4 though.
As cronmod suggest the maximum size for partition must be 1GB/100mb of internal storage. I used about 512mb

From cronmod's int2ext
Code:
#!/system/bin/sh
#####################################
##  CronMod INT2EXT+ - 02/21/2013  ##
##   Written by CronicCorey  [user=243864]@xda[/user]   ##
##            40int2ext            ##
#####################################
## Thanks to Mastermind1024  [user=3964321]@Xda F[/user]or helping to solve the IMEI and Baseband issues on some devices
## Thanks to vvFICKvv, DK75, and Dark Passenger  [user=3964321]@Xda F[/user]or help to fix compatibility issues with Android 4.2.x
## Thanks to Mortaromarcello  [user=4166799]@github[/user] for code to check if mmcblk0p2 exists

## Only continue if mmcblk0p2 exists
if [ ! -e /dev/block/mmcblk0p2 ]
then
exit
fi;

## Set SD cache size
SD_CACHE=/sys/devices/virtual/bdi/179:0/read_ahead_kb
if [ -e $SD_CACHE ]
then
busybox echo "1024" > $SD_CACHE;
fi;

## Make /sd-ext directory if needed and unmount /sd-ext if it already mounted
if [ ! -e /sd-ext ]
then
busybox mount -o remount,rw /;
busybox mkdir /sd-ext;
busybox mount -o remount,ro /;
else
busybox umount /sd-ext;
fi;

## Move /data mount point to /sd-ext
INT_DATA=$(busybox mountpoint -n /data | cut -d ' ' -f1)
busybox umount /data;
busybox mount $INT_DATA /sd-ext;

## Mount mmcblk0p2 to /data
busybox mount -o noatime,nodiratime,nosuid,nodev /dev/block/mmcblk0p2 /data;
busybox chown 1000:1000 /data;
busybox chmod 771 /data;

## Move existing files
if [ ! -e /data/app ]
then
busybox mv /sd-ext/* /data;
fi;

## Move /data, /misc, /nvram, /property, and /radio back to /sd-ext
for i in data misc nvram property radio;
do
if [ ! -e /sd-ext/$i ] && [ -e /data/$i ]
then
busybox mv /data/$i /sd-ext;
busybox mkdir /data/$i;
fi;

## Make Binds
if [ -e /data/$i ]
then
busybox mount -o bind /sd-ext/$i /data/$i;
fi;
done;

## Unmount /sd-ext
busybox umount /sd-ext;

sync;

############################################################################################################################################################

########################################################
##              Bind Cache by CyanogenMod             ##
## bind mount /data/local/download to /cache/download ##
##           if cache partition is too small          ##
########################################################

CACHESIZE=$(df -k /cache | tail -n1 | tr -s ' ' | cut -d ' ' -f2)
DATAONLY=$(getprop dalvik.vm.dexopt-data-only)
if [ "$DATAONLY" = "1" ]
then
  NEEDED=60000
else
  NEEDED=105000
fi;

if [ $CACHESIZE -lt $NEEDED ]
then
  mount -o bind /data/local/download /cache/download;
fi;

rm /cache/download/downloadfile*.apk >/dev/null 2>&1;

sync;

############################################################################################################################################################

######################################################################
##                 Automatic ZipAlign by Wes Garner                 ##
## ZipAlign files in /data that have not been previously ZipAligned ##
##                Thanks to oknowton for the changes                ##
######################################################################

LOG_FILE=/data/zipalign.log
    if [ -e $LOG_FILE ]; then
    	rm $LOG_FILE;
    fi;
    	
echo "Starting Automatic ZipAlign" | tee -a $LOG_FILE;
    for apk in /data/app/*.apk ; do
	zipalign -c 4 $apk;
	ZIPCHECK=$?;
	if [ $ZIPCHECK -eq 1 ]; then
		echo ZipAligning $(basename $apk) | tee -a $LOG_FILE;
		zipalign -f 4 $apk /cache/$(basename $apk);
			if [ -e /cache/$(basename $apk) ]; then
				cp -f -p /cache/$(basename $apk) $apk | tee -a $LOG_FILE;
				rm /cache/$(basename $apk);
			else
				echo ZipAligning $(basename $apk) Failed | tee -a $LOG_FILE;
			fi;
	else
		echo ZipAlign already completed on $apk  | tee -a $LOG_FILE;
	fi;
       done;
echo "Automatic ZipAlign finished" | tee -a $LOG_FILE;
I used it and it works
 
Last edited:

rharshit

Senior Member
Jul 17, 2012
700
1,113
0
Mumbai
PROBLEM!

I wanted to extend my EXT partition size. So for that, I used Mini Partition Tool Home Edition to unallocate everything and create the full partition as primary sd card. Then i rebooted into recovery (CWM) and partitioned my sd card and created ext partition of 512 mb. But now, I am unable to use that ext partition. I cant mount it, even in recovery! SD card is working fine but problem is EXT. I have tried it with TWRP too and tried to create a SWAP too. But no luck!

What to do now?
pls dont tell to buy a new SD card.
 

engr_exxi

Senior Member
Nov 5, 2011
312
124
0
Manila
I wanted to extend my EXT partition size. So for that, I used Mini Partition Tool Home Edition to unallocate everything and create the full partition as primary sd card. Then i rebooted into recovery (CWM) and partitioned my sd card and created ext partition of 512 mb. But now, I am unable to use that ext partition. I cant mount it, even in recovery! SD card is working fine but problem is EXT. I have tried it with TWRP too and tried to create a SWAP too. But no luck!

What to do now?
pls dont tell to buy a new SD card.
You can't use the ext partition like the primary partition. It's either a script use it like link2sd,data2sd,ext2sd or anythingyoucanimagine2sd.

Try this method. After you partition your sdcard. and installed cronmod's int2ext. Try to reaplce the 40int2ext file with the one I provide. I also suggest to remove other scripts currently at the /system/etc/init.d folder but retain the two 00banner and 90userinit. You can use any root file browsers. Then restart your phone
 

rharshit

Senior Member
Jul 17, 2012
700
1,113
0
Mumbai
You can't use the ext partition like the primary partition. It's either a script use it like link2sd,data2sd,ext2sd or anythingyoucanimagine2sd.

Try this method. After you partition your sdcard. and installed cronmod's int2ext. Try to reaplce the 40int2ext file with the one I provide. I also suggest to remove other scripts currently at the /system/etc/init.d folder but retain the two 00banner and 90userinit. You can use any root file browsers. Then restart your phone
Thats fine. I have been using it before too.

But now i am unable to mount sd-ext, even through recovery! No use of scripts. They wont work and some of them may even make my phone go to bootloop.
I wanna know how do i partition it now. Some other method than CWM or TWRP.