I store my audio collection on my NAS which is actually an archive of all the music albums I bought (and ripped using abcde). On my laptop I keep a big subset of the mp3 for daily listening. I also use my laptop to rip my CDs, correct false id3 tags and add cover.jpg files. On my fp2 I have a smaller subset for listening on the road or at work using Vanilla Music player .
I keep all those files in sync over WiFi using sshfs and git-annex. E.g. if I rip a new CD I can push it to my NAS, fp2 or only one of those two. If I fix id3 tags, I can sync the changes with all three locations.
The media files cannot be modified on the fp2. Only read access is possible.
- For a technical explanation see: SSHelper : External Storage Access
- For a philosophical explanation see: SSHelper : User Feedback Page
This how-to won’t go into details but link to other sites for further reading whenever possible. So it’s more a link collection than an actual how-to.
The connection is slow. But within your wifi range you can use your fp2 as usual while files are synced.
Installation and Configuration
- Install SSHelper as explained here. I prefer the direct download link over Google Play Store. Follow the configuration until and including “Making First Contact”.
- Create a ssh config file
~/.ssh/config, so you do not have to enter the whole configuration whenever you want to conntect. Here is mine:
Replace lars-fairphone by your fp2’s hostname or IP addressHostname lars-fairphone
The line below can be commented in after setting up public key authentication#IdentityFile ~/.ssh/id_rsa
I set up a static lease and hostname in my OpenWRT router. So lars-fairphone resolves to my fairphones local IP. How to do this is also explained on the SSHelper website in section More optimizations.
- Start SSHelper on your fp2 and connect to your fp2 using the command
ssh fairphone2. Confirm the key fingerprint with
yon first connection:
The authenticity of host '[lars-fairphone]:2222 ([192.168.17.19]:2222)' can't be established. ECDSA key fingerprint is SHA256:..... Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '[lars-fairphone]:2222' (ECDSA) to the list of known hosts.
exitto terminate the ssh session.
- Set up Public-key (passwordless) logins as explained in the corresponding section on the SSHelper page. Add the line
IdentityFile ~/.ssh/id_rsato your
~/.ssh/configfile. Retry to connect like in step 3. This time it should work using the key.
- Enable External Storage Access as explained in SSHelper : External Storage Access. I only tested with “Method 1: Application Data Directory” for Android 6.0 and newer. (Please note, that with Android 5 and below you can create a file in the /sdcard directory tree, but then you can’t change its permissions or its time stamp, which is essential for the usage with git (annex).)
- Now you can mount your device with sshfs: Create a mountpoint (for testing):
Mount the device:
sshfs fairphone2:/ /tmp/fp2
Try to list its content:
ls -al /tmp/fp2
fusermount -u /tmp/fp2
Remove the mount point:
- Make the mount point permanent. E.g. add it to your
fstabas explained in the Gentoo Linux Wiki.
autofsfor automounting, which is also explained in the Gentoo Linux Wiki. Here is my
And this is the corresponding line in
/mnt/fp2 /etc/autofs/auto.fp2 uid=1000,gid=1000,--ghost
- Use git-annex to add your fp2 as a remote of your local media collection as explained in the git-annex walkthrough
Use the git-annex walkthrough to get familiar with git-annex.