Jolla Android On SD-Card
Table of Contents
Summary #
The Jolla has 16 GB internal disk space which is filled by Android apps like OsmAnd and Spotify pretty fast.
Thus I’ve developed a way to move the data of these apps to sd-card.
Main #
All of the following commands have to be run as root.
Thus you have to be careful otherwise you’ll break your phone.
If you follow these instructions you’ll move all data saved by Android apps running on the SailfishOS of a Jolla to the sd-card of your phone.
That way you might use up to 64 GB of disk space for maps, media files and everything else stored by Android apps.
Dependencies #
- a Jolla phone ;D
- SailfishOS >= 1.0.7.16 (earlies versions might work but aren’t tested)
- Dev-Mode enabled
- password to become root
- SD-Card with enough space
- some Linux knowledge
Instructions #
The following instructions use the following settings:
- sd-card contains 1 partition
- the partition device is mmcblk1p1
If your setting differs from these you have to change the corresponding commands.
-
insert the sd-card into your phone
-
start terminal
-
change to root user:
devel-su -
check whether card was found:
ls /dev/mmcblk1- the card was found if the output is
/dev/mmcblk1 - if an error is thrown the card wasn’t found -> you have to reboot your phone
- the card was found if the output is
-
check whether the card is mounted
mount | grep mmcblk1-
the card is mounted if the output is like
/dev/mmcblk1p1 on /media/sdcard/<UUID_of_partition> type btrfs (rw,nosuid,nodev,noexec,noatime,dirsync,thread_pool=4,ssd,noacl,space_cache) -
the card isn’t mounted if the output is empty
-
-
if the card is mounted unmount all partitions of it
umount /dev/mmcblk1p1 -
format the partition you want to use for Android data ⚠️ all data will be lost ⚠️
mkfs.btrfs /dev/mmcblk1p1 -
mount sd-card:
mount-sd.sh add mmcblk1p1- the partition will be mounted on
/media/sdcard/<UUID_of_partition>
- the partition will be mounted on
-
stop all Android apps
-
stop Android layer
systemctl stop aliendalvik -
copy existing data of apps
rsync -a --progress /data/media/ /media/sdcard/"$(blkid -o value -s UUID /dev/mmcblk1p1)"/android_storage/ -
correct the permissions
chown -R media_rw: /media/sdcard/"$(blkid -o value -s UUID /dev/mmcblk1p1)"/android_storage/ chmod -R 770 /media/sdcard/"$(blkid -o value -s UUID /dev/mmcblk1p1)"/android_storage/ -
create systemd-service file
echo "[Unit] Description=Mount sd for android After=mount-sd@mmcblk1p1.service [Service] Type=oneshot RemainAfterExit=yes ExecStart=/usr/local/sbin/mount-sd4android.sh start ExecStop=/usr/local/sbin/mount-sd4android.sh stop [Install] WantedBy=graphical.target display.service" > /etc/systemd/system/mount-sd4android.service -
create helper script
echo '#!/bin/bash sd_uuid="$(blkid -o value -s UUID /dev/mmcblk1p1)" if [ "$1" == "start" ] then systemctl stop aliendalvik mount -o bind /media/sdcard/"${sd_uuid}"/android_storage /data/media systemctl start aliendalvik elif [ "$1" == "stop" ] then systemctl stop aliendalvik umount /data/media fi' > /usr/local/sbin/mount-sd4android.sh -
change permission of helper script
chmod ug+x /usr/local/sbin/mount-sd4android.sh -
enable systemd-service
systemctl enable mount-sd4android.service -
reboot your phone
reboot -
start terminal
-
check if all went well
df -hT-
all is ok if the output looks like:
/dev/mmcblk1p1 btrfs 30G 8.4G 21G 29% /media/sdcard/4f1f8dbc-ed55-4b6c-8290-ac97e15b221f /dev/mmcblk1p1 btrfs 30G 8.4G 21G 29% /data/media /dev/fuse fuse 30G 8.4G 21G 29% /home/nemo/android_storage
-
-
if all went well delete the old data
devel-su mount-sd4android.sh stop rm -rf /data/media/* mount-sd4android.sh start