Project

General

Profile

BackupTheDataPartition » History » Version 3

Denis 'GNUtoo' Carikli, 10/28/2020 04:40 PM

1 1 Denis 'GNUtoo' Carikli
h1. How to backup the data partition
2
3
{{toc}}
4
5
h2. /!\ Warning: Draft
6
7
This article is in draft form and is being written:
8
* Everybody is welcome to contribute
9
* Some things might not be accurate yet, so beware before using the information contained in it.
10
11
Also a big part of this article is copied from [[BackupTheEFS]], it would be better to find a way to include content instead.
12
13 3 Denis 'GNUtoo' Carikli
h2. What does the data partition contains?
14 1 Denis 'GNUtoo' Carikli
15
Many Android devices have a data partition.
16
17
If is used for several distinct things that are often mounted in different locations at the same time (through fuse).
18
19
| Mount points    | Content |
20
| /data/          | Applications (internal) data |
21
| /sdcard
22
  /storage/<UUID> | User accessible storage to store music, photos, etc |
23
24 2 Denis 'GNUtoo' Carikli
Here's where the sdcard user accessible storage comes from:
25
26
/sdcard -> /storage/self/primary [1]
27
/storage/self/primary -> /mnt/user/0/primary [2]
28
/mnt/user/0/primary -> /storage/emulated/0 [3]
29
30
31
fn1. <pre>root@i9300:/ # readlink /sdcard                                                                                                                            
32
/mnt/user/0/primary</pre>
33
34
fn2. <pre>root@i9300:/ # readlink /storage/self/primary                                                                                                              
35
/mnt/user/0/primary</pre>
36
37
fn3. <pre>root@i9300:/ # readlink /mnt/user/0/primary                                                                                                                  
38
/storage/emulated/0</pre>
39
40
fn4. <pre>root@i9300:/ # mount | grep "/storage/emulated"                                                                                                              
41
/dev/fuse on /storage/emulated type fuse (rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other)</pre>
42
43
44 1 Denis 'GNUtoo' Carikli
TODO:
45
* Explain that the user accessible storage is not always present
46
* Explain that it depends on the devices (GTA04)
47
48
h2. Concerns about the application internal data
49
50
TODO:
51
* Explain the issue about the Replicant version <-> application data
52
53
54
h2. Howto
55
56
TODO: 
57
* Link to the EFS backup first part
58
59
h4. Galaxy S III (GY-I9300)
60
61
First, you need to make sure that the data partition is not mounted. 
62
63
To do that, you can run this command:
64
<pre>
65
adb shell "umount -l /data"
66
</pre>
67
68
If the /data partition was mounted, it will unmount it. This will look like that:
69
<pre>
70
$ adb shell "umount -l /data"
71
$ 
72
</pre>
73
74
If it was not mounted, it will instead show an error that we can ignore:
75
<pre>
76
$ adb shell "umount -l /data"
77
umount: /data: Invalid argument
78
</pre>
79
80
Once this is taken care of, we can backup the partition with the following command:
81
<pre>
82
adb pull /dev/block/platform/dw_mmc/by-name/USERDATA ./
83
</pre>
84
85
h2. See also
86
87
* 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.