Sunday, March 24, 2013

Increase your Internal Phone Storage

One of my biggest problem with my phone got solved today. I had been using an old Android phone with only 181 Mb of Internal phone storage. As a result my phone starts complaining after installing few apps, especially the ones which can not be moved to SD card. I have a 16GB SD card installed but its of no use when it comes to running more number of apps. Lately I had to uninstall a lot of my favorite apps and rely on the browser, e.g. I never could install Android apps for Facebook, Twitter, Google+ etc. I always used the mobile websites.

Finally I started searching the workaround for the same. I found that a part of my SD card can be partitioned and formatted as linux file system , so that Android OS considers it as part of phone storage. This is possible for phones which are rooted and I was already using custom ROM from Cyanogenmod.

Galaxy ACE

Note: following will wipe all your data in SD card including music and photos.

  1. Use Mini Tool Partition Wizard Manager to delete the original SD card partition and create two primary partitions as follows

    1. A FAT32 partition with most of the size of the SD card.

    2. An EXT2 (old type file system format to make sure most of the ROM support it), you can try with EXT3 or EXT4 also but I never tested. I kept this partition as 1 GB, I think I will never run out of this space , adding apps.

  2. Click "apply" to commit the partition changes  and format the SD card.

  3. Copy and unzip the file on to the SD card.

  4. Put the SD card back in the phone and start the Terminal Emulator app of the rooted phone.

  5. copy the file 40int2ext file (found in the file ) in /system/mnt/etc/init.d directory of the phone. I used the "cp" command and changed the permission of the destination directory for writing file after changing the user to super user (su). You may have to click "allow" while changing the user.

  6. That's it, I rebooted and phone and saw the internal memory has been increased to almost 1 GB.

Wow ! that was great, I immediately loaded the phone with all the apps I always wanted to install.
I was surprised to see that the performance did not decrease noticeably even tough it is a low class SD card. I will continue to test by installing more apps.

Finally a word of caution : Do this only if you fine in case the phone or the card does not work after this experiment.
However if experiment is successful , you will never see the "insufficient storage" or "low memory" error :)


Friday, March 8, 2013

Recursively find list of files in a directory in Python 2.2

I have been using python for writing small utility programs. Till now I avoided scripting languages like python because I though shell script is master of everything and works in any linux computer. They also have all programming constructs like loops and conditions etc. However when it came to quickly get some work done, shell script too a lot of time write a error free program. Finally I jumped to python to do some file batch processing.

The most fundamental need to batch file processing is to iterate through all the files in a given directory. I could found several ways to do so using os.walk function but my old linux server had only Python 2.2 and I did not want to FTP files to my local PC to server back and fourth . So here is the code which also works in old version of python.

[code language="python"]
import os

# finds all the files in a directory recursively
def listAll(dirName):
files = os.listdir(dirName)
for f in files:
if os.path.isfile(os.path.join(dirName,f)):
return filelist1
# root directory path
rootdir= '/home/'

for f in listAll(rootdir):
print "Absolute Path " + os.path.abspath(f)
print "File Name" + os.path.basename(f)
print "Directory Path" + os.path.dirname(f)
# Change directory
# print current directory
print os.getcwd()
# check file extension
if not ( f.endswith(".java") or or f.endswith(".xml")):
# Do nothing