How to extract data from a 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.

This article is for experienced Linux users only. There is a risk of deleting data and causing damage to the phone.

 

Your backup data resides in Linux archive file sailfish_backup_2017-*.tar ("2017-*" being a variable part containing the date & time). This file must be extracted to get in touch with its contents.  For this task, we can use the Sailfish Terminal app (which appears when the Developer mode is enabled/installed), given that your Sailfish device is functional, or a PC. In the case of Windows PC, install the 7-Zip program (free) first; 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 at what we will be getting. Note that SailfishOS backup has a rather limited content - see chapter "Foreword" 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 the 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 the file 
all.vcf  to the People app.

2. Developer mode

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

Soon you will have the Terminal app at the end of the app grid and your SSH password set. Alternatively,  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. 

Ensure that you have unlocked and mounted your SD card if it happens to be an encrypted one (do it in Settings > Storage).

First of all, let's create a variable for the ID code of your SD card:

export MYSD=$(ls /run/media/$USER)

Let's check if there is a backup file on the SD card:

ls /run/media/$USER/$MYSD

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

cd /run/media/$USER/$MYSD
mkdir tmp
#### Replace "sailfish_backup_2017*.tar" with #### the real and complete file name below!

# Next, we extract the contents of the backup container to subdirectory 'tmp'. tar -xvf sailfish_backup_2017*.tar -C tmp/ ls -al tmp/

Now you have extracted the backup contents to the folder  /run/media/$USER/$MYSD/tmp  on 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 the 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 the People app now. Note that the import utility of the 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 to be in any specific folder.

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

 

4.2. Pictures and videos

The pictures and videos extracted from the backup archive can be seen in the 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
Powered by Zendesk