Project

General

Profile

BackupTheDataPartition » History » Revision 3

Revision 2 (Denis 'GNUtoo' Carikli, 10/28/2020 04:39 PM) → Revision 3/39 (Denis 'GNUtoo' Carikli, 10/28/2020 04:40 PM)

h1. How to backup the data partition 

 {{toc}} 

 h2. /!\ Warning: Draft 

 This article is in draft form and is being written: 
 * Everybody is welcome to contribute 
 * Some things might not be accurate yet, so beware before using the information contained in it. 

 Also a big part of this article is copied from [[BackupTheEFS]], it would be better to find a way to include content instead. 

 h2. What does the data partition contains? Introduction 

 Many Android devices have a data partition. 

 If is used for several distinct things that are often mounted in different locations at the same time (through fuse). 

 | Mount points      | Content | 
 | /data/            | Applications (internal) data | 
 | /sdcard 
   /storage/<UUID> | User accessible storage to store music, photos, etc | 

 Here's where the sdcard user accessible storage comes from: 

 /sdcard -> /storage/self/primary [1] 
 /storage/self/primary -> /mnt/user/0/primary [2] 
 /mnt/user/0/primary -> /storage/emulated/0 [3] 


 fn1. <pre>root@i9300:/ # readlink /sdcard                                                                                                                             
 /mnt/user/0/primary</pre> 

 fn2. <pre>root@i9300:/ # readlink /storage/self/primary                                                                                                               
 /mnt/user/0/primary</pre> 

 fn3. <pre>root@i9300:/ # readlink /mnt/user/0/primary                                                                                                                   
 /storage/emulated/0</pre> 

 fn4. <pre>root@i9300:/ # mount | grep "/storage/emulated"                                                                                                               
 /dev/fuse on /storage/emulated type fuse (rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other)</pre> 


 TODO: 
 * Explain that the user accessible storage is not always present 
 * Explain that it depends on the devices (GTA04) 

 h2. Concerns about the application internal data 

 TODO: 
 * Explain the issue about the Replicant version <-> application data 


 h2. Howto 

 TODO:  
 * Link to the EFS backup first part 

 h4. Galaxy S III (GY-I9300) 

 First, you need to make sure that the data partition is not mounted.  

 To do that, you can run this command: 
 <pre> 
 adb shell "umount -l /data" 
 </pre> 

 If the /data partition was mounted, it will unmount it. This will look like that: 
 <pre> 
 $ adb shell "umount -l /data" 
 $  
 </pre> 

 If it was not mounted, it will instead show an error that we can ignore: 
 <pre> 
 $ adb shell "umount -l /data" 
 umount: /data: Invalid argument 
 </pre> 

 Once this is taken care of, we can backup the partition with the following command: 
 <pre> 
 adb pull /dev/block/platform/dw_mmc/by-name/USERDATA ./ 
 </pre> 

 h2. See also 

 * The [[BackupsResearch]] page has information on why the backup is done this way. It might also be useful to read and contribute to it if you intend to change the way the backups are done.