PiNAS - the Raspberry Pi NAS

219,458

1,005

86

Introduction: PiNAS - the Raspberry Pi NAS

Intro:

This instructable describes the build of a very compact Raspberry Pi powered two bay network attached storage (NAS).


Features:

  • Super small
  • Easy to build
  • Simple setup
  • Cheap
  • Perfect for learning about network, file system, security mechanisms
  • Raspberry Pi 2 or 3 can be used (Pi 4 with some tweaks)
  • Powered by a single USB cable
  • Can use WiFi
  • Uses notebook hard drives
  • hard drives are hotswappable
  • Two USB ports for further hardware
  • Easy to open case


If you like the PiNAS check out my page AraymBox for other projects. You can also post ideas on how to improve the design.


Note:

Please note that English is not my first language. If you find any mistakes or something is not clear feel free to tell me and I'll try to fix it. Same goes for general mistakes. If you have any suggestions for improvements please let me know.


Content:

Step 01: Tools & Materials

Step 02: 3D Printing the Case

Step 03: 3D Print Post-processing (optional)

Step 04: Preparing the SATA to USB Adapters

Step 05: Preparing the Inner Case

Step 06: Wiring and Assembly: Raspberry Pi

Step 07: Wiring and Assembly: USB Breakout Board

Step 08: Wiring and Assembly: Installation

Step 09: Wiring and Assembly: HDD Adapters

Step 10: Case Assembly: Faceplate (optional)

Step 11: Preparing the SD Card

Step 12: Case Assembly

Step 13: Configuring Open Media Vault

Step 14: Configuring OMV: System

Step 15: Configuring OMV: Storage

Step 16: Configuring OMV: Access Rights Management

Step 17: Configuring OMV: Services

Step 18: Using the NAS

Step 19: Final Step

Step 20: Change History

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Materials & Tools

Make sure you have everything you need for the build. There is nothing more annoying than stopping your project because you have to wait for some small part being delivered.

You do not have to buy the listed parts and material from given links. These are examples and show the required properties of the parts.


Parts:


Tools:

Step 2: 3D Printing the Case

I've designed the case to be as simple as possible:

  • Only 4 parts
  • Can be printed without supports
  • Held together by 4 bolts
  • Easy to open for maintenance

The inner part of my case was printed with PLA and the 3 outer shells with ABS. I've used ABS for the shell because I wanted to paint it and ABS is much easier for post-processing. You can also use PLA or try any other filament.

If you do not have a 3D printer you can use a 3D printing service.


Download
:

You'll find updated parts on this thingiverse design page.


These file are the first version:

Step 3: 3D Print Post-processing (optional)

Depending on your taste this step is optional.

3D printed parts are not perfect - they have small cracks, holes, bubbles, visible layers, etc. If you want a decent smooth glossy look you have to take an extra step and post process the parts.

Here is what I've done to the 3 outer case parts:


1. Sand the parts:

  • run 1: use 120 grit sanding paper
  • run 2: use 240 grit sanding paper
  • run 3: use the wet extra fine sanding sponge


2. Clean the parts:

Wash the parts with clear water and let them dry


3. Paint:

  1. Spray a thin layer of paint primer. Let it dry for 24 hours.
  2. Check the surface.
  3. Spray a thin layer of paint. Let it dry for 24 hours.

Step 4: Preparing the SATA to USB Adapters

In this step we're going to prepare the SATA to USB adapters for the assembly.

Follow these steps to disassemble the adapters:

    1. Lift the lid of the case.
    2. Remove the PCB and the cable from the case.
    3. Remove the hot glue.
    4. Unsolder the USB wires from the PCB.

    Step 5: Preparing the Inner Case

    In this step we're going to prepare the inner part of the case for the assembly.

    Follow these steps to add the nuts:

    1. Check if there is any debris in the slots for the nuts and remove it.
    2. Slide all four nuts in the slots.
    3. Secure the nuts with the M3x6mm bolts to keep them in place.
    4. Apply a small amount of hot glue to the slots to secure the nuts.
    5. Remove the M3x6mm bolts.

    Check if all parts fit in their dedicated place.

    Step 6: Wiring and Assembly: Raspberry Pi

    In this step we'are wiring up all the electronics and put it in place.

    Always double (and triple) check your soldering.


    Solder all wires to the RasPi first:

    1. Start by soldering all the required wires to the RasPi
    2. The pictures in this step show all required wiring points.

    Step 7: Wiring and Assembly: USB Breakout Board

    Add the Female micro USB breakout board:

    1. Add the Female micro USB breakout board to the wires of the RasPi
    2. Solder the wires to the breakout board which supply the adapters with power
    3. The pictures in this step show all required wiring points.

    Step 8: Wiring and Assembly: Installation

    Install the RasPi and the USB breakout board:

    1. Slide the RasPi into its place.
    2. Secure the RasPi using the M3x6mm nuts.
    3. Place the USB breakout board in the dedicated recess.
    4. Secure the USB breakout board using a small amount of hot glue.

    Step 9: Wiring and Assembly: HDD Adapters

    Install the top HDD adapter:

    1. Slide in the top HDD adapter (the one right under the RasPi)


    Solder the top HDD adapter:

    1. Solder the data and power wires to the top HDD adapter.
    2. Add the wires which will supply the lower HDD adapter.
    3. The pictures in this step show all required wiring points.


    Install the lower HDD adapter:

    1. Slide in the lower HDD adapter.


    Solder the lower HDD adapter:

    1. Solder the data and power wires (coming from the top HDD adapter) to the lower HDD adapter.
    2. The pictures in this step show all required wiring points.


    Align the HDD adapters:

    1. Slide in both hard drives.
    2. Make sure the HDD adapters plug into the hard drives with only little force.
    3. Secure both HDD adapters using a small amount of hot glue (see picture).
    4. Remove both hard drives.

    Step 10: Case Assembly: Faceplate (optional)

    Depending on your taste this step is optional.

    The files which need to be printed (thingiverse) also contain optional parts which you can use if you want to add a wooden (or else) faceplate.

    1. Print the optional parts.
    2. Create the faceplate (e.g. laser engraving).
    3. Place the faceplate into the optional front piece of the case.
    4. Secure the frontplate with some hot glue.
    5. Place the optional HDD stopper on the faceplate.
    6. Secure the HDD stopper with some hot glue.

    Step 11: Preparing the SD Card

    Now that we have finished most of the hardware part it's time to look at the software.

    In this step we're going to download all needed software, write the Open Media Vault image to the SD card and start RasPi for the first time.


    Required Software:


    Preparing the SD Card:

    1. Plug the SD card into your Windows PC.
    2. Make sure Windows detects the card.
    3. Open "My Computer" or "This PC" or the Windows Explorer and remember the drive letter of the SD card. In my case it was F:\ (differs from systems to system). Make sure it's really the letter of the card and not some of your harddrives.
    4. Start balena etcher.
    5. Select the Open Media Valut image.
    6. Select the drive letter of the SD card.
    7. Click Flash!
    8. Wait until the flashing has finished.
    9. Unplug the SD card.


    Starting the Raspberry Pi:

    1. Plug the SD card into the Raspberry Pi.
    2. Connect the Raspberry Pi to a screen using an HDMI cable.
    3. Connect the Raspberry Pi to your network using an ethernet cable.
    4. Power up the system by connecting the power cable to the Raspberry Pi.
    5. You'll see the automatic starting procedure on the sceen.
    6. Wait until you see the same message as shown in the last picture in this step. It takes some time - around 20 minutes for me.
    7. Remember the IP-address, the username and the password shown on the screen.
    8. Power off the RasPi.
    9. Remove all cables.

    Step 12: Case Assembly

    Now you can put together the PiNAS

    1. Carefully slide on the back piece of the case and make sure the micro USB port meets its cutout in the case.
    2. Secure the back piece of the case with two M3x8mm bolts.
    3. Slide on the middle piece of the case.
    4. Slide on the front piece of the case.
    5. Secure the back piece of the case with two M3x8mm bolts.

    Step 13: Configuring Open Media Vault

    Now we're going to configure Open Media Vault.

    After logging into Open Media Vault you'll see a tree view on the left side. All settings are separated into 5 main sections:

    • System
    • Storage
    • Access Rights Management
    • Services
    • Diagnostics

    The following steps show the most important settings in these sections.


    Starting the Raspberry Pi:

    1. Connect the Raspberry Pi to your network using an ethernet cable.
    2. Power up the system by connecting the power cable to the Raspberry Pi.
    3. Remember the IP-address, the username and the password shown on the screen.


    First Login:

    1. Start your favorite internet browser (firefox, chrome, ie, etc.).
    2. Type in the IP-address of the PiNAS into the address bar of the browser.
    3. You should now see the authentication mask of Open Media Vault.
    4. Select you language.
    5. Enter the username, password and click Login.

    Step 14: Configuring OMV: System

    General Settings

    1. Open tab Web Administrator Password
    2. Set and confirm a new password
    3. Click Save to save


    Date & Time

    1. Select you time zone
    2. Enable the NTP (Network Time Protocol) feature and set a time server
    3. Click Save to save


    Network

    1. Open tab General
    2. Give your PiNAS a hostname (name in your network)
    3. Click Save to save
    4. Open tab Interfaces
    5. Press Add
    6. Set a static IPv4 address so it does not change after reboot
    7. Click Save to save
    8. Open tab Service Discovery
    9. Activate the services you need

    Step 15: Configuring OMV: Storage

    Disks

    1. Make sure both drives were identified and listed (typically they are mounted as sda and sdb)
    2. Select a disk click Edit
    3. Enable write-cache
    4. Click Save to save
    5. Do the same for the second disk
    6. Select a disk click Wipe
    7. Click Quick to remove all data from the disk
    8. Do the same for the second disk


    RAID Management

    1. Click Create to create a new RAID (Redundant Array of Independent Disks)
    2. Give your RAID a Name - e.g. raid1
    3. Select your RAID Level - e.g. Mirror (RAID Level 1)
    4. Select the Devices you want to add to the RAID - select both your disks
    5. Click Create to create the RAID using the selected disks
    6. The new RAID 1 is now resyncing
    7. When syncing has finished the State of the RAID changes to clean


    File Systems

    1. Click Create to create a file system
    2. Select your Device (your previously created raid1)
    3. Give your file system a Label to identify it easily
    4. Select your desired file system type
    5. Click OK to create the file system
    6. Wait for your file system to finish initializing (Status has to be Online)
    7. Select your initialized file system and press Mount to make it available

    Step 16: Configuring OMV: Access Rights Management

    User

    User accounts are necessary to access the file system of the PiNAS

    1. Open the tab Users
    2. Click Add to create a new user
    3. Enter a Name for the user
    4. Set and confirm the password for this user
    5. Click Save to save


    Group

    It's easier to manage user groups instead of every user individually.

    1. Click Add to create a new user group
    2. Open tab General
    3. Enter a Name for the user group
    4. Open tab Members
    5. Select the users you want to add to the group (e.g. the one you created)
    6. Click Save to save


    Shared Folders

    In order to access the file system of the PiNAS from another machine like a PC shared folders are required.

    1. Click Add to create new shared folder
    2. Enter a Name for the new share folder (this name will be connected to other machines)
    3. Select the Device where the shared folder will be created on (your previously created file system)
    4. Select or enter the Path of your shared folder
    5. Set your desired Permissions for this shared folder (more permissions will be set in the next steps)
    6. Click Save to create the shared folder
    7. Click Privileges to set them for users or user groups
    8. Set your desired privileges to your users or/and groups
    9. Click Save to save your settings
    10. Click ACL to create a new Access Control List for your shared folder
    11. Set your desired User/Group permissions (e.g. Read/Write) for your users and groups
    12. Enable Replace all existing permissions
    13. Enable Apply permissions to files and subfolders
    14. Click Apply to create and apply the ACL

    Step 17: Configuring OMV: Services

    This part describes how a SMB share (mainly used in Windows environments) will be created and used. Open Media Vault gives you a lot more possibilities to present your PiNAS to other devices in your network.

    SMB/CIFS

    1. Open tab Settings
    2. Enable SMB/CIFS
    3. Open tab Shares click Add to create a new SMB share
    4. Enable the new share
    5. Select a shared folder (the one you created before)
    6. Select if the share will be Public (visibly listed by PiNAS)
    7. Enable Honor existing ACLs (inherit ACLs)
    8. Enable permission inheritance
    9. Click Save to create the new SMB share

    Step 18: Using the NAS

    Now PiNAS is ready for your data.


    Connect the PiNAS share to your PC:

    1. Press the Windows Button on your keyboard, type cmd and press Enter. A Windows command prompt should pop up.
    2. Type the following command to connect the PiNAS share:
      net use N: \\PiNAS\nas_share
    3. The command prompt should now ask you for a username to authenticate with. Enter the PiNAS username nas_user.
    4. Now the command prompt wants the password for nas_user - type it in and hit Enter.
    5. The command prompt should say something like The command completed successfully.


    Write Data:

    • When you open Windows Explorer you should now see the new group Network Location.
    • In this group all your mapped network folders are listed - just like the connected nas_share.
    • Now you can drag and drop data to this drive and back it up on the two mirrored disks of the PiNAS.

    Step 19: Final Step

    Congratulations:

    • Congratulations you've build your own Raspberry Pi powered Network Attached Storage.
    • Have fun backing up your data or messing around with this type of technology.
    • Show some love, comment, share and have a nice day.
    • You can also tip me on thingiverse if you feel to.

    Step 20: Change History

    04-FEB-2020:

    • Published.
    Raspberry Pi Contest 2020

    Second Prize in the
    Raspberry Pi Contest 2020

    Be the First to Share

      Recommendations

      • LED Strip Speed Challenge

        LED Strip Speed Challenge
      • Sculpting Challenge

        Sculpting Challenge
      • Clocks Contest

        Clocks Contest

      86 Discussions

      0
      kthrun
      kthrun

      22 days ago

      Just wanted to say thank you for this. This is my first full build from Instructables, it is something I really wanted & needed. Very easy to follow, you did a fantastic job. Keep doing what you are doing!

      Finished printing the case parts over the weekend and started getting it put together tonight. Been looking for something like this. Built one with external drives, but it was just too cumbersome, so many wires, the drives were always getting knocked off the shelf and no RAID, but this is a nice, neat little AIO package!

      Went with the fan end case. Kind of new to RPI, the fan hooks up to GPIO pins 4 & 6, or was I given bad directions on that one? And would the polarity matter? I assume depending on push or pull of air. Which do you think would be better based on your case design?

      Also got different design of HDD USB cables from your link, still trying to figure it out, but I may need to pick your brain on that. First attempt powered on, but it wouldn't boot, assume I wired something wrong - can hear & feel the HDD spin up though. Going back through to double check soldering & wiring.

      And I'll be sure to throw you some love on Thingiverse once it's up & running.

      20200310_202115.jpg
      0
      araymbox
      araymbox

      Reply 21 days ago

      Thanks.
      1.) You are right with the GPIO pins: 4 is 5V and 6 is ground. Make sure it's a 5V fan and not 12V or something.
      2.) Yep. Double check the wiring. Unsolder the HDD data wires from the Pi and try to boot it w/o the HDDs - OMV will boot w/o HDDs. Hook up a display and see the the Pi is saying.

      0
      kthrun
      kthrun

      Reply 21 days ago

      Thank you for the quick reply, surprisingly, I wired everything correct! Sadly, didn't realize it until I took it all apart. I tried several other RPI OS's & they all booted perfectly (Including RetroPI). Tried several different cards of various sizes & brands, several different image burners to no avail. Even tried it in my other RPI & that one wouldn't boot it either. So it has to be something with the OMV image. Did have a bit of an issue downloading so it may be corrupt. I'll keep at it though! Haven't gotten this far to be outwitted by a software issue.

      Also, thank you for the advice on the fan, I completely overlooked using a 24v fan, it was an extra from a 3D printer build. Facepalm

      0
      kthrun
      kthrun

      Reply 19 days ago

      Thanks again for all your support, its up & running! Well, in process. Decided to just use Raspbian Lite to wget all the OMV packages. Unfortunately OMV's forums are down for a short time. Raspbian Lite booted right up. SSH'ed in & waiting for the packages to install while I type this up.

      For some reason, OMVs download page was showing the image size as 451mb, but my download was only 430mb? Plus that was for OMV 4, not 5. So it HAD to be the image file. I think this was much easier anyway! Some good old fashioned linux hacking. Cathartic.

      Seriously, thank you for everything, all the hard work & time designing this NAS, doing the Instructable & for sharing, plus all the time you spent helping me out. You ROCK!

      You've inspired me...I'd be interested to try out that 4 drive RPI hat I saw & design a case for that.

      0
      F1-Help
      F1-Help

      Question 4 weeks ago

      Thanks for your instructable...The omv seems to have disappeared?

      goneMediaVault.jpg
      0
      kthrun
      kthrun

      Answer 22 days ago

      Had the same thing happen the first time I tried to download, reloaded the page a couple times & it popped right up. Just keep trying!

      0
      BullData
      BullData

      Question 7 weeks ago

      For us old retirees who love to save family photos, genealogy, family movies, but we don't have the tools to build this NAS, how much would you sell an assembled unit to us?

      0
      jacobf51
      jacobf51

      Answer 4 weeks ago

      If you pay shipping, I will do it for 5 USD over the price of the parts. Contact me at jacobeflanders@gmail.com.

      1
      davehorn1
      davehorn1

      Question 5 weeks ago

      Rather than build the enclosure and modify the USB to SATA connectors, can I just buy two standard USB3.0 hard drives and plug them into the two USB3.0 ports on the RPi 4?
      Is there any performance downside?
      My RPi 4 is alreay in an standard enclosure.
      I would just need to load and configure OMV as per your instructions.
      I would access the PiNAS over ethernet.

      0
      araymbox
      araymbox

      Answer 5 weeks ago

      Yeah sure - why not.

      0
      FL Guy
      FL Guy

      Question 5 weeks ago on Step 1

      Great idea, and solution - thanks!

      Does this solution support secure remote access (i.e 'personal cloud') functionality? If not, does anyone have any suggestions for adding support for personal cloud type of functionality?

      0
      rawsketch
      rawsketch

      5 weeks ago

      'Easy to build'- you overcomplicated it, soldering was unnecessary. All you had to do was plugging the USB2SATA cables to the Pi and setting up the software.


      Also, I don't get the design of your case. Design is about functionality. Why making it so tight and compact when your design doesn't translate into a footprint reduction of the final build. It still takes the footprint of a drive plus some empty space and the Pi... why not placing the Pi under or on top of the drives, parallel to them? The final thing would have had the footprint of a drive.


      A simple and bigger boxy enclosure without that white inner shelving could have allowed to easily bend and manage the adapter cables and it could have given some air around making them running cooler.
      Even if they are slowly spinning, old magnetic drives get very hot.



      'Cheap' - Not really, if you don't have the drives already under hand they will cost you about $50 each. The total cost of the project will almost hit the price of an entry level commercial NAS.



      'Raspberry Pi 2 or 3 can be used (Pi 4 with some tweaks)' - sure but anything before the RPi 4 will have USB 2.0 and you will have transfer speeds around 20 Mb/s or less.

      I know because I tested it making my own with a RPi 3B and two 500Gb Toshiba 2.5' HDD from older notebooks.

      I'm waiting to grab a RPi 4 at a reasonable price and make this project again with a couple SSDs, the USB 3.0 should allow much faster transfer speeds


      1
      araymbox
      araymbox

      Reply 5 weeks ago

      1. It is "easy to build" - it's not an "easy to plug'n'play" project. Plug in the cables and that whole thing is 4cm longer and you lose the easy access to the remaining USB ports.
      2. "Functional design" is about functionality. I could've made the case 100x100x100cm and throw the parts inside - it would still be a "design". The current design is nearly the footprint of a disk. Discussions about designs are kind of pointless - it's like discussions about your favourite colour.
      3. What is that "very hot"? Too hot to touch? Too hot to operate? Both drives show no issues so far. SMART values are fine.
      4. "The total cost of the project will almost hit the price of an entry level commercial NAS" - lol ... wow. The cost of this project is around $160 INCL. two of your $50 drives. Please show me that "entry level commercial NAS" with two bays AND included drives.
      5. "Transfer speeds around 20 Mb/s or less" - So? Does it store data? Yes. Does it transfer data? Yes. Can you store your photos and documents on it? Sure. Can I use it to store and process 8k raw video footage on it. You could - very slowly. It's fine if it meets your requirement. Someone who needs performance won't use a Raspberry Pi.

      0
      rawsketch
      rawsketch

      Reply 5 weeks ago

      1 - It is a plug'n'play project. Only your version is not, because your poor case design choices
      2 - That's the whole point. Your design is NOT the footprint of a disk, it could have been, but your poor decisions didn't make it happen. You preferred a fancy shape over functionality.
      4 - $160 drives included?
      Just one Seagate Barracuda 1Tb costs 45$ on Amazon.
      Two USB2SATA adapter costs about $8 each Amazon, unless you pick one that breaks apart on day 2.
      A RPi3B+ costs about 50$, a Pi4 about $65 (if you pick an older Pi you better plug those drives to your computer, unless you want to get your beard white in the waiting of your files getting transferred).
      And we haven't included case materials yet.
      We are well above $160$, $180+ using a Pi4.
      Single bay NAS start from around 100$ (Synology DS102J), a 3Tb Seagate Barracuda is about $79. Plenty of space, and the 3.5' is much faster and reliable
      Dual bay NAS, they start from about 150$ (TerraMaster F2)

      5 - Really, and how long your 8k raw file takes to upload, a couple weeks? LOL

      Don't even bother to make this project unless you use a Pi 4 with USB 3.0, and design your own enclosure, using some basic good sense ;)

      2
      araymbox
      araymbox

      Reply 5 weeks ago

      1. THIS project isn't plug'n'play - it involves soldering. If you want to plug some drives in a Pi - fine, do it. You don't have to use this if you don't like it.

      2. If you want the footprint of a drive you don't have to use a case at all. Every case has some sort of wall-thickness which adds to the footprint.
      !irony on
      Yes my poor fancy decisions - you'r so right:
      footprint of this case: 15x9cm
      footprint of a 2.5" drive + USB2SATA: 12x7cm
      It's like - unusable - so much space wasted - I don't know where to place this massively huge device.
      !irony off

      4. You are comparing this project - see the parts list and use these prices.

      1x Raspberry Pi 3 -> $35
      1x micro SD Card 16GB -> $6
      1x Female Micro USB breakout board -> $1
      2x SATA to USB adapter -> $16
      2x 2.5" Hard drives -> $100 ($50 for one - as you said)
      1x Power supply -> $10
      SUM: $168

      Now go and find a TWO BAY (since this project has two bays) commercial NAS with TWO included drives. You won't find any if you don't look at eBay or craigslist or steal one.

      5. Read again what I said and try to understand. You can do it. It's stupid and takes forever but technically it's possible. If it takes to long FOR YOU go buy a multipath gigabit fibre channel raid10 san.

      You don't have to make this project - nobody is forcing you. If you don't like the case and the performance why do you even comment? Do you also talk to random people telling them you don't like the clothes they're wearing?

      1
      Kevanf1
      Kevanf1

      6 weeks ago

      Any chance of doing this from a Linux OS as opposed to MS Windows? Does it also have to be in a RAID configuration?

      0
      Yasiik
      Yasiik

      Question 6 weeks ago

      Would it be possible to use 3.5" HDDs and Pi 4? Would I need to change anything else except the case?

      0
      RobT16
      RobT16

      Answer 6 weeks ago

      You would have to power the hdds differently 3.5in run off 12v, but the data setup should still work.