Large NAS project |
This Network Attached Storage (NAS) project uses a Raspberry Pi 4 running the Bullseye OS and what is now designated the ‘old stable’ v6 of the openmediavault software (OMV6). USB drives are used for the storage media as they can be simply connected to the Raspberry Pi and OMV6 allows them to be easily formatted from its 'admin' screen and configured with multiple shared folders etc. The initial build has used two 4TB USB drives connected to the Pi's two faster USB ports, plus a simple 32GB USB stick connected to one of the slower USB ports is used for some additional code that controls a cooling fan for the enclosure and an OLED that is 'set into' one of the enclosure walls and shows some real time stats for the operation of the NAS.
The build is described as 'large' since the Raspberry Pi 4 cannot safely support the power requirements of more than one USB drive through its USB ports, so the custom 3D printed enclosure has been sized so that a separately powered USB hub can also be fitted inside the enclosure - but the actual size is still only a modest 170mm wide x 155mm deep x 106mm high.
Custom enclosure design and build
The enclosure uses a build/print approach, first developed for a ESP32 controlled 'sensor box' project described here, that allows each ‘wall’ of the box to be printed separately and flat, which makes the 3D print process more reliable.
The 3D print designs were initially created in FreeCAD and the series of images below, produced in FreeCAD, illustrate how the assembly of the main components was modelled to ensure they all fitted together properly before committing to what are quite long print times for each major print item.
FreeCAD was used to generate .STL files suitable for use with a 3D printer 'slicer' program (PrusaSlicer used) and the print files for all the components and their options can be downloaded from the Prusa web site here.
The Raspberry Pi 4 is secured to the enclosure base with 6mm M2 self tap flanged pan head screws, and the clamp bar that secures the 3 cables to the block on the base uses 6mm M3 pan head screws, which are also used to secure the fan holder to the base - all as shown below.
To connect the power supply USB C cable to the Raspberry Pi, as shown in the image on the right, a USB cable adapter (Type-C Male to Female Right Angle) is used as there is not a lot of room between the edge of the Pi and the enclosure's inner wall.
As shown below, the back wall is interlocked to the base using 16mm M3 pan head screws (these need only be a minimum of 12mm long) that engage with M3 nuts that are ‘pulled’ into the hex openings on the corner blocks. Appropriate drive rails, that the USB drives will slot into, are attached to the back wall using 4mm M3 pan head screws and for this build two Toshiba Canvio Partner 4TB Portable 2.5" External HDD, USB 3.2 Gen 1 drives were used. It should be noted however that use of Seagate Expansion Portable, 4TB, External Hard Drive, 2.5 Inch, USB 3.0 drives had to be abandoned because a software configuration could not be found to make the drives spin-down when not used for a period of time.
The 'back' wall of the enclosure comes in two versions, as shown in the first two images below, so that optionally an OLED can be inserted into the wall. A 'carrier' for a 128x64 pixel OLED is used so that the opening in the wall can accommodate different carriers since there are at least two commonly available variants of the 128x64 sized OLED, i.e., either 27.3 mm wide x 27.8mm high, or 24.7mm wide and 27.0mm high. The third image below shows the 'carrier' insert design (OLED01) for the larger available variant, where the OLED is sandwiched between a base and a cover. The 'carrier' assembly is secured in the wall opening using 4mm M3 pan head screws that self tap into bosses on the wall and the OLED cover is secured to the 'carrier' base using 6mm M2 self tap flanged pan head screws. When the 'carrier' base is 3D printed it is positioned on the print bed in the same orientation as shown in the image below, which means that the four tab areas need 'print support' - but when the support material is removed it rarely leaves a smooth surface so the bearing sides of the tabs will need to be filed smooth.
As shown in the visualisation on the right, the design uses an inner wall to support the USB drives and the same drive rails as used on the back wall are attached to the inner side of the inner wall using 4mm M3 pan head screws drive rails. The inner wall itself is located in a slot on the enclosure base and firmly secured using 6mm M3 pan head screws.
The gap between the inner and front walls is where the powered USB hub is placed. This build used a RSHTECH 4-Port Powered USB 3.0 /USB C Hub and two hub rails are used to let the hub slot into a secure location. The hub rails (only one shown in the image on the right) are secured to the outer side of the inner wall using 4mm M3 pan head screws.
A shorter 0.3m USB 3.0 type A male to type B male cable, than the one supplied with the hub, was used since the amount of space available for the cables is relatively small - but the main cables supplied with the USB drives to connect to the USB ports were OK.
The enclosure top, 1st image below, has a slot into which the top of the inner wall must go, so positioning of the top must be done with some care when fixing it place with its 16mm M3 pan head screws that engage with their M3 nuts that are ‘pulled’ into the hex openings on the corner blocks.
The two end walls, 2nd and 3rd images below, are then secured in place with 6mm M2 self tap flanged pan head screws.
Below are a series of photo images taken at various stages of the build:
|
|||
|
|||
|
|
||
|
|
||
|
|
System software
The main software for the system is openmediavault v6 running on Bullseye 64bit Lite, with the openmediavault system regularly updated using the admin function, currently (03Apr'25) at 6.9.16-1 (Shaitan).
The openmediavault software is very extensive and can configure every possible usage mix required with multiple storage media e.g. 2x 4TB USB drives and a 32GB USB 'stick' for this build. The file system of each physical device can be configured (EXT4 used for this build) and multiple shared folders with different access permissions defined. To easily support access from Windows machines on the same network, SMB/CIFS shared folders can also be defined with defined permissions so that these folders can simply 'appear' as accessible storage areas to a Windows machine.
In addition to the main openmediavault system the following additional software is used for this build:
Disk spin-down
As this NAS will only have very intermittent use, additional measures have been taken to ensure the two 4TB disk spin-down when they have not been used for a period of time.
openmediavault does have functionality that can do this, but it does not always work consistently with all disk types, the hd-idle software was therefore installed using the version maintained at https://github.com/adelolmo/hd-idle. The github link describes all the required installation and configuration methods needed and has been found to work well with the two Toshiba Canvio Partner drives used in this build.
Cooling fan control
This build uses the same fan cooling method described in more detail here and the custom Python code that runs continuously in the background with a sleep interval of 10s, is stored on the 32GB and is configured to start/stop the fan in the CPU temperature range 60oC-55oC. The usage stats generated by the Python code currently shows that the fan is on for less than 20% of the time.
OLED control
The optional OLED installation, used in the final build, is a very common small 128x64 pixel display connected to the Raspberry Pi's I2C interface, that can be easily controlled with the Adafruit-SSD1306 Python module. But the main Bullseye 64bit Lite OS is a very 'stripped down' system, so some additional installs were required, i.e.
sudo apt install python3-pip
sudo pip3 install Adafruit-SSD1306
sudo apt install i2c-tools
The custom Python code used to display operational stats is a simple derivative of the 'standard' simple_text.py example provided as part of the Adafruit-SSD1306 installation and runs every 10 minutes as a cron.
The following pages provide further detail about the NAS projects:
All the currently available maker project information: