Ask / Submit
3

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

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

Levone1 gravatar image

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

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 +0200 )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 +0200 )edit

3 Answers

Sort by » oldest newest most voted
2

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

olf gravatar image

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

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 +0200 )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 +0200 )edit
1

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

Baldur gravatar image

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

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 +0200 )edit
0

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

Thanks for this

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

Comments

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

Edz ( 2019-02-13 17:58:19 +0200 )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 +0200 )edit
Login/Signup to Answer

Question tools

Follow
6 followers

Stats

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

Seen: 369 times

Last updated: Feb 13