Sonos music using external HD on Raspberry Pi

You can attach an external hard drive to a Raspberry Pi and then share music over Sonos. This works very well. Even though my hard drive is connected to the rPI via USB 2.0, the music streams fine, no stutters.

Right now I’m playing Jeff Buckley’s ‘Sketches for My Sweetheart The Drunk’ all over the house. “Vancouver” track is so awesome!

Technically this kind of storage sharing falls under the term Network Attached Storage (NAS). But, that seems like an overblown term for just sharing one disk. There are a lot of features on a full-blown NAS.

How does the RaspberryPI share the storage? By running a server called Samba. This is a set of open-source programs that run in Unix/Linux to provide file and print services compatible with Windows-based clients.

Spin down?
Currently I’m looking into how to enable spin down of the hard drive when idle. Necessary? Supposed to make HD last longer. I just want to reduce power usage. The whole point of a Raspberry Pi in this scenario.

Maybe this page, “Spin Down and Manage Hard Drive Power on Raspberry Pi”, will help.

Feb 1, 2015
hdparm and sd-idle did not work. trying SDPARM.
sudo blkid
/dev/sda1: LABEL=”USB B” UUID=”B23A8B373A8AF81D” TYPE=”ntfs” PARTUUID=”b75ac8d0-01″

sudo sdparm –flexible –command=stop /dev/sda1
/dev/sda1: ST325082 3AS

Feb 3, 2015
The spin down using sdparm is working fine.

July 5, 2018
My RaspberryPI died. Flash card had some issue. Spent a lot of time recreating my configuration again. The articles I link to on this post did not help much except for the one at “Retro Resolution“.

final Configuration
fstab added line: UUID=B23A8B373A8AF81D /mnt/PIHDD ntfs-3g defaults,nofail,noatime,auto,umask=0002,users/rw,uid=1000,gid=100 0 0
crontab has: /10 * * * * sdparm –command=stop /dev/sda1

Hardware Used

  • Raspberry Pi 2 (Canakit Ulitimate Starter Kit with WIFI)
  • Old USB hub from Staples
  • 3.5 inch 1 GB Hard drive
  • HexStar-3 3.5in External Hard drive enclosure

Technical details
I had a lot of grief getting it to work. Haven’t touched a Linux system in while.

Some articles of the many articles I found information on how to do this are in the links section below. Note that there isn’t one single approach to do this. And, it also depends on what OS your running on Raspberry PI. I’m running Raspbian which I installed via NOOBS; all included in the kit I purchased.

Other articles about this approach:

Got my Raspberry PI's wifi and keyboard configured

Hit a bump getting the wifi dongle working. So I started following some instructions. Now that gave me another problem, the keyboard was not mapped correctly. When I typed a double quote I got an ‘@’ symbol. Turns out that the locale and keyboard were not set correctly for North America.

To fix the locales: Remapping the Keyboard
To fix the keyboard layout this video gave the simplest approach: Raspberry Pi – Change keyboard layout to US from default British layout
To fix the wifi problem this page was the solution: How to Set Up the Ralink RT5370 WiFi Dongle on Raspian

Test … my third monitor is now showing a page on the web. Cool. The Raspberry Pi 2 (Model B) is pretty fast.

May 24, 2015: I was having issues where the device would lock with blank screen and not respond to mouse or keyboard. Looks like the issue is the WI-FI dongle and the USB subsystem in this Linux. The log shows USB errors. Nothing seemed to fix this. The usual suggestion is to use an external powered USB. On a chance I updated the Linux OS and now the system is working fine. I can leave the PI on.