rpi nas

3 minute read Published:

Building a NAS from Paspberry Pi

The beginning

I’ve received a PI from my Friend; he was also interested in building a simple and cheap NAS. I’ve got this: https://thepihut.com/products/raspberry-pi-zero-essential-kit (roughly 1.900 HUF as the time of writing).

Getting the hardware

The first days was mostly about reading the docs, and understanding what do I need to achieve that; so I’ve created a list, to see what do I need to make it happen.

So, it costs around ~ 16.980 HUF, but I didn’t had to buy power adapter, and display (my TV speaks HDMI fluently) :)

The Software part of things

Finally, I was able to connect everything, and it was surprisingly easy. It comes with a Raspbian pre-installed (https://www.raspbian.org/), and as it’s a debian derivate, it was easy to install things.

Watching movies

I’ve tried to install vlc, but I coundn’t figure out the correct video output, so I’ve just used omxplayer ( https://www.raspberrypi.org/documentation/usage/video/ ), and it worked perfectly, with sound (HDMI can transfer sound, I didn’t knew that). Well, almost perfectl, I cannot do fullscreen, so the top and the bottom of the desktop was visible until it went to powersave (and became dark).

Setting up the NAS

I’ve installed samba and autofs with

$ apt-get -y install samba autofs

If this command fails to you, you just have to update your package repository by issuing

$ apt-get update

and retry. After that, I’ve added a samba password with

$ smbpasswd -a pi

The last thing I did is to setup samba share to the directory where autofs mounts things; which is /media/pi I did that by removing all unnecessary (homes, printers, etc) share and adding this block:

[media]

  comment = RPI Media
  path = /media/pi
  quest ok = no 
  browseable = yes
  create mask = 0660
  read only = no

Security

It’s safe in a home LAN environment, when the device is not reachable from the public internet / outside the LAN.

BUT if you want to connect it to some meshnet, or reach the NAS from the outside internet, it’s definietly NOT safe enough, and you shouldn’t even try to do it without really understanding the attack surface.

Closing words

The whole process without any prior knowledge of this kind of devices took ~8 days, including everything (waiting for equipment, being too tired / drunk to do anything, and things like that), so I wasn’t in a hurry.