![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
I've had a Raspberry Pi single board computer sitting around for a year and
hadn't figured out anything I wanted to do with it. If you're not familiar
with it, the Raspberry Pi is a small, maybe a bit bigger than a credit card
sized computer. It costs about $35 and is actually a fairly capable little
machine; it can run Linux, has ethernet, USB and HDMI outputs.
I decided to set it up as a file server. I like having a Linux box that is
always on to run scripts regularly to do things like download and archive
my podcasts. I figured that with an external green drive that spins down
when not used, it would draw less than 10 watts on average.
I got things working well enough, then printed a case for it. It's living
on the workbench in my lab, powered off a powered USB hub (so the adapter
is always on anyway, not adding another bit of phantom draw there). Here's
what it looks like in the case I printed (available on Thingiverse)

Here's what I did, as best as I can recall it right now (if I do it again,
I'll have to take notes):
Install to a 32GB SD card using the net install image, there are plenty of
instructions online for this. It takes a while, and you really need a
monitor and keyboard plugged in to do it.
Edit /etc/samba/smb.conf (the editor "nano" comes installed, or install and
use your favorite). I inserted these sections. This creates a private "usb"
share and a public share (named "public")
[usb]
path = /media/usb
comment = usb drive
read only = no
browseable = yes
guest ok = no
create mask = 0777
valid users = pi
[public]
path = /media/usb/public
comment = public share
read only = no
browsable = yes
guest ok = yes
create mask = 0777
Mount the usb drive; plug it in, then:
mkdir /media/usb
> sudo mount -t auto /dev/sda1 /media/usb
Add a line to /etc/fstab so it always mounts:
/dev/sda1 /media/usb auto noatime 0 0
Restart samba:
> sudo /etc/init.d/samba restart
The shares should be active now.
I used Firenze as my podcast downloader. However, as far as I can tell, the
only way to set it up is via a GUI and I am running this machine headless.
I took my config file from a Windows install that I'd been running
previously, altered the download location, and that worked OK. It would be
nice if there were a command line version of the config though.
Setting up MiniDLNA so that you can view media from a device such as a
blu-ray player or smart TV:
(I used the guide at http://bbrks.me/rpi-minidlna-media-server/)
> sudo apt-get update
> sudo apt-get upgradeĀ
> sudo apt-get install minidlna
Start MiniDLNA, it will create a default config file:
> sudo service minidlna start
now edit /etc/minidlna.conf. I added:
media_dir=V,/media/usb/public/minidlna/video
friendly_name=runt
inotify=yes
This sets up a video directory in the location indicated, calls the
server "runt" (you can make up whatever name you like of course), and tells
it to watch for new files showing up in the location. Restart minidlna
(force-reload instead of the normal "restart" because otherwise it won't
look for new files that are in the new location. This makes it rebuild its
database)
/etc/init.d/minidlna force-reload
Make sure it restarts on reboot:
update-rc.d minidlna defaults
That's it, you should be able to watch movies that you stick in the video
directory now.
hadn't figured out anything I wanted to do with it. If you're not familiar
with it, the Raspberry Pi is a small, maybe a bit bigger than a credit card
sized computer. It costs about $35 and is actually a fairly capable little
machine; it can run Linux, has ethernet, USB and HDMI outputs.
I decided to set it up as a file server. I like having a Linux box that is
always on to run scripts regularly to do things like download and archive
my podcasts. I figured that with an external green drive that spins down
when not used, it would draw less than 10 watts on average.
I got things working well enough, then printed a case for it. It's living
on the workbench in my lab, powered off a powered USB hub (so the adapter
is always on anyway, not adding another bit of phantom draw there). Here's
what it looks like in the case I printed (available on Thingiverse)
Here's what I did, as best as I can recall it right now (if I do it again,
I'll have to take notes):
Install to a 32GB SD card using the net install image, there are plenty of
instructions online for this. It takes a while, and you really need a
monitor and keyboard plugged in to do it.
Edit /etc/samba/smb.conf (the editor "nano" comes installed, or install and
use your favorite). I inserted these sections. This creates a private "usb"
share and a public share (named "public")
[usb]
path = /media/usb
comment = usb drive
read only = no
browseable = yes
guest ok = no
create mask = 0777
valid users = pi
[public]
path = /media/usb/public
comment = public share
read only = no
browsable = yes
guest ok = yes
create mask = 0777
Mount the usb drive; plug it in, then:
mkdir /media/usb
> sudo mount -t auto /dev/sda1 /media/usb
Add a line to /etc/fstab so it always mounts:
/dev/sda1 /media/usb auto noatime 0 0
Restart samba:
> sudo /etc/init.d/samba restart
The shares should be active now.
I used Firenze as my podcast downloader. However, as far as I can tell, the
only way to set it up is via a GUI and I am running this machine headless.
I took my config file from a Windows install that I'd been running
previously, altered the download location, and that worked OK. It would be
nice if there were a command line version of the config though.
Setting up MiniDLNA so that you can view media from a device such as a
blu-ray player or smart TV:
(I used the guide at http://bbrks.me/rpi-minidlna-media-server/)
> sudo apt-get update
> sudo apt-get upgradeĀ
> sudo apt-get install minidlna
Start MiniDLNA, it will create a default config file:
> sudo service minidlna start
now edit /etc/minidlna.conf. I added:
media_dir=V,/media/usb/public/minidlna/video
friendly_name=runt
inotify=yes
This sets up a video directory in the location indicated, calls the
server "runt" (you can make up whatever name you like of course), and tells
it to watch for new files showing up in the location. Restart minidlna
(force-reload instead of the normal "restart" because otherwise it won't
look for new files that are in the new location. This makes it rebuild its
database)
/etc/init.d/minidlna force-reload
Make sure it restarts on reboot:
update-rc.d minidlna defaults
That's it, you should be able to watch movies that you stick in the video
directory now.