Backup & Restore Apps + Data of RESTRICTED Profile

Search This thread

froggydoddy

Senior Member
Oct 14, 2008
89
4
Ok, so my tablet wouldn't install the latest JSS15J update. So I had to manually install it. In the process, it wiped out my entire tablet. I have a main profile and a restricted secondary profile (my son's. It's my son's tablet). How do I get all the apps + data backed up (from a restricted profile) and restored (to a restricted profile)?

I've tried Titanium Backup and MyBackupPro (both root). I got close a few times, but I CANNOT get the APK's + data off a restricted profile, flash the Nexus 7 upgrade, then install APK's + data again successfully.

If I use Titanium backup while logged into the main profile, it backup up the data from the main profile only. Nothing from the restricted profiles (game saves, settings, etc.)

I've spent the day trying to get this done! I've been going back and forth between NANDROID backups, trying different things.
 
Last edited:

teh roxxorz

Inactive Recognized Contributor
Nov 21, 2010
8,716
2,295
i'm not sure, as i don't use profiles.

BUT, what I can suggest for the future is:

Create a new folder on your internal and call it R Tita. Backup [for giggles], then backup your sons apps to the second folder, keep yours in the original. Just before you restore, change the backup / restore folder appropriately.
 

froggydoddy

Senior Member
Oct 14, 2008
89
4
i'm not sure, as i don't use profiles.

BUT, what I can suggest for the future is:

Create a new folder on your internal and call it R Tita. Backup [for giggles], then backup your sons apps to the second folder, keep yours in the original. Just before you restore, change the backup / restore folder appropriately.

I've tried that. I played around all day with it. You also can't easily move backup files from one place to the other. Then even when you do it (with Root Explorer), it still doesn't work for some reason. On top of everything else, it's hard to make backups as TB says there's no storage space left even though there's over 20GB. That's while trying to save it in all different place. Emulation 0, Emulation 10, legacy, Sdcard.... etc...
 

teh roxxorz

Inactive Recognized Contributor
Nov 21, 2010
8,716
2,295
I've tried that. I played around all day with it. You also can't easily move backup files from one place to the other. Then even when you do it (with Root Explorer), it still doesn't work for some reason. On top of everything else, it's hard to make backups as TB says there's no storage space left even though there's over 20GB. That's while trying to save it in all different place. Emulation 0, Emulation 10, legacy, Sdcard.... etc...


You should just do all the backups in the /storage/legacy directory.

Though I don't see any reason why TB should have issues restoring that, should work. Have you verified your backups are good within the app?
 

froggydoddy

Senior Member
Oct 14, 2008
89
4
I wasn't even able to create the backup anywhere due to that "no storage" issue. Then finally when I was able to create one somehow, I wasn't able to restore from it.

I've emailed the makers of TB to ask if they are planning on adding that functionality (backing up restricted profiles)

Sent from my Nexus 7 using XDA Premium HD app
 

bounti

Senior Member
Dec 16, 2012
505
64
Nexus 7 (2013)
OnePlus 8 Pro
I wasn't even able to create the backup anywhere due to that "no storage" issue. Then finally when I was able to create one somehow, I wasn't able to restore from it.

I've emailed the makers of TB to ask if they are planning on adding that functionality (backing up restricted profiles)

Sent from my Nexus 7 using XDA Premium HD app

What ever came of this? I too would like to know how to backup data from a restricted profile.

The apks aren't necessary, as the primary user is the one who's allowed to installed apps anyway, but the data itself is what's important.

Did the TB team ever respond to you?
 

viljoviitanen

Member
Feb 20, 2012
18
7
Jyväskylä
What ever came of this? I too would like to know how to backup data from a restricted profile.

The apks aren't necessary, as the primary user is the one who's allowed to installed apps anyway, but the data itself is what's important.

Did the TB team ever respond to you?

I found a way to do it. It's not very easy, I'm afraid. You need root, busybox, and pretty good familiarity with the command line (adb shell or terminal emulator on the device itself. However with this much typing, I really recommend adb shell...)

App data for other than the main user is stored at

/data/user/XX/com.the.application/

where XX is a number. My restricted user was numbered "10".

so to backup, just make a tar archive of that directory:
Code:
cd /data/user/XX
tar cf /sdcard/whatevername.tar com.the.application

to restore,

Code:
cd /data/user/XX
tar xf /sdcard/whatevername.tar
but, this probably only works for the very same user, because the file ownerships need to match.

So if it's not the same user, you need to fix the ownership of the restored files, but not the "lib" symlink.

With the games (the different angry birds...) I cared about had the folders cache, databases, files and shared_prefs. If there are other folders, you need to need to include them too (I'm not sure what folders there can be).

So to fix the ownership of all those, before extracting the backup (the tar xf command), first see who the owner is:
Code:
cd /data/user/XX
ls -ld com.the.application

it says something like
Code:
drwxr-x--x u11_a89  u11_a89           2013-09-12 23:14 com.the.application

here the u11_a89 is the important value.

Then, do the above tar xf command, and run
Code:
cd /data/user/XX/com.the.application
chown uXX_aYY:uXX_aYY .
find cache databases files shared_prefs | xargs chown uXX_aYY:uXX_aYY

Where uXX_aYY obviously is the value the ls command showed before.

By the way, this way you can also copy data from one user to another, e.g. from the main user (who can use titanium backup etc) to the restricted user or the other way around.

Sorry if I'm not very clear.. maybe someone could make a more understandable guide from this.

Disclaimer: I tried this on a rooted stock 4.3 nexus 7 (2012). But I think it's the same on any android 4.3 based device. Also, I really only did this with the angry birds games, I don't know if other apps need other tricks. (well except Bad Piggies is different, the data is /sdcard/Android/data/com.rovio.BadPiggies, and it can be copied with a file manager, without root.)
 
  • Like
Reactions: stevemw and Skaziwu

jicama

Member
Oct 11, 2011
24
18
Thanks. Based on this I wrote a perl script to fix up all the user/group names after restoring the entire data directory; you may need to change u11 to u10 or whatever the restricted user is on your tablet.

Code:
#! /usr/bin/perl -w                                                                                            
# Script to fix ownership of data directories on restore of Android                                            
# restricted profile.                                                                                          

open (LS, "adb shell \"su -c 'ls -l /data/data'\" |") || die "Failed: $!\n";
while (<LS>) {
      (undef, $owner, $group, undef, undef, $dir) = split(' ');
      $owner =~ s/u0/u11/;
      $group =~ s/u0/u11/;
      system ("adb", "shell", "su -c \"cd data/user/11/$dir && find . \! -type l -print0 | xargs -t -0 chown $owner:$group\"");
}
 

lanwarrior

Senior Member
Mar 5, 2006
2,196
158
Ok, so my tablet wouldn't install the latest JSS15J update. So I had to manually install it. In the process, it wiped out my entire tablet. I have a main profile and a restricted secondary profile (my son's. It's my son's tablet). How do I get all the apps + data backed up (from a restricted profile) and restored (to a restricted profile)?

I've tried Titanium Backup and MyBackupPro (both root). I got close a few times, but I CANNOT get the APK's + data off a restricted profile, flash the Nexus 7 upgrade, then install APK's + data again successfully.

If I use Titanium backup while logged into the main profile, it backup up the data from the main profile only. Nothing from the restricted profiles (game saves, settings, etc.)

I've spent the day trying to get this done! I've been going back and forth between NANDROID backups, trying different things.

How did you get root to work on restricted profiles? In this mode, AFAIK root doesn't work.

EDIT: Just tried creating a restricted profile and assigned rooted apps like Titanium Backup - it complained no root was found, even though the tablet is rooted.
 

os2baba

Senior Member
May 4, 2009
311
24
How did you get root to work on restricted profiles? In this mode, AFAIK root doesn't work.

EDIT: Just tried creating a restricted profile and assigned rooted apps like Titanium Backup - it complained no root was found, even though the tablet is rooted.

I'm not sure if this works in a restricted user account. But to get TiB to work in a secondary user account, I had to go into the SuperUser app from the primary user account. Open the settings and select the "Wnable mult-user" checkbox. This is in Chainfire's Super User app. Not sure if other SU apps have this or not.
 

hondoslack

Senior Member
Apr 6, 2009
194
37
Thanks. Based on this I wrote a perl script to fix up all the user/group names after restoring the entire data directory; you may need to change u11 to u10 or whatever the restricted user is on your tablet.

Code:
#! /usr/bin/perl -w                                                                                            
# Script to fix ownership of data directories on restore of Android                                            
# restricted profile.                                                                                          

open (LS, "adb shell \"su -c 'ls -l /data/data'\" |") || die "Failed: $!\n";
while (<LS>) {
      (undef, $owner, $group, undef, undef, $dir) = split(' ');
      $owner =~ s/u0/u11/;
      $group =~ s/u0/u11/;
      system ("adb", "shell", "su -c \"cd data/user/11/$dir && find . \! -type l -print0 | xargs -t -0 chown $owner:$group\"");
}

Just wanted to say your script worked wonderfully. Thanks. Unfortunately, though, Clash of Clans still opened up as if it were a new install :confused: . Anyway, good job!
 

hondoslack

Senior Member
Apr 6, 2009
194
37
Sorry, totally forgot to reply. IIRC, those were the exact same steps I ended up stumbling upon. Glad you found a solution.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    What ever came of this? I too would like to know how to backup data from a restricted profile.

    The apks aren't necessary, as the primary user is the one who's allowed to installed apps anyway, but the data itself is what's important.

    Did the TB team ever respond to you?

    I found a way to do it. It's not very easy, I'm afraid. You need root, busybox, and pretty good familiarity with the command line (adb shell or terminal emulator on the device itself. However with this much typing, I really recommend adb shell...)

    App data for other than the main user is stored at

    /data/user/XX/com.the.application/

    where XX is a number. My restricted user was numbered "10".

    so to backup, just make a tar archive of that directory:
    Code:
    cd /data/user/XX
    tar cf /sdcard/whatevername.tar com.the.application

    to restore,

    Code:
    cd /data/user/XX
    tar xf /sdcard/whatevername.tar
    but, this probably only works for the very same user, because the file ownerships need to match.

    So if it's not the same user, you need to fix the ownership of the restored files, but not the "lib" symlink.

    With the games (the different angry birds...) I cared about had the folders cache, databases, files and shared_prefs. If there are other folders, you need to need to include them too (I'm not sure what folders there can be).

    So to fix the ownership of all those, before extracting the backup (the tar xf command), first see who the owner is:
    Code:
    cd /data/user/XX
    ls -ld com.the.application

    it says something like
    Code:
    drwxr-x--x u11_a89  u11_a89           2013-09-12 23:14 com.the.application

    here the u11_a89 is the important value.

    Then, do the above tar xf command, and run
    Code:
    cd /data/user/XX/com.the.application
    chown uXX_aYY:uXX_aYY .
    find cache databases files shared_prefs | xargs chown uXX_aYY:uXX_aYY

    Where uXX_aYY obviously is the value the ls command showed before.

    By the way, this way you can also copy data from one user to another, e.g. from the main user (who can use titanium backup etc) to the restricted user or the other way around.

    Sorry if I'm not very clear.. maybe someone could make a more understandable guide from this.

    Disclaimer: I tried this on a rooted stock 4.3 nexus 7 (2012). But I think it's the same on any android 4.3 based device. Also, I really only did this with the angry birds games, I don't know if other apps need other tricks. (well except Bad Piggies is different, the data is /sdcard/Android/data/com.rovio.BadPiggies, and it can be copied with a file manager, without root.)
    2
    Thanks. Based on this I wrote a perl script to fix up all the user/group names after restoring the entire data directory; you may need to change u11 to u10 or whatever the restricted user is on your tablet.

    Code:
    #! /usr/bin/perl -w                                                                                            
    # Script to fix ownership of data directories on restore of Android                                            
    # restricted profile.                                                                                          
    
    open (LS, "adb shell \"su -c 'ls -l /data/data'\" |") || die "Failed: $!\n";
    while (<LS>) {
          (undef, $owner, $group, undef, undef, $dir) = split(' ');
          $owner =~ s/u0/u11/;
          $group =~ s/u0/u11/;
          system ("adb", "shell", "su -c \"cd data/user/11/$dir && find . \! -type l -print0 | xargs -t -0 chown $owner:$group\"");
    }
    2
    How did you get root to work on restricted profiles? In this mode, AFAIK root doesn't work.

    EDIT: Just tried creating a restricted profile and assigned rooted apps like Titanium Backup - it complained no root was found, even though the tablet is rooted.

    I'm not sure if this works in a restricted user account. But to get TiB to work in a secondary user account, I had to go into the SuperUser app from the primary user account. Open the settings and select the "Wnable mult-user" checkbox. This is in Chainfire's Super User app. Not sure if other SU apps have this or not.
    1
    Yeah, I thought that too, but couldn't find it. I'll take another look when I get home, maybe I can find a definitive answer and post back.

    Did you find anything on this? I'm trying to backup CoC on a restricted profile as well.

    Edit: found these instructions and they worked great! http://xdaforums.com/showpost.php?p=51352083&postcount=4