Android Root-ing and Backup

A problem with my (micro) SD card unmounting itself (the famous “unexpectedly removed” error) pushed me to finally backup, root and fully move my apps to the SD card. 

Screenshot_2015-11-08-13-13-39One of my smartphones, an Android purchased at the end of 2014, had started to ignore its micro-SD card. Upon (re)booting, it would hang a bit, then  conclude that there’s no SD card. I took it out, checked it in Windows, but Windows found no error.

Re-inserting the card got it recognized, but within a minute or so, the phone did not see it anymore. Additionally, in the day prior to this happening, I had noticed the battery kept being drained very quickly.

It seemed to me that the card had some error or bad sector which the phone could not fix and it was stuck in a loop of encountering the error, scanning, trying to fix it, and so on.

After unsuccessfully checking the card, I decided to back up the data in order to transfer it to a new card. I thus took it out of the phone and inserted it into my laptop (my laptop has an SD slot, but I also had an SD and micro-SD to USB adapter). I found that my 32 GB card had a reported 29.8 GB size, of which 11.4 GB were free.

For the backup (al-bckpprgms), I decided to use 7zip as it does a pretty good job with both encryption as well as compression, even though its switches are a nightmare (ibm-7zhow2). I could have used Abakt, a GPL’d utility that stopped a few years ago at version 0.9.5b for Vista (sp-ab, cd-ab, wp-ab) to get the switches right, but I had forgotten I had it.

The important directories on the SD card were all under \Android\*.*, and a quick Properties check showed that to be about 3GB. Further inspection revealed that two directories contained data that was not worth backing up, each at about 1GB:

  1. \Android\data\com.ideashower.readitlater.pro\files\RIL_offline\RIL_assets
  2. \Android\data\com.google.android.apps.translate\files\ol\v3r1

Obviously, the first belonged to Pocket (formerly ReadItLater) and probably all the downloaded articles I had for reading later, while the second represented Google Translate off-line files, which I had downloaded after having been in Cuba with no (or very poor and expensive) Internet access and limited knowledge of Spanish. As for Pocket, it seemed that it mirrored the directory structure of the sites I followed, with most data concentrated in such a site subdirectories below ..wp-contents\uploads\2015\ as follows:

  • 09-845 MB
  • 10-747 MB
  • 08-642 MB
  • 07-75 MB
  • 06-50 MB
  • 04-27 MB
  • 05-20 MB

I ended up creating 3 archives:

  1. Pocket.7z – I deleted what were obviously the oldest images and data, then backed it up
  2. Gtransl8.7z – language files to use later, if ever
  3. AndData.7z – whatever was left after deleted the aforementioned backed-up files

Once that was done, I exploded the archives onto another micro-SD card, switched the cards and everything was more or less peachy again. Except that now, despite having had uninstalled most of my apps, the phone storage was still almost full, most likely due to the malfunctioning micro-SD card having forced the phone to move back data and apps back to phone storage. I tried uninstalling almost everything, and running Clean Master, but the problem was still there, even after moving apps back and forth between phone and SD storage. In the end, the only thing that seemed to help with cleaning was a “Task Manager” utility that came with the phone. I then uninstalled CleanMaster as it proved to be a waste of time, space and memory.

I planned to eventually empty the SD card then format it in the phone in the hope that the bad sector (or whatever error) that caused all these issues could be solved, but until then, I had the lack of phone storage to contend with.

I had originally purchased this phone mostly because of its above-average camera coupled with micro-SD. Its downside is that it has only 4GB of “phone storage” of which far less than 2GB are available for apps. That got filled up quickly and even when “moving an app to SD” some remnants are left in phone storage. This means that I had to be very careful with the apps I keep installed, as sooner or later the “beefier” ones stop updating due to no space left. Tired of the constant hassle of lack of space, I decided to root the phone so that I can more less used apps (and, if possible, the bloatware) to the SD card. To that end, I purchased the fastest card that I could afford, namely a Samsung EVO.

root

In the Android beginnings, there was only one way to root an Android smartphone: using a PC loaded with the “correct” drivers. When I purchased my first Android device, a Samsung Google Galaxy Nexus (aka gNex, maduro or gt-i9250), I looked into rooting but abandoned the idea because the entire process seemed far too complicated and prone to error for little benefit. Storage was not really an issue, as the phone had 8GB of storage space and very little bloatware, so I did not really need to go that route. Additionally, the information about which drivers to use seemed contradictory, often in poor English and the downloads were often flagged as having trojans. As they were often low-level utilities, it was virtually impossible to tell whether such alarms were false positives.

In terms of benefits, rooting has quite a few. I am listing most below.

  1. Blocking Ads at system level. If you only want to block ads for browsing, you can install a browser such as AdBlock Browser, Ghostery or Firefox with the appropriate extension/addon and neither of those requires root privileges. However, if you wish to block ads at system level, you may use a hosts file (usually in /etc or /system/etc) or use Adblock Android apk, both solutions requiring root. It is worth noting that this is much easier to do with iOS than with Android, most likely because Google still makes most of their money with AdSense.
  2. Custom ROMs and Kernels. As most phones are OEM, the Android version loaded on the device tends to be the most current version at the time of the launch; manufacturers don’t usually bother updating it either because the hardware is soon obsoleted in this fast moving industry, or simply because their microscopic profit margins do not warrant continued support. Unfortunately, exploits and security holes are constantly discovered, and you might want to patch those holes with a newer version of Android or a custom ROM, such as CyanogenMod or NetHunter, the Made for Android Kali (pentest distro).
  3. Unleash the power of certain apps. Tasker, for instance, can do much more with root access, and so can other apps. Titanium Backup, due to its ability to take advantage of root, can backup apps from directories where few other apps can go.
  4. Better control of apps privileges and forced hibernation. Some apps, though useless, will come back to life even after you disabled them or are difficult to hibernate. CleanMaster and other apps can help even on a phone that is not rooted, Greenify is famous for doing a better job with rooted phones. Smart Network will switch to 2G when the screen is off.
  5. Remove crapware. I’ll be trying to do that and update this article, although that may not always be possible.
  6. Moving apps to the SD card. Although Google Nexus phones, for instance, do not have a physical SD card, many phones do. If the phone storage is limited, it makes sense to move apps to the SD card, especially those not used very often or apps that do not have to run fast.

Now that I was pressed to root my current smartphone, I was pleased to learn that I had more options:

  1. use my PC for “flashing”,
  2. use an app on my PC,
  3. use an *.apk on the phone, without a PC, such srsroot, root genius, oneclickroot, framaroot, androot, iroot, z4 root, easy rooting toolkit, towel root, CF Auto root, although in my experience the best is Kingoroot.

The first method was the one I had previously used and, as I have been planning to develop an Android app for a while and even installed the required software on my laptop, the most desirable. To get ADB on my Windows 10 computer, I installed PDAnet. For a more intimate access to the MTK processor in my phone, I installed MTK droid. Finally, I enabled USB debugging, by going into “About” and tapping on the “version” (last) line at least 7 times – that’s required in my version of Android, i.e., 4.4.2 or KitKat. I was then able to read and save the “scatter” file, which matched the one posted on the XDA forum, but after that, either because I did something wrong or because I could not make sense of the instructions, I could not upload anything to the phone.

I then attempted to root via an app that was known to work with my phone (kingoroot), but rather than bothering with the Windows app, I downloaded their .apk to my phone, installed it, clicked the button, and that’s all it took to get root. Except that instead of Chainfire’s SuperSU I had Kingoroot’s. That caused Titanium Backup to complain, but unfortunately SuperSU could not be installed instead of Kingoroot, only as a complement; as soon as Kingoroot was uninstalled, the root was lost. I will continue to try as SuperSU has been time-tested longer and as such is preferable, although Kingoroot is pretty good on its own.

move

Once rooted, I immediately installed the apps that could help with my storage issue: Titanium Backup and Link2SD; the first can backup, restore, “freeze” (or disable), wipe the data and delete apps, while the second can move apps to the SD card. As far as I can tell, “freeze” is the equivalent of “Disable”, which can be done with a phone that is not rooted: in Settings –> Apps –> App properties –> Uninstall Updates –> Disable. This is often defeated when “updating all” and those pesky, useless apps keep coming back.

I soon discovered that certain pre-installed (“bloatware”) apps, even when uninstalled/deleted, would not free up space, as they are on a different partition than “user apps”. Additionally, both the aforementioned apps have paid versions that promise to do more and I wasn’t sure if I could do everything I needed with the free version. Even though this is something many people have gone through, the info is hard to come by – hence, this article.

Link2SD also requires a second, Linux-formatted (ext2, ext3 or ext4) partition on the SD card to do its magic.

 

*(*This article is unfinished – it was scheduled to appear in the hope that it will be finished before, but since this message is here and until it is removed, the article is to be considered work in progress*)*.

Sources / More info: al-bckpprgms, ibm-7zhow2, sp-ab, wp-ab, cd-ab, kingoroot (apk), framaroot, w-gtI9250, PDAnet (co), xda-5, cf-supersu, pw-ar, xda-e380, adblock-apk, hosts-mvps, hosts-yoyo, hosts-minu, adb-brwsr, adb-ghostery, lh-rt, af-i9250, xda-nrt, gb-cwm, xda-gnex, unlckr-gnexh2, cfa-mtk, xda-kingoroot, unl-motoe, ags-motoe, xda-motoe, xda-cwmtwrp, gbs-e380, mt65-romdump

Comments

Popular posts from this blog