How to copy data from Home to SD card in Recovery Mode

Jolla Care -

The instructions in this article are meant for situations, where the device no longer functions normally, and the Command Line is used to attempt to salvage data from the device. There is no guarantee that saving data with these instructions will succeed.

If your device is in a normal state, i.e. functional, then use Backup utility described in here.

If you are unsure about following these instructions, please contact us and explain to us your situation.

CONTENTS

1 Transferring individual files or folders to the Memory Card

2 Transferring a backup file to the Memory Card
2.1 How to check if there's a backup file in my device memory?

 

1 Transferring individual files or folders to the Memory Card

Enter the Recovery Mode (read this article if you do not know how).
Select option #4 "Shell".

At the shell give the commands to create some mountpoints which make copying from your Jolla to SD card easier. This works for the default memory arrangement in Jolla devices (i.e. you have not created any partitions yourself etc.). It is also assumed that you have formatted the SD card to FAT32.

mkdir -p  /mysd
mkdir -p  /myhome
mount  /dev/mmcblk1p1  /mysd     
mount  -o  subvol=@home  /dev/mmcblk0p28 /myhome

Now check what you have got in to the device (the following lines are examples):

ls -l /myhome/nemo/Documents/*
ls -l /myhome/nemo/Downloads/*
ls -l /myhome/nemo/Music/*
ls -l /myhome/nemo/Pictures/*
ls -l /myhome/nemo/Recordings/*
ls -l /myhome/nemo/Videos/*

ls  /myhome/nemo/.vault  # if exists, this is the backup folder. Consider copying this to your memory card as instructed in Chapter 2 of this article!

Let's make the necessary folders to the SD card:

mkdir /mysd/MyDocs
mkdir /mysd/MyDownloads
mkdir /mysd/MyMusic
mkdir /mysd/MyPics
mkdir /mysd/MyRecordings
mkdir /mysd/MyVideos

Then, copy your data from the device to memory card (the following lines are examples):

cp -r /myhome/nemo/Documents/* /mysd/MyDocs
cp -r /myhome/nemo/Downloads/* /mysd/MyDownloads
cp -r /myhome/nemo/Music/*  /mysd/MyMusic
cp -r /myhome/nemo/Pictures/* /mysd/MyPics
cp -r /myhome/nemo/Recordings/* /mysd/MyRecordings
cp -r /myhome/nemo/Videos/* /mysd/MyVideos

Copy your contacts in vCard format if you had made a backup previously:

cp /myhome/nemo/.vault/People/data/all.vcf /mysd/MyContacts.vcf
# all contacts

If you had not made the backup then try copying your contacts as a database (which implies that you cannot easily use them outside of Jolla but you may be able to restore them back to Jolla later on:

cp -r /myhome/nemo/.local/share/system/privileged/Contacts/qtcontacts-sqlite/ /mysd/MyContactsDB

Consider deleting the copied files from the device memory to make space there. This is important if your device cannot boot up any more (the following lines are examples):

rm -rf /myhome/nemo/Documents/*
rm -rf /myhome/nemo/Downloads/*
rm -rf /myhome/nemo/Music/*
rm -rf /myhome/nemo/Pictures/*
rm -rf /myhome/nemo/Videos/*

Once you have copied everything valuable:

sync
umount  /myhome
umount  /mysd

exit                             # to leave the shell and return to Recovery Mode menu

Take #6 to exit the Recovery Mode.

Detach the battery and USB and then restart your Jolla device.

---------------

Should the approach above fail there might still be a chance to save "some" data to the SD card (which should be at least 16GB in size):

mkdir -p /mysd
mount /dev/mmcblk1p1 /mysd/
btrfs restore -i -v /dev/mmcblk0p28 /mysd/
umount  /mysd


-------------------------
F.Y.I: The original contacts database in Sailfish devices is as follows:
ls -la /home/nemo/.local/share/system/privileged/Contacts/qtcontacts-sqlite/
total 7900
drwxr-xr-x 1 nemo privileged      82 Sep 19 14:27 .
drwxr-xr-x 1 nemo privileged     610 Sep 19 14:26 ..
-rw-r--r-- 1 nemo privileged 6805504 Sep 20 14:17 contacts.db
-rw-r--r-- 1 nemo privileged   32768 Sep 20 14:17 contacts.db-shm
-rw-r--r-- 1 nemo privileged 1248200 Sep 20 14:17 contacts.db-wal

2 Transferring a backup file to the Memory Card

The instructions below are meant for situations where:

  • You know that you have made a backup to the device memory (but haven't transferred it to the memory card)
  • Your device no longer starts up normally or doesn't start up at all.
  • You want to transfer the backup file from the Device Memory to the Memory Card before performing a device reset e.g. in Recovery Mode.

Enter the Recovery Mode (read this article if you do not know how).
Select option #4 "Shell".

Then type in the following lines, pressing enter after each line:

 mkdir  -p  /mysd
 mount  /dev/mmcblk1p1  /mysd
 mkdir -p  /myhome
 mount  -o  subvol=@home  /dev/mmcblk0p28 /myhome
 mkdir -p /mysd/backup/
 cp /myhome/nemo/.vault/ /mysd/backup/

The ".vault" folder's contents should now be visible on your memory card in the  "backup" folder. You might want to make sure of this at this stage, e.g. by browsing your card's contents in Shell (e.g. with commands cd /mysd/backup, and then ls) or, depending on your computer's OS (ie. if you use Linux) directly in the File Manager.

Once it looks like the files are safe, reset your device and update the device at least to the version in which you performed the backup. Return to Recovery Mode and type in the following lines:

 mkdir  -p  /mysd
 mount  /dev/mmcblk1p1  /mysd
 mkdir -p  /myhome
 mount  -o  subvol=@home  /dev/mmcblk0p28 /myhome
 cp /mysd/backup/ /myhome/nemo/

Now as you restart your device you should be able to restore the backup normally from your device's memory.


2.1 How to check if there's a backup file in my device memory?

You can determine this by writing the following commands to Recovery Mode's Shell:

mkdir -p  /mysd
mkdir -p  /myhome
mount  /dev/mmcblk1p1  /mysd     
mount  -o  subvol=@home  /dev/mmcblk0p28 /myhome
ls  /myhome/nemo/.vault

If you see a listing of folders and files, you know that you have a backup file in the device memory. Follow instructions in Chapter 2 to move this file to the memory card. If you receive an error about "no such" file or directory, you know that there's no backup file in your device memory.

Have more questions? Submit a request

Comments

Powered by Zendesk