Project

General

Profile

BackupTheDataPartition » History » Version 6

Denis 'GNUtoo' Carikli, 10/28/2020 04:53 PM
Add /sdcard location in data/

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 4 Denis 'GNUtoo' Carikli
It probably depends on the devices and the Android versions.
16 1 Denis 'GNUtoo' Carikli
17 4 Denis 'GNUtoo' Carikli
On Replicant 6.0, it contains at least the application internal data: When various applications are installed, they have access to some storage where they can read and write data that is only visible to them and not to other applications. This is part of the Android security model that doesn't trust applications even if they are fully free software.
18
19 6 Denis 'GNUtoo' Carikli
In addition, on some devices it also contains the users data. This location and external microSD cards is where users typically their files like Music, photos, etc. This data is made accessible to the users in various location through a mechanism called fuse. In Replicant 6, this data is stored in the media directory in the data partition.
20 1 Denis 'GNUtoo' Carikli
21 4 Denis 'GNUtoo' Carikli
Summarry:
22 1 Denis 'GNUtoo' Carikli
| Mount points    | Content |
23
| /data/          | Applications (internal) data |
24
| /sdcard
25
  /storage/<UUID> | User accessible storage to store music, photos, etc |
26 2 Denis 'GNUtoo' Carikli
27
Here's where the sdcard user accessible storage comes from:
28
29
/sdcard -> /storage/self/primary [1]
30
/storage/self/primary -> /mnt/user/0/primary [2]
31
/mnt/user/0/primary -> /storage/emulated/0 [3]
32
33
fn1. <pre>root@i9300:/ # readlink /sdcard                                                                                                                            
34
/mnt/user/0/primary</pre>
35
36
fn2. <pre>root@i9300:/ # readlink /storage/self/primary                                                                                                              
37
/mnt/user/0/primary</pre>
38
39
fn3. <pre>root@i9300:/ # readlink /mnt/user/0/primary                                                                                                                  
40
/storage/emulated/0</pre>
41
42
fn4. <pre>root@i9300:/ # mount | grep "/storage/emulated"                                                                                                              
43
/dev/fuse on /storage/emulated type fuse (rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other)</pre>
44
45
46 1 Denis 'GNUtoo' Carikli
TODO:
47
* Explain that the user accessible storage is not always present
48
* Explain that it depends on the devices (GTA04)
49
50
h2. Concerns about the application internal data
51
52
TODO:
53
* Explain the issue about the Replicant version <-> application data
54
55
56
h2. Howto
57
58
TODO: 
59
* Link to the EFS backup first part
60
61
h4. Galaxy S III (GY-I9300)
62
63
First, you need to make sure that the data partition is not mounted. 
64
65
To do that, you can run this command:
66
<pre>
67
adb shell "umount -l /data"
68
</pre>
69
70
If the /data partition was mounted, it will unmount it. This will look like that:
71
<pre>
72
$ adb shell "umount -l /data"
73
$ 
74
</pre>
75
76
If it was not mounted, it will instead show an error that we can ignore:
77
<pre>
78
$ adb shell "umount -l /data"
79
umount: /data: Invalid argument
80
</pre>
81
82
Once this is taken care of, we can backup the partition with the following command:
83
<pre>
84
adb pull /dev/block/platform/dw_mmc/by-name/USERDATA ./
85
</pre>
86
87
h2. See also
88
89
* 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.