Sunday, February 2, 2014

How To Recover All Your Phone Data From a Rooted Samsung Galaxy S4 That Keeps Rebooting (ClockWorkMod Method)

A phone that keeps restarting repeatedly is unusable, but retrieving the data on it is still possible. Unrooted phones are at a great disadvantage unless you've used an external SD card to store all your information. But if you have rooted your phone and also installed a recovery method using ClockWorkMod or TWRP, you're safe! All your data is salvageable, whether on the internal SD card or the external. Even the phone's internal storage memory is salvageable as a "Nandroid" backup! In this post, I will concentrate on recovery steps for a rooted Samsung Galaxy S4 with ClockWorkMod (CWM) recovery software installed (v6.0.4.4).

Harold Hisona has written up a very useful guide on how to recover from a constantly rebooting phone at http://thedroidguy.com/2014/01/fix-samsung-galaxy-s4-keeps-rebooting-stuck-boot-loop/. I suggest you read that first, but return to me if you reach the end of that guide and are hesitant to do a master/hard reset for fear of losing your data.

You Will Not Lose Your Data!

The truth is you will not lose your data. CWM won't wipe your internal SD card. This is the data you really want to keep, in addition to your external SD card's. During normal use, all apps on a Google Android-based Galaxy S4 phone generally store their information either on the internal SD card or on what is called the external SD card (though in reality that "external SD card" is mounted on a slot that resides internally as well, behind the Galaxy's back cover!)  But you'll want to follow a specific sequence of steps in order to recover the most you can recover from your misbehaving phone.  I will walk you through these steps in more detail later on. In brief, so you get an overview of the process, you will:
  • Backup the External SD Card - First you'll want to mount the external SD card on your computer and move all data off to a location of your choice on your PC (you can simply do this via a USB data cable without needing to open up the phone's case and physically extract the external SD card)
  • Perform a Nandroid Backup - Next you'll want to create a Nandroid backup of all your phone's internal storage memory (this is different from the internal SD card on the Galaxy). I will step you through this but you can also see Ada Sandoval's post on Nandroid backup creation at http://www.shetalksandroid.com/2012/09/how-to-do-android-nandroid-backup-cwm-recovery-manager.html. Another very nice step-by-step guide is found at http://galaxys4root.com/galaxy-s4-tutorials/how-to-backuprestore-rom-on-galaxy-s4-with-root-cwm-recovery/. You might ask, why perform a Nandroid backup of a phone's ROM when it is already misbehaving (incessantly rebooting)? Well, let's just say we're doing this because we're trying to make as thorough a backup of the phone as we can in case there's anything there you want to go back to later after a factory reset. 
  • Reset The Phone - Then you'll want to reset the phone using CWM and restore normal operation to the phone. Note that this is not a stock recovery wipe, but the data wipe/ factory reset provided by CWM which is not as destructive. The contents of the internal SD card will be kept around, which is a great relief wince CWM does not allow us to back the internal SD card nor do the Samsung USB drivers mount it onto Windows! Having the internal SD card survive CWM's factory reset will give us a chance to back up its contents in the next step.
  • Backup the Internal SD Card - Finally, using Windows Explorer on your PC, regain access to the phone's internal SD card and copy its contents to your PC
If you've got the Samsung Galaxy S4 drivers (http://www.samsung.com/levant/support/model/GT-I9500ZKAMID-downloads or http://www.samsung.com/us/support/owners/product/SPH-L720ZWASPR) already installed on your PC, then you can recover all your data by doing the following. I assume your external SD card is as large as your Samsung's internal SD card.

Backup the External SD Card

  1. Make sure your phone is off
  2. Connect your phone to the PC using a USB cable
  3. Boot to CWM on your phone by pressing and holding Volume Up, Home and Power buttons simultaneously.
  4. Use the Volume Up/Down buttons on your Samsung phone to scroll over to the menu item called "Mounts and Storage" and use the Power button to select it
  5. Scroll again this time to "Mount USB Storage" (I expect from now on you know to hit the Power button to select the menu item); you should hear the PC sound off a notification that a USB device has been connected
  6. Use Windows Explorer on the PC to find the drive where your external SD card has been mounted
  7. Move the entire contents of the mounted drive to a location of your choice on your PC with the intention of leaving the external SD card empty.

Perform a Nandroid Backup

  1. Once finished backing up your external SD card data, scroll to "Go Back" on your phone; the mapped (mounted) drive will temporarily go away on your PC.
  2. Hit "Go Back" again and you should arrive at the CWM main menu
  3. On the CWM menu scroll to "Backup and Restore"
  4. Scroll to "Backup to /storage/sdcard1"
  5. The backup should take a little while and the CWM screen should display an on-going status; wait for it!
  6. Now return to the "Mount USB Storage" menu we visited on step 5 and move all files from your mounted drive in Windows Explorer to a location of your choice
  7. You're done! You've now got what is called a "Nandroid" backup

Reset The Phone

  1. To reset the phone back to factory setings, return to the first (main) menu in CWM (remember, contrary to the impression this gives, you won't lose the internal SD card's data!)
  2. Scroll to "Wipe Data/Factory Reset"
  3. Reselect the option in the subsequent confirmation prompt, i.e., scroll down to "Yes - Wipe all user data" and tap the Power button to select that option!
  4. Don't cringe--it's gonna be alright!
The Galaxy S4 should immediately appear in Windows
Explorer upon rebooting the phone.

Backup the Internal SD Card 

  1. It's time now to reboot the system by selecting that very option at the top of the CWM menu
  2. The phone will go through its familiar initialization routines and finally arrive at the Samsung Galaxy "Welcome" screen where you may begin reconfiguring your Samsung again for the first time
  3. What's more, if you go back to Windows Explorer (assuming you already installed all Samsung USB drivers earlier) you should see your internal SD card's contents again--all intact!!
  4. Double-click on the Phone drive and select all the files and folders there by pressing Ctrl-A.
  5. Copy the files to the clipboard and then paste them to the location of your choice on your PC.
  6. Now we're really done!
The contents of the SD card are intact and listed as "Phone".
Remember the external SD card is empty because we moved
its contents to the PC earlier!

NOTE: Accessing individual files from CWM's Nandroid backup data requires you use a decompression utility that can read *.tar files. Mind you, this is an uncommon thing to do. Nandroid backups typically contain only Android system data, some APK files, and the like....but no user data of any use to the normal or even intermediate user. The files are found in a directory structure in a pathname similar to clockworkmod\backup\<datetime>, where datetime is the timestamp of your backup. If your Windows installation doesn't know what to do with these types of files, download and install Winip, WinRAR or 7-Zip. Just do a Google Search for it. WinRAR or 7-Zip should allow you easy access to the individual files and folders compressed in the *.tar files. 

For more information on decompressing simple tar files produced by CWM, see Vijay Rajasekara's post on CWM tar file extraction at http://ajqi.com/how-to-extract-files-from-a-nandroid-backup/.

However, there are more complicated backup tar file scenarios. Recent versions of CWM have begun splitting large tar files into parts ending in tar.a, tar.b, tar.c, etc. Your Nandroid backup data (if it was large enough) may be stored in multiple files, some labeled like data.ext4.tar.?, where the ? stands for an alphabetic letter. There are data tar files and system tar files (there's also cache tar files). In order to see the contents of these strangely-suffixed data.ext4.tar.a, tar.b, and tar.c backup files from Windows, you'll need to perform some commands prior to using WinRAR or 7-Zip. Using a Windows command prompt (cmd), change directory (cd) to the folder where your backup tar.a and tar.b and tar.c files are. Then type the following commands to build a usable data.tar file and system.tar file:

Copy /b data.ext4.tar.a + data.ext4.tar.b + data.ext4.tar.c data.tar
Copy /b system.ext4.tar.a + system.ext4.tar.b + system.ext4.tar.c system.tar

Once each command is complete, you should be able to decompress the new data.tar or system.tar file. I would move these files from the backup directory in which you just created them though and place them elsewhere just to keep the original CWM backup directory contents pristine.

What If You're Not Rooted?

If you are sobbing because you haven't yet rooted your phone and can't take advantage of anything I've shared here, maybe you would like to in the future. For information on rooting the Samsung Galaxy S4, check out http://www.droidviews.com/root-sprint-galaxy-s4-sph-l720-on-android-4-3/.

If you want a recovery menu like ClockWorkMod or its competitor, TWRP, visit Alex Dumitru's post at http://www.android.gs/how-to-install-and-boot-cwm-and-twrp-recoveries-for-rooted-sprint-samsung-galaxy-s4-l720/.  Personally, after trying CWM and seeing what can be done with TWRP, I prefer the latter. For an introduction, see QBKing77's video presentation at http://www.how-to-diy.org/ktTmFFiX8xTQBb/How-to-Install-TWRP-Recovery-on-the-Samsung-Galaxy-S4.html. TWRP, by the way, can be installed right over CWM to replace it as your preferred recovery method if you end up liking it better ...as I did!

1 comment: