We have moved to a new Sailfish OS Forum. Please start new discussions there.
3

[How-to] Mount Sailfish System and SD Card on Android

asked 2019-02-11 04:51:12 +0300

Levone1 gravatar image

updated 2019-02-12 03:50:52 +0300

I would like to have a really nice file manager on Sailfish, but right now it's a waiting game. In the meantime, many things can be accomplished mounting Sailfish root system onto Android storage, so you can use some really good Android file manager, (like my favorite, Mixplorer), to browse, copy/paste, etc., your Sailfish system and sd card.

For Sailfish root directory, (assuming you made a new folder in /home/nemo/android_storage called 'Mnt', and you're using terminal with root): mount --bind / /home/nemo/android _storage/Mnt

For sd card, (assuming you made a new folder in /home/nemo/android_storage called 'sd', and you're using terminal with root, and your sd card is named '688E-0FE4', [which it won't be - you'll have to change that part to match the name of yours]): mount --bind /run/media/nemo/688E -0FE4 /home/nemo/android_storage/sd

Done. (You'll have to do it after each reboot, unless you know how to write a startup script for it, [I don't])

Update - I got mount-at-boot working with cron, thanks to help from @ade.

  • create a script with the commands above, and copy to /usr/local/bin, (or somewhere - that's just where I put it), and set permissions 0755
  • install vixie-cron from Openrepos, open yerminal with root, and type crontab -e A vim window will open with a blank documemt. type @reboot sleep 30;/usr/local/bin/(script).sh
  • save and quit. Folders will be mounted on reboot

image description

edit retag flag offensive close delete

Comments

That's a cool idea.

santhoshmanikandan ( 2019-02-11 07:35:58 +0300 )edit

Also, I was able to get a one-click solution working with Shellex app, using sudo with a modified sudoers file, (Shellex doesn't run root as-is). I can post details if anyone wants ...

Levone1 ( 2019-02-12 00:31:17 +0300 )edit

3 Answers

Sort by » oldest newest most voted
2

answered 2019-02-12 12:52:36 +0300

Baldur gravatar image

updated 2019-02-12 14:26:11 +0300

More elegant way to automatically mount the SD card for Alien Dalvik using SystemD mounts:

Gets mounted after SD-card is mounted and Alien Dalvik is up.

Gets unmounted if Alien Dalvik goes down.

Gets remounted when both are again up.

So survives Alien Dalvik resets etc.

How:

Put following into file: /etc/systemd/system/home-nemo-android_storage-sd.mount

[Unit]
Description=SD card under android_storage
After=mount-sd@mmcblk1p1.service run-media-nemo-688E-0FE4.mount aliendalvik.service
BindsTo=mount-sd@mmcblk1p1.service run-media-nemo-688E-0FE4.mount aliendalvik.service
RequiresMountsFor=/run/media/nemo/688E-0FE4/ /home/nemo/android_storage/
Conflicts=rescue.target actdead.target factory-test.target

[Mount]
What=/run/media/nemo/688E-0FE4/
Where=/home/nemo/android_storage/sd/
Options=bind

[Install]
WantedBy=mount-sd@mmcblk1p1.service run-media-nemo-688E-0FE4.mount aliendalvik.service

Test with following command as root:

systemctl start home-nemo-android_storage-sd.mount

Enable the mount permanently with following command as root:

systemctl enable home-nemo-android_storage-sd.mount

For changes:

Replace all instances of "688E-0FE4" with your SD card volume name.

"Where=" is the target where to mount.

.mount file name under /etc/systemd/system needs to be the mounts target with "/":s replaced with "-":s and ending with ".mount".

"Description=" is what is shown in logs, with "Mounting [description]..."

Use the correct .mount file name with the systemctl commands.


Personally used this to move specific Android apps data to SD card.

Here WeGo example, with my SD volume named "SDCard" and files going under "Android" directory on SD card:

/etc/systemd/system/home-.android-data-media-0-Android-data-com.here.app.maps.mount

[Unit]
Description=Here WeGo data directory on SD card
After=mount-sd@mmcblk1p1.service run-media-nemo-SDCard.mount aliendalvik.service
BindsTo=mount-sd@mmcblk1p1.service run-media-nemo-SDCard.mount aliendalvik.service
RequiresMountsFor=/run/media/nemo/SDCard/ /home/nemo/android_storage/
Conflicts=rescue.target actdead.target factory-test.target

[Mount]
What=/run/media/nemo/SDCard/Android/com.here.app.maps/
Where=/home/.android/data/media/0/Android/data/com.here.app.maps/
Options=bind

[Install]
WantedBy=mount-sd@mmcblk1p1.service run-media-nemo-SDCard.mount aliendalvik.service

Enabled with:

systemctl enable home-.android-data-media-0-Android-data-com.here.app.maps.mount

For multiple mounts: Just add separate .mount file for each bind mount and enable them.

Might need more work for encrypted SD cards and to work with unmounting and remounting SD card. Probably need to change the "mount-sd@mmcblk1p1.service":s to something like "run-media-nemo-SDCard.mount".


EDIT: Original version, without the "run-media-nemo-[volumename].mount":s, ended up trashing some of the Android App data when SD card was unmounted via Settings app Storage while bind mounts were still up, because the bind mounts stayed mounted. This also prevented remounting the card at the same place without reboot.

New version unmounts the bind mounts on SD card unmount, but doesn't remount them automatically. They get remounted when Alien Dalvik is restarted. Haven't been able to replicate the data loss after this change.

Settings app unmount and remount don't seem to use SystemD but instructs udisksd. And the .mount dependency doesn't seem to be enough to trigger remount either. So I'm not seeing quick way to get this working with encrypted SD cards or remounting the bind mounts on SD card remount.

edit flag offensive delete publish link more

Comments

Nice, thanks...

Levone1 ( 2019-02-12 13:39:00 +0300 )edit

Thanks, but on my XA2 Plus I got the following error:

[root@Sailfish nemo]# systemctl start home-nemo-android_storage-sd.mount
Failed to start home-nemo-android_storage-sd.mount: Unit run-media-nemo-5BF9-ACBA.mount failed to load: No such file or directory.

But ls /run/media/nemo/5BF9-ACBA/ shows some content. Do you have any ideas?

caesium ( 2019-04-09 20:29:20 +0300 )edit

Thank you very much for this solution. I also tried this on a XA2 Plus. But there is one issue.Similar to caesium I get (btw: I change sd to sdcard):

[root@Sailfish system]# systemctl start home-nemo-android_storage-sdcard.mount Failed to start home-nemo-android_storage-sdcard.mount: Unit run-media-nemo-e325357e-c7e2-4c50-a4bd-5ff8ffac9862.mount failed to load: No such file or directory.

[root@Sailfish system]# systemctl status home-nemo-android_storage-sdcard.mount -l home-nemo-android_storage-sdcard.mount - SD card under android_storage Loaded: loaded (/etc/systemd/system/home-nemo-android_storage-sdcard.mount; disabled; vendor preset: enabled) Active: inactive (dead) Where: /home/nemo/android_storage/sdcard What: /run/media/nemo/e325357e-c7e2-4c50-a4bd-5ff8ffac9862/

And indeed there is no file run-media-nemo-e325357e-c7e2-4c50-a4bd-5ff8ffac9862.mount on /etc/systemd/system. This folder has only: [root@Sailfish system]# ll total 28 drwxr-xr-x 2 root root 4096 May 6 14:33 basic.target.wants drwxr-xr-x 2 root root 4096 Jun 18 16:11 display.service.wants drwxr-xr-x 2 root root 4096 Mar 28 04:32 getty.target.wants drwxr-xr-x 2 root root 4096 Jun 18 16:11 graphical.target.wants -rwxr-xr-x 1 root root 679 Jun 23 11:40 home-nemo-android_storage-sdcard.mount drwxr-xr-x 2 root root 4096 May 6 14:34 local-fs.target.wants drwxr-xr-x 2 root root 4096 Jun 18 16:11 multi-user.target.wants lrwxrwxrwx 1 root root 51 May 6 14:34 nemo-devicelock.service -> /lib/systemd/system/jolla-devicelock-encsfa.service lrwxrwxrwx 1 root root 34 May 6 14:34 runlevel4.target -> /lib/systemd/system/actdead.target

Do you have an idea how to solve this problen? Thany you very much in advance and best regards, Uwe.

UweLabs ( 2019-06-23 16:36:33 +0300 )edit

sorry for not formatting the programmatical things in my comment above. (How is this done?) Uwe.

UweLabs ( 2019-06-23 16:39:23 +0300 )edit
2

answered 2019-02-12 23:19:16 +0300

olf gravatar image

updated 2019-02-13 00:55:52 +0300

Sorry, I do not comprehend why this is necessary (but maybe I am missing an aspect):

  • The original "issue" does not exist for many Android file managers, e.g. OI Filemanager or Ghost Commander: One can browse the "whole filesystem" with them.
    Yes, everything outside android_storage is read only, but that is a deliberately employed security barrier to prevent Android apps altering files outside of android_storage. The SD-card is accessible at its usual location /run/media/nemo/ (since SailfishOS 2.2, was at /media/sdcard/ before).
  • If space on internal eMMC is of concern (and the reason why one wants to move the data of Android apps to SD-card), it is easier (and "cleaner") to move the whole android_storage to SD-card, as none of the Android apps has to be configured to use a different storage location individually, then.
edit flag offensive delete publish link more

Comments

I'm less of an expert than anyone. I just want a good file manager that I can use with all of the files, (Jolla, Android, and sd card), and I find the Sailfish file managers generally unpleasant to use for many applications, so my goal was to have all files accessible with one fully-featired file manager without having to mount it manually every time. This is what I came up with, so I figure I'd share, in case anyone else would appreciate it. I hadn't heard of the 2 apps you mentioned before, so maybe that would have been good enough... I have been a long fan of Mixplorer, so wanted to find a way to use it. Not sure of the functioms/features of the apps you mentioned, but with Mix, I can add my Mega, Dropbox, ftp, etc., and the UI is the best I've ever used, and entirely customizable .

Levone1 ( 2019-02-13 01:28:44 +0300 )edit
1

@olf you have said it all, impossible to improve from that, thumps up. Plus it is worth mentioning that Xplore version 3.9 I use with my android_storage mounted on my sdcard and it can created folders and copy files to nemo, but the permissions are all messed up and invisible both on nemo and windows

DameCENO ( 2019-02-15 13:56:16 +0300 )edit
0

answered 2019-02-13 15:10:58 +0300

Thanks for this

edit remove flag flag offensive (2) delete publish link more

Comments

Either up vote the original post or leave a comment, please refrain from using Answer boxes for comments, thanks.

Spam Hunter ( 2019-02-13 17:58:19 +0300 )edit

@Edz, just realised by clicking on @KresusLukas "home page" link, that this posting was just a spamming preparation.

olf ( 2019-02-13 23:51:34 +0300 )edit
Login/Signup to Answer

Question tools

Follow
7 followers

Stats

Asked: 2019-02-11 04:51:12 +0300

Seen: 2,121 times

Last updated: Feb 13 '19