Monthly Archives: October 2018

Building own NAS

For many months I was thinking about buying a NAS (Network Attached Storage) for home use. My goal was not just a typical NAS, but something more. Something that I could use in my work. Not only for file storage, but also a toy for docker, nginx, media center, etc.

At first I have thought about simplest solution – buying QNAP device. Below you can find comparison of the models which I have considered.

CPUQuad-core Realtek RTD1295Annapurna Labs Alpine AL-212 2-coreAnnapurna Labs Alpine AL-314 4-coreDual-core Intel® Celeron®
CPU Freq1.4GHz1.7 GHz1.7 GHz2.41GHz
(Up to 2.58GHz)
Memory (RAM)1GB1GB1GB / 4 GB4GB
Number of RAM Slots001 (Max 8GB)2 (Max 8 GB)
Max. number of HDDs/SSDs2 x 2.5″/3.5″2 x 2.5″/3.5″2 x 2.5″/3.5″2 x 2.5″/3.5″
Power Consumption (W)5-129-169-2410-20
Price 173 EUR200 EUR240 EUR300 EUR

Unfortunately, integrated sets have many disadvantages. For example:

  • no or limited expandability (more RAM or better CPU – forget!),
  • limited number of applications,
  • relatively expensive,
  • threatened by fast EoL (try upgrade software in 2 years)

I was  also thinking about CloudShell2 with Ordoid XU4 but the price of the kit is 175 EUR. See more here.

Because of these limitations, I finally decided to challenge myself and build my own low-cost NAS server.


The most difficult part was finding the right chassis. It should be small and at the same time large enough to accommodate many hard drives: for system 1 x 2.5″ and for storage 3 x 3.5″ – 2 disks working as RAID1 for user data + 1 disk for media.

I have found old version of model In-Win BL631 – without USB3.0 ports on front.

  • External Drive Bays: 1 x 5.25″ & 1 x 3.5″
  • Internal Drive Bays: 2 x 3.5″ & 1 x 2.5″
  • I/O Expansion Slots: 4 x Low Profile Slot
  • Built-in PSU 300W

I don’t know how but somehow I managed to buy this chassis for 8 EUR! Seriously :-).

Attention: The side fan (80x80x25mm) attached to the set is quite loud. I bought fan of a better quality and replaced the default one.


The choice was simple. I used the micro-ATX Gigabyte GA-G41MT-S2  witch CPU Intel Core 2 Duo E4600  from old computer. The disadvantages of this mobo are unfortunately: max 8GB RAM, no USB 3.0 and only SATA 3Gb/s connectors. If you want use SATA 6Gbps you may buy and install  PCI Express SATA Controller.

As the advantages I can mention: 1Gbps LAN port and the old but still good LGA775 socket support.

Two core CPU Intel E4600 (TDP 65W) is listed in the second half of the PassMark rate for LGA775 processors. I’m going to upgrade CPU to Intel Core 2 Quad (TDP 95W).

Attention: Standard CPU cooler could be not enough because of compact chassis. My server is located in a cabinet, the air flow is limited. Now in idle state CPU core temperature is 57-60 °C, I think that is too much so I consider buying better quality cooler and mounting additional fan in the cabinet.

This mobo doesn’t have USB 3.0 ports so I needed to extend it via external PCI Express Card. Ports will be used to backup data.

Operating system

Of course the only right one: Linux. I decided to install OpenMediaVault based on Debian distribution. The second system worth considering is FreeNAS. See comparison and choose yourself the best for you.


I spent about 60 EUR on building my server – as I said, a processor with mobo and RAM memory recovered from the garbage. The remaining items I bought on well-known auction portals. This is quarter the price of middle-range brand-new QNAP. Detailed expenses are listed in the table below.

ChassisSFF Slim Chassis In-Win BL631 (new)8 EUR
MotherboardGigabyte GA-G41MT-S2 rev 1.3 (used)23 EUR
Side fanArctic Cooling F8 (80x80x25mm)5 EUR
ProcessorIntel Core 2 Duo E4600 2×2,4GHz (used)3 EUR
RAM2 x  2GB DDR3 PC3-1333MHz  (used)14 EUR
PCI cardPCI Express UBB3.0  (used)4 EUR
System diskSSD 128GB ADATA SU800 (new)35 EUR
OtherSATA cables, etc.8 EUR
Total:100 EUR

As mass storage we can use any hard disk designed for work 24 hours, 7 days a week – for example Seagate IronWolf or WD Red series. In my case the main storage is created on one WD Red 3TB disk – ca. 105 EUR.

My NAS has one big disadvantage – power consumption. In the idle state wattmeter shows a value ca. 50W. A lot compared to QNAP devices.

Disk tests

Disk performance was checked using bonnie++ package.

bonnie++ -d ./ -r 2048 -u root

\dev\sda result (SSD disk)

Version 1.97Sequential OutputSequential InputRandom
Sequential CreateRandom Create
SizePer CharBlockRewritePer CharBlockNum FilesCreateReadDeleteCreateReadDelete
K/sec% CPUK/sec% CPUK/sec% CPUK/sec% CPUK/sec% CPU/sec% CPU/sec% CPU/sec% CPU/sec% CPU/sec% CPU/sec% CPU/sec% CPU

\dev\sdb result (HDD disk)

Version 1.97Sequential OutputSequential InputRandom
Sequential CreateRandom Create
SizePer CharBlockRewritePer CharBlockNum FilesCreateReadDeleteCreateReadDelete
K/sec% CPUK/sec% CPUK/sec% CPUK/sec% CPUK/sec% CPU/sec% CPU/sec% CPU/sec% CPU/sec% CPU/sec% CPU/sec% CPU/sec% CPU
WD Red4G3319815096537764281910679717027621417.810162638978++++++++30362782829180++++++++3011577

TODOs in the nearest future

  • buy two WD Red 1T disk and create RAID 1 storage for sensitive data,
  • buy PCIe SATA 6.0 Gb/s controller for storage (now is only 3.0Gb/s)
  • upgrade CPU to Intel Core 2 Quad
  • change standard mobo CPU cooler to more effective

OpenMediaVault + Nginx + PHP7.2

OpenMediaVault in current version 4.1.12 is based on Debian Stretch which uses (unfortunately) PHP 7.0 as default. If you want to upgrade the version of PHP to version 7.2, the following tutorial is what you are looking for. Let’s play…

1. Add PHP 7.2 repository

Personally, I use SURY repositories. Add SURY repo to yours.

apt-get -y install apt-transport-https lsb-release ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg
sh -c 'echo "deb $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'

apt-get update
apt-get install php7.2-cli php7.2-fpm

And voila! PHP7.2 is now our default CLI interpreter. Let’s check.

root@omv:/home# php -v   
PHP 7.2.11-2+0~20181015120801.9+stretch~1.gbp8105e0 (cli) (built: Oct 15 2018 12:08:03) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.11-2+0~20181015120801.9+stretch~1.gbp8105e0, Copyright (c) 1999-2018, by Zend Technologies

2. Config build-in OMV Nginx

Because I use build-in Nginx service in my OMV, we have to not only install FPM but also override default configuration using GUI.  

Open OMV control panel. Go to Services on the left sidebar and click Nginx section. Edit your server, and add section in config file.

location ^~ / {
    index index.php indec.html;
    try_files $uri $uri/ =404;

    location ~ \.php$ {
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass  "unix:/var/run/php/php7.2-fpm.sock";

Adding a caret and tilde (^~) to your location directives tells NGINX, if it matches a particular string, to stop searching for more specific matches and use the directives here instead. Other than that, these directives work like the literal string matches in the first group. Even if there’s a more specific match later, if a request matches one of these directives, the settings here will be used. See more cases in official documentation

Now we can check new php fpm engine. Create new file index.php in your root directory defined in General section in Nginx server configuration.

echo phpversion(); 

Go to browser and open page http(s)://OMV_IP. You should see something like this


Notice: This changes work only for our defined locations, not for OpenMediaVault GUI.