← Home

A home server evolution: the stone age

Photo of a Raspberry Pi

If money wasn't a factor, I would splash some cash on a nice NAS and that would probably be the end of my home server journey.

But what if I could get started with what I already have laying around? Anything would be an improvement over copying files to a USB key and carrying it around.

My objective is simple: share files on the network and play videos on the TV.

I have a Raspberry Pi Model B available. It's the first generation of Raspberry Pi, released in 2012, and featuring 512 MB of RAM and a 700 MHz CPU. That's not powerful enough to run popular media player software like Kodi or Plex. At a bare minimum, Plex recommends 1.2 GHz to play a video with no transcoding.

However, my TV happens to be a smart TV and is DLNA certified. This means the TV follows certain standards, including Universal Plug and Play (UPnP). So the Raspberry Pi can serve files on the network, and some DLNA software can be installed on top of it to serve the shared media files.

This setup works surprisingly well: it allows to play on the TV any video stored on the Pi. It's even possible to play 4K videos without buffering, something I wasn't expecting. General file sharing on the network works well too.

Added bonus: the TV can also play music and display photos. If navigation was a little more intuitive and snappier, I may actually enjoy using these features from time to time.

The main downside is the speed of transfer: it takes close to 3 minutes to copy 1 GB to the device (average speed of 6 MB/s). The Raspberry Pi has USB 2.0 ports so I had low expectations.

Equipment

  • Raspberry Pi
  • SD card (8 GB, for the OS)
  • USB key (16 GB, for storage)
  • ethernet cable (to connect the Pi to the router)

I have tried to use a spare external hard drive but the Pi couldn't supply it with enough power, so I'm sticking to the USB stick.

Format the USB key

  1. List information about block devices and identify the disk name (assumed to be "sda" in the next few snippets):

    lsblk
  2. Create a GPT partition table:

    sudo parted /dev/sda --script -- mklabel gpt
  3. Create an EXT4 partition that takes up the whole space:

    sudo parted /dev/sda --script -- mkpart primary ext4 0% 100%
  4. Format the partition to ext4:

    sudo mkfs.ext4 -F /dev/sda1

Set up the home server

I have chosen Samba (implementing the SMB protocol) to not restrict network access to a certain OS (NFS being used for Linux, and AFS for Mac).

  1. Create the share directory with read, write, and execute permissions:

    sudo mkdir -m 777 /media/key/share
  2. Mount the drive to this new directory:

    sudo mount -t auto /dev/sda1 /media/key
  3. Install Samba:

    sudo apt-get install samba samba-common-bin
  4. Backup the default config:

    sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.default
  5. Edit the config:

    sudo nano /etc/samba/smb.conf
  6. Add the share configuration at the bottom of the file:

    [home]comment = Homepath = "/media/key/share"writeable = yesguest ok = yescreate mask = 0777 directorymask = 0777force user = pi
  7. Allow the "pi" user to connect to shares:

    sudo smbpasswd -a pi
  8. Restart Samba:

    sudo systemctl restart smbd
  9. Edit fstab configuration so that the drive mounts whenever the Pi reboots:

    sudo nano /etc/fstab /dev/sda1 /media/key auto noatime 0 0
  10. Access the share on a Mac:

    Finder > Go > Connect to server > smb://192.168.0.XX/share

    Use the Pi's IP address and login with the "pi" user and the Samba password.

  11. Automatically mount the drive on a Mac:

    System Preferences > Users & Groups > Login Items > Add an item to the Login Items list

Set up DLNA

  1. Install miniDLNA:

    sudo apt-get install minidlna
  2. Edit the miniDLNA config:

    sudo nano /etc/minidlna.conf
  3. Specify the source directory:

    media_dir=/media/key/share
  4. Set the display name:

    friendly_name=Home
  5. Start miniDLNA:

    sudo service minidlna start
  6. Whenever changing the config, restart miniDLNA for the change to take effect:

    sudo service minidlna restart

Final thoughts

It works! But the limited size of the USB key and the slow speed of transfer are major limitations. I have some ideas about how to upgrade the setup and bring it from the stone age to the contemporary times. Using a secondhand workstation seems like a smart option, but an easier upgrade could consist in getting a more recent Raspberry Pi and an SSD. A project for another day!

← Home