How to extract some data from Backup archive

Jolla Care -

 

Sailfish OS saves the backup data in an archive to the SD card of the device (or to a cloud service like Dropbox). This article explains how to extract data from the backup archive, should there be a need to do so.

The need may arise for instance if it turns out not to be possible to restore the backup data using Settings > Backup.

Your backup data resides in Linux archive file sailfish_backup_2017-*.tar ("2017-*" being a variable part). This file must be extracted to get in touch with its contents.  For this task we can use Sailfish Terminal app (which appears when the Developer mode is enabled/installed), given that your Sailfish device is functional, or a PC . In case of Windows PC first install 7-Zip program (free); if you have a Linux PC then the default setup will have the tools to extract.

1.  Contents of the archive

We will extract the file a bit later. Let's first look what we will be getting. Note that SailfishOS backup has a rather limited content - see chapter "Preword" in this help article.

The following shows a sample output from an extracted folder tree.

[root@Sailfish tmp]# ls -al
total 384
drwxr-xr-x 11 nemo nemo 32768 Oct 28 19:16 .
drwxr-xr-x 17 nemo nemo 32768 Nov  1 14:50 ..
drwxr-xr-x  4 nemo nemo 32768 Oct 28 19:01 Accounts
drwxr-xr-x  4 nemo nemo 32768 Oct 28 19:01 Browser
drwxr-xr-x  4 nemo nemo 32768 Oct 28 19:01 Calendar
drwxr-xr-x  4 nemo nemo 32768 Oct 28 19:01 Gallery
drwxr-xr-x  4 nemo nemo 32768 Oct 28 19:01 Media
drwxr-xr-x  4 nemo nemo 32768 Oct 28 19:01 Messages
drwxr-xr-x  4 nemo nemo 32768 Oct 28 19:01 Notes
drwxr-xr-x  4 nemo nemo 32768 Oct 28 19:01 People
drwxr-xr-x  4 nemo nemo 32768 Oct 28 19:01 Phone
[root@Sailfish tmp]#

Hence there is a folder for each application basically.
Let's look at People folder.

[root@Sailfish tmp]# cd People
[root@Sailfish People]# ls -al
total 128
drwxr-xr-x  4 nemo nemo 32768 Oct 28 19:01 .
drwxr-xr-x 11 nemo nemo 32768 Oct 28 19:16 ..
drwxr-xr-x  2 nemo nemo 32768 Oct 28 19:01 blobs
drwxr-xr-x  2 nemo nemo 32768 Oct 28 19:01 data
[root@Sailfish People]#
[root@Sailfish People]# cd data
[root@Sailfish data]# ls -al
total 96
drwxr-xr-x 2 nemo nemo 32768 Oct 28 19:01 .
drwxr-xr-x 4 nemo nemo 32768 Oct 28 19:01 ..
-rwxr-xr-x 1 nemo nemo  1402 Oct 28 19:01 all.vcf

Subfolder  People/data  contains the file  all.vcf  which contains local contacts. Local means the contacts created in the phone (i.e. they have not been synchronised up/down to/from a cloud service e.g. Google).  Once you have extracted the backup archive (like instructed below), then you go "Settings > Apps > People" and tap  "From contact file". The import wizard will then copy the contacts from  all.vcf  to People app.

2. Developer mode

You need to enable the Developer mode (link to a help article). Follow this article.

Soon you will have Terminal app in the end of the app grid and your SSH password set. Alternatively, if you know how, you could use SSH to connect from PC to phone.  We use the Terminal app here.

 

3. How to extract

Open Terminal. Increase the font size (at the top right corner). Give the commands below, one-by-one. 

ls /media/sdcard

Check the unique ID of your SD card (NNNN-NNNN, where each N can be 0...9 or A...F) from the output above. Keep it in mind (at least the first character). Add it to the following command.

ls /media/sdcard/NNNN-NNNN

You should see one or more  sailfish_backup-*.tar files.  Use that file name in the commands below.

#### Replace NNNN-NNNN with the actual ID of 
#### your SD card below!
cd /media/sdcard/NNNN-NNNN mkdir tmp
#### Replace "sailfish_backup_2017*.tar" with #### the real complete file name below!
tar -xvf sailfish_backup_2017*.tar -C tmp/ ls -al tmp/

Now you have extracted the backup contents to folder  /media/sdcard/NNNN-NNNN/tmp  in your SD card. The output from the last command should be similar to the first block under chapter 2.1.

4. How to use the extracted data - some examples

4.1. Importing contacts

A typical use case would be to extract contacts from a backup archive and import them to Sailfish People app.  In chapter 3 we extracted the contacts from the backup archive to a folder in the SD card. It is easy to import them to People app now. Note that the import utility of People app can find the contact file (vcf) from (almost) anywhere in the memory space of the device and the memory card - the file needs not be in any specific folder.

Go to "Settings > Apps > People" and tap  "From contact file". The import wizard can find file all.vcf in your SD card and copy the contacts to People app.

4.2. Pictures and videos

The pictures and videos extracted from the backup archive can be seen in folder

ls -al tmp/Gallery/blobs

You can copy them to another location using Terminal, File Browser app or your PC.

 

Have more questions? Submit a request

Comments

Powered by Zendesk