Saturday, June 01, 2019

Raspberry Pi As Media Server

I'm mounting my media hard drive containing music, photos, and file backups to my Raspberry Pi 3 B+. I'm putting some resources here to remember how I set it up and some leads to fix a bug I'm experiencing, namely that the Raspi won't encode accented characters and replaces them with question marks, so iTunes can't find the files for those songs or the artist folder in the library.

Mount a USB Drive

This gets the USB drive mounted and automatically mounts it on reboot.
This other article has LOTS more.
There was an ongoing issue with the pi giving write permissions to SSH user account listed in the samba.conf file. I think it is fixed with 'sudo chmod -R 775 /mnt/usbstorage' as finally I have the ability to change files and folders through smb on the Mac. Hopefully it lasts. I was confused for a while because the first command in the first link, 'sudo chown -R pi:pi /mnt/usbstorage', was outputting 'Operation not permitted' for all files recursively.

Set up Samba Fileserver

This article does the trick.
Here are my settings in /etc/samba/smb.conf
[iTunes music]
Comment = Pi shared folder
Path = /mnt/usbstorage/iTunes
Browseable = yes
Writeable = Yes
only guest = no
create mask = 0777
directory mask = 0777
Public = yes
Guest ok = no

Character Problem

Here's what I've tried so far:
  • adding global charset in smb.conf file as per Andyroo suggestion. The OP suggestion to change drive format from vfat to extFS does not seem workable as I'd have to back up the whole drive, reformat it, then copy it back. Big pain, but maybe that's ultimately the solution.
  • Also tried reconfiguring the locale, that did not help. 

The Fix

Andyroo suggested mounting the drive with '-o utf8' and it worked! iTunes is happy now, and all accented characters show up properly over SSH. So to mount I use sudo mount -o utf8 /dev/sda1 /mnt/usbstorage.
Now that I got that all working we'll see what new adventures are in store once Apple makes its next move with iTunes...

No comments :