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:

One thought on “Sonos music using external HD on Raspberry Pi”

Leave a Reply

Your email address will not be published. Required fields are marked *