Orange Pi Zero based home fileserver



All of us have files to store. I wanted a server to share my music with everyone in the house, and a place to back up and store files. Now there are a ton of NAS devices out there you can buy. I wanted to build one that runs plain FreeBSD and had nothing else on it. I didn't, and don't, see why I need a gui to share files. So this is my setup for my house NAS server.

Equipment Needed
  • Single board computer -- had issues with usb to sata driver on raspberry pi of all models. I am using an orange pi zero for the brains of my fileserver. Paid about $8 for them used..

  • microSD card for the single board computer

  • laptop hard drives -- going low power and small, I bought a bunch of 500 GB laptop hard drives. I currently have 12 of them attached to my system via sata to usb adapter cables

  • usb to sata adapters -- obviously one for every drive. They are easy to find on Amazon, Banggood, NewEgg, etc for a couple of bucks each.

  • powered usb hub -- Orange Pi Zero has limited USB so you need a way to power all the drives and to allow all the drives to be attached. My solution was a powered usb hub that I bought on Amazon. Each port will do up to 2 amp so plenty of power to power the drives AND the pi. This eliminates all but ONE plugin to the wall.

  • Din Rails -- I opted to 3d print the brackets for all the drives and the orange pi. The ones I found on Thingiverse mount to din rails. I bought a pack of din rails and 3d printing the brackets. You do you on mounting. I wanted mine on the wall in my office..


Software setup
  • Put FreeBSD on the sdcard. With the Orange pi you write the arm freebsd image to the card, then go compile the correct Uboot for the SBC. There is instructions in each uboot directory in the ports to tell you what command to properly write the uboot to the card. Think of the Uboot as the bios or boot loader needed to get the device set up to run FreeBSD. Once this is done move on to the next step.

  • Connect up all the drives and the power except for the pi. Put the SD card in and the last step is power up the pi. Watch your switch lights to see when the pi is fully up on the network. Once this is done then go to your router and see what IP address your pi was given. You will need this to ssh into the device. If you are using a SBC that has hdmi output you can just go to the screen for it and find out the IP.

  • Assumming you got your IP ssh into the device. The default password will depend on the SBC you are using. root/root is a popular one, root/pi is another. Go online and find yours for your device. Once you have sshed into the device as root run a pkg update, then pkg upgrade. Right out the gate we want to make sure the device is up to date.

  • Now we need to format and setup up your drives. There are a ton of howtos on doing this online. I did all of mine with zfs and put it all in a software raid array with parity so I can lose 1 drive and not lose data. Below is a command that will show all drives attached to the system. Use that to make sure all your drives are seen and are functioning.

    root@fileserver:/ # geom disk list

    Once your drives are formatted and set up move to the next step.

  • set the following lines in your rc.conf file:

    nfs_server_enable="YES"
    nfs_server_flags="-u -t -n 4"
    rpcbind_enable="YES"
    mountd_flags="-r"
    mountd_enable="YES"

  • Set up exports file: The method nfs uses to share a directory is using an exports file. Each directory you want to share needs a line in the exports directory. Here is my exports file:

    # cat /etc/exports
    /home/files -alldirs -maproot=root 192.168.1.0/24 (rw,sync)
    /home/Music -alldirs -maproot=root 192.168.1.0/24 (rw,sysc)

  • Finally start the services you enabled in the rc.conf file by issuing the following commands:
    • service nfsd start
    • service rpcbind start
    • service mountd start
  • Now to make sure you are sharing files run the following command on your server:
      root@fileserver:/ # showmount -a
      All mount points on localhost:
      192.168.1.108:/home/files
      192.168.1.108:/home/music
      root@fileserver:/ #
    so you should see a listing of all directories you shared. So now go to your clients and configure them to attach to them. Enjoy.