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:

Sonos unable to add folder due to Kapersky firewall

On laptop I tried to add a local folder on C drive to Sonos. The Sonos controller on the same laptop gave the 1002 error code. This is a timeout?

Tried to find solution on web. Firewall had no issues and anti virus software wasn’t doing anything strange. Just in case, I turned off file scanning. Still have issue. Turned off the Windows firewall; still have problem.

Long story short, Kapersky has a firewall running, doh! Turned that off, Sonos can read local folder. Makes no sense. Why would a firewall block a local app from local folder? Probably because the local Sonos controller has to update the local network with that folder so that other controllers in house can also use it.

Sonos support page on error code 1002

Sonos Wireless HIFI system setup

It was time to upgrade our home music system. The Sonos system met the requirements. At the store I compared Play:5 sound to a Bose system. The Bose sound seemed slightly better, at least with the demo music it was using, but appeared (at the store) to be an iPhone based system and I use an Android smartphone. Since I don’t listen to pop music, and excess bass, I picked the Sonos and don’t regret it.

Setup is easy
Installing was pretty easy. Connect a Sonos Bridge (a separate purchase) to the network, install the Sonos controller app on the smartphone, press a button on the bridge and then on the player. Now you can control the player. The app is not bad. (The current version 4.1 is awesome).

April 19, 2014: I just saw on news that Sonos is thinking of not requiring the Bridge component: Our Vision for Rock-Solid Wireless, Evolved.

Accessing a folder
So far so good. This is where the problems began. How to access my music on the Windows 7 PC? No matter what I tried, could not access a shared folder. Opened up firewalls, looked at ports, etc. Looked like router issues. Luckily I still had my old wifi router switch that I was using before FIOS was installed to replace cable. I connected that router to the new primary router using a Cascade configuration. I set the music folder on the PC Shared access and tried again. it worked! I can see the file folders now. Not really sure what really made it work. Now I have yet another tangle of wires.

So, what do I have now. I can control Sonos using my Samsung Note running the free Sonos app. The Sonos sounds great. The access to music is fast. In contrast, trying to access music folders using DLNA is torture using my networked Sony TV.

PC Controller won’t install
See solution below.

I tried installing the Sonos controller on Windows. At one step it asks that you press a button on a Sonos component on the network. I press the button on the Bridge, the software says, I found it, then it attempts to set up the connection. Finally, it says it did not find anything. Doh!

Before you get a Sonos check the network hardware compatibility. Unfortunately, the solution offered on this page makes no sense:
“A third party wireless access point is needed. Sonos Controller for iPhone or SONOS CONTROL that are wireless should be associated to this third party access point and not the Actiontec/Qwest.” Ok, how?

Things I tried:
– Connecting the PC directly to the bridge, then the bridge to the old router. Same problem.
– Turning off Windows firewall. Nope.
– Reinstall of controller. Nope.
– Firewall in the router. Tried once, and router ceased working. Had to reset it and configure my network. Yeech. Do non-computer literate people buy this stuff?

I did not try turning off the WIFI in the Actiontec router. I’m surprised Fios is installing this router that may have issues.

Do I return the system? One part of it doesn’t work, the PC software. I got used to the sound and the ease of access to music and radio. Pandora is awesome on this.

PC Controller install SOLVED!
Turns out the Sonos system was trying to use a second network adapter running on my PC, VirtualBox Host-Only Network. Once I disabled that, the Sonos controller installed. I found the solution here, Using a Sonos Desktop Controller with a VPN or VMware adapters.

If you have the Android app do you really even need the PC Sonos controller. Yes! The phone app is good but nothing competes with a large fast easy to use system.

Now I’m piqued, is there any way to associate the controller with a specific adapter? Why doesn’t this cause problems elsewhere? So, if I have to run my Ubuntu in VirtualBox I can’t also run my Sonos controller in the Windows PC?

Update: August 31, 2013: Strange I can now run Sonos controller on PC while running Ubuntu Linux in a Virtual Box. No network issues. Hmmm.

Laptop Controller install not solved
While the PC controller install now works, the install on a laptop that is connected to network via WIFI does not. I think I will try disabling the WIFI on the actiontec and just using the WIFI on the LinkSys router. Will update when I find out if this works.


  • Windows 7 64bit
  • router: Actiontec MI424WR
  • router: linksys WRT54GS
  • Sonos: Player:5
  • Sonos: Bridge