The FreeNAS operating system will run on any personal computer. If there is an extra system unit with the ability to install several hard drives If you don't have one, then assemble a new one, following our recommendations.

We chose the Prodigy case from BitFenix ​​as the basis for the NAS system. It has six bays for installing 3.5-inch hard drives. ASRock E350M1 Compact Motherboard with Integrated Dual Core central processor provides sufficient performance and provides four SATA connectors for connecting hard drives.

To use six drives, you will need to install a controller board with two SATA ports. WITH motherboard Two Kingston HyperX RAM modules of 4 GB each are compatible. As a power supply, we chose the quiet and energy-efficient model be quiet Pure Power L8 with a power of 300 W, and we recommend quiet hard drives, such as, for example, WD Red (2 TB).

2. Component assembly

If you strictly follow the instructions in the user manual for the BitFenix ​​Prodigy case, then there should be no problems when assembling the computer. Please note that it is best to install the power supply with the ventilation hole down, and the hard drives are inserted into the case along with the slide with the connectors facing forward.

3. Connection

First connect to system board connectors for the power and reset buttons, as well as LED indicators, since subsequently access to them will be significantly difficult. It is recommended to connect hard drives on the side of the case on which the power and reset buttons are located.

4. Installing FreeNAS on a USB flash drive

Unpack it on a PC with an operating system Windows image FreeNAS as well free program Win32 Disk Imager. To do this, use the 7-Zip archiver, which can work with the XZ format.

Insert a flash drive with a capacity of at least 2 GB and launch Win32 Disk Imager. Open the FreeNAS image file by clicking on the folder icon and selecting the letter of the flash drive in the “Device” item. Clicking “Write” will start the process of writing the image to the flash drive. Remove the drive from your computer and insert it into the USB port of the network storage device you have assembled.

5. Booting the NAS for the first time

Connect the keyboard, as well as the monitor, to the NAS storage you have assembled and connect it via a LAN cable to the router. Turn on the NAS and immediately press the Del button several times to enter UEFI settings.

In the “Advanced/Super IO Configuration” item, change the “Serial Port” value to “Disabled” - otherwise FreeNAS will not start. After that, in the “Boot/Boot Option” item, select the flash drive, save the settings and reboot the NAS.

After rebooting, you will see a text menu and an IP address where you can access the FreeNAS web interface.

6. Basic parameters

Open the web interface in a browser on your computer. In the “System/Settings” item you can change the language to Russian. In Time Zone, select necessary settings. After clicking “Save” and pressing the F5 key, the Russian-language interface will load.

7. Setting up disks

Using the "Storage/ZFS Volume Management" button, you can allocate disk space. First enter “Volume Name”, then click on the “+” icon next to “ Available drives" After that, in the “Volume Planning” section you will see the connected disks. Drag the round silver button up and to the right until all the disks are next to each other. For maximum fault tolerance, select “RaidZ2” from the menu.

8. Create a user account

In the folder tree, click “Account/Users/Add User”. In the “User Name” and “Full Name” items, enter “Guest”, click next to “Home Directory” on “View” and select the volume created in the previous step.

Activate the “Disable password login” option and confirm your choice by clicking “OK”. Click at the top on the “Storage” icon and on the previously created volume, then at the bottom on the key icon with the “Change permissions” disk. In the dialog box, select "Guest" next to "Owner (User)" and "Owner (Group)" and click "Edit."

9. Setting up CIFS

Then create a new share with any name in the “Shares/Windows (CIFS)” item and specify the previously created volume as the path. Activate "Allow Guest Access" and "Guest Access Only".

Then click on the Services button at the top and the wrench icon behind CIFS. Select the “Anonymous” option in the “Authentication Model” line, enter the NetBIOS name and workgroup of your PC.

For the guest account, select "Guest" and enable the "Allow blank password" and "Include home directories" options. In the “Home Directories” item, select the previously created volume.

Finally, activate CIFS using the Services button at the top. The network share will now appear in Windows Explorer by the address "\\\".

Tags nas

As you guessed from the title, today we will build home NAS server. For more than five years I have had a small old animal in the In Win BQ656 Black Mini-ITX 80W USB/Audio/Fan + External remote control case. It has the following processor inside: AMD Athlon(tm) Dual Core Processor 4050e, with a BogoMips reading of 4200. Although tiny, it eats little and can virtualize, which is important. Detailed Specifications you can watch it anywhere :). By the way, after assembly I wanted to change it to a slightly cooler Athlon 64 X2 6000+. You can buy one on Avito for 500–700 rubles. We raised this whole thing on the Minix780G-SP128M motherboard.

Not a fountain, of course, - only four SATA and no RAID support, but low power consumption. The price today could not be determined, but at one time it cost $220. Ideally, of course, it would be better to have a mother with the ability to connect six drives and RAID support. But such pleasure will cost quite a bit. Let's try to estimate from what is on the used market. They offered a kit for Intel 7600 + Asus mother can be purchased for 1500–2000 rubles (let me remind you that this is used).

Before replacing the case, the system consisted of an Ubuntu server, balls on it - and, in fact, that’s all. Inside there were two 500 GB disks. Now purchased new building, a couple more hard drives are installed. Total three HDDs of 500 GB and one of 1.5 GB.

Wishlist

Among the tasks that a media server must solve, we highlight the following:

  • of course, Samba, distribution of media content over the network, more on that below;
  • virtualization of various levels: a couple of virtual machines, inside there may be a 1C Linux server, Docker containers;
  • so that you don’t have to configure each home node for services, a small DNS with the something.local zone.

Hardware requirements:

  • noiselessness;
  • convenient installation/replacement of HDD;
  • compactness.

I repeat: I would really like to replace the motherboard with the processor, but this is not necessary. Perhaps in the future I will replace only the processor with the cooler. So, a new building, the search was long and difficult. After a week of Googling, the choice fell on Raijintek Metis. What suited me in terms of price/quality.

A couple of phrases about the building

Manufacturer and model: Raijintek Metis, with window
Material: aluminum, steel
Dimensions: 190 x 254 x 277 mm (W x H x D)
Form factor: Mini-ITX
Drive bays: 1 x 2.5/3.5" (internal), 2 x 2.5" (internal)
Fans: 1 x 120mm (rear, pre-installed)
Weight: about 2.8 kg

Cool design and color look great almost anywhere, and the price is very affordable. By the way, such a case cost me only 4,000 rubles. Purchased on Avito, delivery by mail. More details about the case can be found on the manufacturer’s website. I almost forgot about the memory! At the time of writing, 2 GB were installed (two 1 GB sticks). Now I’m already ordering two 2 GB dies.

Implementation of the software part

So, what is the most important thing you want from a server? So that it is easily scalable, keeps up with the times, pleasant and easy to use/administer. An attractive web face is desirable.

  • Option 1: install Ubuntu Server with the Ajenty 2 control panel and deliver everything you need by hand.
  • Option 2: install OpenMediaVault. The muzzle is available, there are many plugins/extensions to increase functionality, it is based on Debian, so there is always the opportunity to deliver or finish it by hand.
  • Option 3: install FreeNAS. A little less goodies, but you can deliver everything by hand, though it’s a little more difficult. Based on FreeBSD.
  • Option 4: install XPEnology. A huge number of goodies, repositories with additions. Support for virtual machines and Docker.

After much torment, the choice fell on the fourth option. On it we will raise home server Further. Why is this so? The first option is good in itself, but at the same time you want a minimum of effort and a maximum of opportunities without additional force. In addition, Ajenty does not allow you to access the server flexibly, so you just want to jump into the console and do everything manually from there. And then go to the panel and just admire :). Among the remaining options, XPEnology won. Provides maximum services with minimum settings.

Let's take off

So, first of all, go to the xpenology.me website in the downloads section and download the deployment kit.

XPEnoboot is an image boot disk to install and boot/reboot the server.

DSM is the system itself. Synology Assistant - optional, the program detects XPEnology/Synology servers, installed or ready-to-install nodes. I installed it via the web interface - as they say, all markers have different tastes and colors.

The ISO image needs to be unpacked onto a USB flash drive and used every time the server is restarted, which is not entirely convenient. Or donate a flash drive to the server and make it a priority when loading. There is a second way. In previous issues of Hacker magazine, I wrote about organizing a PXE server with various boot options. If there is such a service, then you can easily give it to him. Two files are responsible for loading into XPEnology (as in any Linux distribution): zImage and rd.gz. We place them in the PXE server directory and add the following to the menu:

Insert into pxelinux.cfg/default LABEL xpenolog kernel xpenology/zImage root=/dev/md0 ihd_num=0 netif_num=2 syno_hw_version=RS3612xs ac1=0010562E3E36 mac1=0051562E3E37 sn=B5JDN10005 initrd xpenology/rd.gz

The menu makes clear the location of the files in the xpenology subdirectory, relative to the root of the TFTP server. Information was found on xpenology.com. I recommend checking it out.

The first option didn't work. I'll try it differently. I unpack the ISO, take the menu file isolinux.cfg from there, copy the menu into my PXE menu, with the path to the zImage kernel file adjusted. I copy the zImage to the PXE server. This option worked as it should; after the installation began, even the operating system pat file was not required. The server itself downloaded it from synology.com, which makes me smile :). During the installation process, the server will ask you to enter administrator credentials. After installation, we get a completely ready-to-use Synology server on regular hardware. For those who are not familiar with this OS, I highly recommend it! Huge community. As a result, there is a large number of repositories that greatly expand the standard functionality.

Continuation is available only to members

Option 1. Join the “site” community to read all materials on the site

Membership in the community within the specified period will give you access to ALL Hacker materials, increase your personal cumulative discount and allow you to accumulate a professional Xakep Score rating!

Part Two: Software

Spit in the eyes of anyone who says that you can embrace the immensity
Kozma Prutkov

To whom and why

Your home NAS should satisfy you; it is not a production system that must provide certain formalized indicators. There are two difficulties in describing such a thing. One is included in the epigraph, and the second is related to the acute shortage of telepaths. But I will still try to make some reasonable assumptions, and they will pass the IMHO category. To save space, I omit “IMHO” further. We believe that every sentence has this label. If it was not possible to see the light in your specific case, I apologize; perhaps another text will suit you.

This one is addressed to those who are assembling their first NAS, capable of installing Windows, but have never seen the FreeBSD Handbook or Oracle Solaris ZFS Administration Guide. NAS is also assembled by IT-advanced citizens; they usually deploy the full version of the selected operating system. It’s interesting that some newcomers get involved in the topic and eventually do the same.

Tasks

To avoid misunderstandings, let’s immediately determine why we need NAS.

The first task is secure storage. The data must survive a hardware problem, such as disk failure.

Second - give access to stored data. Support for SMB/CIFS for Windows is required; NFS (for media players), FTP (for downloading large amounts of data) and AFP (if you have a Macintosh at home) are highly desirable. DLNA is often mentioned, more on that separately.

Third - offline download documents from the network using various protocols.

Fourth - automate backups from computers in local network . Family photos, videos, documents created by you are unique and irreplaceable, but at home it’s all well stored in one and a half copies: one on a laptop drive, half on some kind of USB drive where the photos were uploaded last fall. If (more precisely, when) such data is lost, and the NAS allows you to restore it, you will experience sincere pleasure from your foresight. Or vice versa.

Requirements

Moderately difficult initial setup. A person should receive a working version on the first day. Maybe not completely tuned, but giving a useful result. This, by the way, means that the user who has become proficient must initial setup handle it in a couple of hours.

Simple and sufficient current management, everything necessary must be done through the web interface. Including saving and, if necessary, restoring the configuration. For special, expert purposes, access via SSH or similar is desirable.

Transparent everyday use. Your better half with a liberal arts education should be able to handle it: watch a movie on TV, listen to music, backup from her laptop to the NAS should be done automatically, etc.

DLNA/UPnP

Understand, What exactly you need from a DLNA server, really only by testing. Most of the tasks of the average user, such as transferring media to a tablet, are solved by almost all UPnP servers. And regarding the use of DLNA for output to a TV, I will quote the developer of HMS, one of the best software UPnP/DLNA media servers: “For owners of TVs from most manufacturers, the use of this technology is a temporary stage that ends either with the purchase of a network media player (I think, the preferred option) or by connecting the TV as a monitor. If time and nerves are precious, then it might be worth skipping this stage» . The capabilities of a player built into a TV and an inexpensive separate one, like Dune, Popcorn or WD, in terms of omnivorousness, picture quality, ease of use, etc., usually vary greatly. True, built-in players are progressing quickly, so it’s worth deciding on specific hardware.

Disk arrays and file systems

Why do we need an array?

The main issue when building a NAS is the organization of disk space. How we found out in part 1, there are a lot of disks, 4-6, sometimes 10 or more. They can, of course, be used separately. But combining into an array is convenient because the space is available in one piece. In an array without redundancy, when a disk dies, the data on it and, often, depending on the implementation, on the entire array are lost. You have the right, using the “nothing, I’ll pump it over” argument, to save on redundancy. Those for whom time is more valuable prefer arrays with redundancy. Important: no RAID can replace backup. RAID ensures data availability in the event of disk failure. Unrecoverable data must be backed up. Fortunately, there are usually very few of them.

The term redundant array is often confused with the term RAID. But more advanced technologies are also available. When choosing NAS software, you can use them or do without it. To understand what is best for you, let's think about the problems of RAID and file systems.

RAID 5 (6, etc.) is subject to a serious problem. When writing to an array, data and parity blocks must be written simultaneously. But writing to multiple disks is not an atomic operation. If a problem occurs during the writing process (power failure, disk failure, etc.), it is possible that the data and parity blocks will not match each other. If data is written incorrectly, in many cases it can be corrected or at least detected when servicing the file system located on top of the RAID (chkdsk, fsck...). But incorrect parity blocks, in the worst case, can go unnoticed until the moment when the array is reconstructed from them. And instead of data, garbage will be restored. Moreover, the garbage will be recorded without any warning. Additional information according to problem can be received .

Fig 1. RAID write hole. On the left - data and parity blocks are synchronized, recording is in progress. In the center there is a power failure. On the right are data and parity blocks Not are synchronized, but RAID doesn't know about it.

Industrial RAID controllers solve this problem by using a BBU, a “battery.” After a failure, even with the power off, the controller remembers what data should have been written. And when the opportunity arises, it writes this data to an array.

Reconstruction failure

Let us have a RAID 5 of five 3T disks, in which one of the disks has failed. The array must be rebuilt, and in this case you will have to read 4 disks × 3T = 12T = 1.2 10 13 bytes = 0.96 10 14 bits of information, regardless of the degree of filling of the array - after all, nothing is known about the files at the RAID level. Healthy user-class disks have the legal right to fail once every 1·10 14 bits on average (see, for example). That is, with very high probability we will get a reconstruction failure simply due to the disk specification. Plus there is some possibility that the disk will actually break. The traditional recipe: use enterprise-class disks (with a probability of failure of 10-15), do not get carried away with high-capacity disks and use RAID 6. Unfortunately, all three tips for the price are not very suitable for home conditions.

Reliable file system

Let's move one level higher, to the file system. They expect a simple thing from it - the ability to write files and then read what is written. Paradoxically, most file systems do not guarantee this: they rely on the ideal operation of the equipment - the disk controller, the cable, the disk itself. A hardware failure doesn't just lead to data loss - it leads to unnoticed data loss by the user. You copy your photo archive - but in fact, some of the files are already rotten. You can find out about this by comparing checksums, what we do when downloading firmware and similar data that cannot fail. Why not compare checksums using FS?

Another “childish” wish for the FS - that it work and not break - is also not really fulfilled. A file system without journaling, such as FAT or ext2, can bury all its contents if it fails. Journaled file systems, such as NTFS or ext3, are much more reliable because... you can find the point of consistency and reproduce the log. Is it possible to create a FS that cannot get into a contradictory state at all? You can - via Copy-on-Write. We do not write the data on top of the old ones, but select a new block, write there, and if everything is in order, we replace the pointer from the old data to the new ones.

ZFS

ZFS combines the functionality of a file system and support for RAID-like arrays. Distributed under a free license (CDDL). Created by Sun Microsystems for Solaris. Ported to FreeBSD since version 7.0. Just recently, the ZOL (ZFS on Linux) project reached the release stage. We can expect the rapid spread of ZOL, the process has already begun. There is also a project for Mac OS X, ZEVO, see.


Figure 2. ZFS automatically compares checksums, detects errors, and recovers data if it is stored redundantly (Figure from eonnas.com).

Take a closer look at ZFS if you are interested in a file system with the following capabilities:

  • storing checksums and not allowing garbage to be read instead of data;
  • maintaining integrity to such an extent that there are simply no utilities like chkdsk or fsck for it;
  • equipped with a tool for checking the integrity of cold data and its automatic correction if the data is stored redundantly;
  • capable of instantly creating snapshots of your state and storing them for at least every minute of the month, mounting any set of snapshots, and rolling back to the snapshot.

Take a look at ZFS if you're interested in RAID:

  • software, i.e. does not require a hardware controller;
  • hardware-independent, there would be SATA ports;
  • without Hole by appointment;
  • capable of reconstructing a degraded array with partially unreadable disks with the loss of only those data for which there is no copy;
  • working when checking integrity and reconstruction only with payload data, and not with the entire array;
  • with support for analogues of RAID1 (mirror), RAID5 (redundancy in the size of one disk), RAID6 (two) and even “RAID7” (saving data if any three disks of the array fail), as well as more complex options like RAID50 or RAID60.

ZFS also has disadvantages, the main ones of which are:

  • You cannot expand a RAID-Z array onto one disk. You can replace all terabyte disks with triters - and increase the volume. You can assemble another RAID-Z from 3 (or more) disks and add it to the existing one, creating a single pool. But you can turn a RAID-Z1 of 5 disks into a RAID-Z1 of 6 only by leaking information somewhere, destroying the array and creating a new one.
  • The array cannot be reduced. You can only increase it - add disk groups, change disks to larger ones.
  • Resource intensity. ZFS constantly calculates checksums, which creates a load on the processor and uses memory for caches. At home I worked with an Atom 330 and 2 GB of memory. Although when using ZFS this Atom was not enough for me to fully utilize the gigabit network, 40-50 MB/s will suit many.

Yes, also: if you destroy ZFS and create from the same disks new array(that is, give a couple of commands and/or press buttons in the web interface, in both cases ignoring warnings), then the data from the destroyed FS will be securely buried - unlike, for example, NTFS, the data from which is relatively easy to recover even after re-creating the table sections. Whether this is considered a disadvantage depends on your point of view.

According to the author, the goodies provided by ZFS are so tasty that they are worth paying for additional requirements to the iron. And you should only build a NAS with ZFS. But the reader has a fundamental right to free choice. This choice will be decisive when choosing software for the NAS, so it should be made consciously.

ReFS + Storage Spaces

In Windows Server 2012, Microsoft offered ReFS and Storage Spaces volume management system. The combination of ReFS and Storage Spaces can be considered to some extent an analogue of ZFS, with properties not implemented in the latter. The flexibility of removing and adding disks, thin provisioning, etc. is interesting. There are also disadvantages - this is a proprietary license, available only as part of Windows Server 2012 and Windows 8.1.

It’s bad that, judging by the reviews of those testing, the performance of the ReFS-Storage Spaces combination drops significantly, significantly, when using options with parity, that is, roughly, an analogue of RAID5 or ZFS RAID-Z. Even worse, the first reports of data loss due to ReFS failures appeared, and official support did not solve the problems. So it looks like an interesting solution needs to mature.

btrfs+mdadm

Officially, Btrfs for Linux has not yet received release status, although it has been in development since 2007. Like the vast majority of file systems (and unlike ZFS), it is a file system created on top of a block device. To get, roughly, an analogue of ZFS, you need to add, for example, a well-debugged mdadm, one of the capabilities of which is to rebuild the RAID when adding a disk without losing data.

Traditional FS

And, of course, the existence of advanced FS does not force you to choose one of them. Perhaps NTFS, ext4 or UFS is more suitable for your NAS - the native file system for the axis you choose. On relatively weak hardware, this choice may be the only one.

Software options


Fig 3. Approximate algorithm for choosing software for a home NAS

What and how to choose from

I would like to recommend downloading VirtualBox, installing several options you like there, and poking each one with a stick for several days. On a virtual machine it is cheaper, easier and faster than on real hardware. Seriously saves nerves. Especially if you don't like any of the options.

Three groups of software products can be used as self-assembled NAS software.

Firstly, you can install the full operating system. This could be Linux, UNIX or Windows depending on personal needs and preferences. Windows seems more familiar, *nix gives you more NAS for the same money, but configuring *nix from scratch is not a task for a beginner.

For such a beginner, option number two has been created - assemblies preconfigured specifically for NAS. They include a set of services and a web interface that allows a beginner to cope with setting up and using the product without a command line.

Finally, the third option is to install a full operating system, and on top of it some kind of web interface for configuration and management. The option is a compromise, an intermediate one. It makes it easier to use, but not to a level sufficient for an inexperienced amateur. And advanced citizens usually don’t like any kind of add-ons. We'll start with options for mere mortals.

Windows

In the profile thread, a survey was conducted about the operating systems used by forum members in self-assembled NAS systems, and Windows took third place with a result slightly below 20%. Of course, more advanced comrades also voted, but they were definitely not the majority.

A result that can surprise. Windows is the most familiar to most operating system. You can make a NAS based on it - after all, 20% of respondents did it. The reason for the modest figure is that using Windows As a NAS axis there are not only advantages, but also disadvantages:

  • Windows is a paid software that competes with free software that is in many ways more functional for specific tasks.
  • Supports the existence of viruses, which requires constant loading of anti-virus databases.
  • Requires constant use of updates, and after them a reboot is often necessary. This is not to say that all *nix systems can work without intervention and reboot for years. But many can.
  • Windows is a graphical system and requires a monitor, keyboard and mouse to function naturally. NAS usually lacks them. But of course, there are remedies to solve the problem.
  • Windows is resource intensive.
  • Disk arrays and checksums at the file system level are not the strongest Windows place, especially in desktop versions.

Disadvantages are not fatal; they can be overcome, bypassed, ignored, in the end. But enough to consider other options. And discover their virtues, and commit a lot of discoveries, sometimes without meaning to.

Giving an incomplete list of the advantages of Windows, in addition to familiarity, we can mention:

  • Native high-speed SMB implementation.
  • Hardware compatible. Drivers for Windows must be written.
  • Wide selection of software. That is, for NAS usually large selection and it's not necessary. But the more specific your requirements, the more likely it is that they can be solved with software for Windows.
  • A huge variety of instructions and solutions for all occasions, in your native language.

NAS on Windows is entirely possible. But the topic Windows settings disclosed in many sources, which will allow the author to risk refraining from discussing it.

Ready *nix builds for NAS

The most popular in the profile branch are three assemblies - NAS4Free, OMV (=openmediavault) and FreeNAS 8.x. All are aimed at the average amateur and allow you to satisfy typical needs either out of the box or by downloading plugins.

There is a history of confusion surrounding the FreeNAS brand. The FreeNAS product evolved over many years and then split for a number of reasons. The well-known name, which is a trademark, became the property of iXsystems, which decided to completely rewrite the code, and original development close. This is how FreeNAS 8.x was born, based on FreeBSD 8.x. However, the original project, thanks to the efforts of enthusiasts, survived, was transferred to FreeBSD 9.x and is successfully developing under the name NAS4Free. As a result, upgrading from FreeNAS 0.7 is supported on NAS4Free, but not on FreeNAS 8.

A detailed, including Russian-language, description of the installation and configuration of assemblies can be found in the FAQ of the profile branch and, so we will save the text here.

We will summarize the official hardware requirements for these three products in a table, especially since they are not so easy to Google.

And, of course, you need disks to store data. It seems that the FreeNAS developers are not specifying the requirements for it to just start working, but for it to work productively. In any case, the instruction manual for installing on a virtual machine indicates the minimum size random access memory in 512 MB.

NAS4Free

NAS4Free distributed under the free BSD license. The project has a long history (comes from m0n0wall, FreeNAS 0.7, 0.6 and earlier), the major digit of the current version is 9. That is, the assembly is well polished, but continues to develop. Based on the latest release of FreeBSD 9.1.

NAS4Free is compiled in two versions, for 32- and 64-bit Intel x86-compatible processors. You can use NAS4Free in three ways: LiveCD/LiveUSB, full and embedded. The “live disk” mode is traditional for *nix distributions and is intended primarily for familiarization. In actual use, installation is usually done. The full option is a traditional installation, usually on a hard drive. For installation, a small partition is used, the size of which is set during installation, and a swap partition, and the rest of the disk is available for data. You can install full on a USB flash drive, but due to intensive recording, the flash drive will wear out in a few months.

The embedded installation option is intended for installation on a USB flash drive. When the system starts, a small disk is created in memory, where the system image is copied and immediately configured according to the parameters collected in a single configuration XML file. And then it loads from this disk into memory. This approach has merit. The system is very convenient to deploy - the system flash drive can be written to another machine. The system state is collected in one text file, so it is very easy to save and, if necessary, use to restore the system. The memory disk is very fast, and the system flash drive practically does not wear out.

The downside is that almost any changes made to the system other than through the web interface are lost after a reboot. The developers partially solved the problem by providing the ability to save many parameters in the web interface. The problem can be partially circumvented by using tricks such as combining disk folders in memory and folders on real media via unionfs and using automatically launched command scripts. More advanced users use virtualization to install anything, even a couple of Windows, in jails or separate virtual machines. TheBrig extension greatly simplifies the setup and use of jail for installing additional software. But this still requires knowledge comparable to that required to deploy a complete system. For a beginner, it is more correct to assume that NAS4Free only has those services that are included initially, everything is configured via the web interface, and nothing can be added.

List of what's included out of the box:

  • WebGUI (management and configuration);
  • Disks and arrays: ZFS v28 (mirror, RAID-Z 1, 2, 3...), soft RAID 0, 1, 5 and mixture (1+0, 1+1, etc.), disk encryption (using hardware acceleration, if present), file systems ZFS, UFS, ext2/3, FAT, NTFS, iSCSI initiator;
  • Network protocols and services: SMB/CIFS (Samba) - for Windows machines, AFP (Netatalk) - for Mac OS, NFS - for *nix, FTP (ProFTPD), TFTP (tftp-hpa), Rsync (client/server) - a powerful tool, including backup, SCP (SSH), iSCSI target;
  • Services: UPnP server (FUPPES - admittedly, mediocre), Webserver (lighttpd), Network bandwitdh measure (Iperf), Bittorent client (Transmission);
  • Monitoring: S.M.A.R.T (smartmontools), E-mail alert, SNMP, Syslog, UPS (NUT).

You can see in the list almost everything you might need from a home NAS. But the most important advantage is the use of the ZFS file system. A relatively weak point of NAS4Free is the included UPnP/DLNA media server. From personal experience, it works quite well and will satisfy most needs, but if you need special goodies, you have to look for something else.

I wrote detailed, with pictures, instructions for setting up. Described as basic setup, as well as tricks like installing homemediaserver in Windows virtual machine or TorrentMonitor in jail to automatically download TV series as updates are released.

FreeNAS 8

FreeNAS 8- a build based on FreeBSD 8.3, created and developed by iXsystems. The company is also developing paid version. For a long time, the free FreeNAS was artificially seriously limited. FreeNAS 8.3, released in October 2012, has been significantly improved and provides the functionality necessary for a home NAS. FreeNAS has excellent English documentation. The commercial roots of the product can be traced in both high hardware requirements (6+ GB RAM) and a focus on functionality used in business. Typically, home services such as bittorrent and UPnP/DLNA media server are implemented as additional modules, each in its own jail. Work with jail is carried out through the user interface and, like the entire project, is well documented.

UPD: FreeNAS 9. Most recently, on August 5, 2013, FreeNAS 9.1.0 was released, and on August 27, release 9.1.1 containing error corrections was released A new version uses FreeBSD 9-Stable and, according to the developer, contains significant improvements in stability, extensibility, ease of use and performance. We plan to test performance in part 3 of the article. The hardware requirements of FreeNAS 9.x have not changed compared to FreeNAS 8.x.

FreeNAS 8 is installed on a flash drive with a capacity of at least 2 GB and occupies it entirely. A nanoBSD image is used, deployed into RAM, which protects the flash drive from wear and tear. Although there is a 32-bit version, it is intended more for evaluation purposes. For real-world use, the 64-bit version is recommended, in part due to memory requirements that are incompatible with 32-bit architecture.

Out of the box functionality is close to that of NAS4Free. The difference is the availability of two UPnP servers to choose from (FUPPES and miniDLNA) and the absence of a web server (the developers promise to add one over time).

ZFS disk pools created in NAS4Free can be imported into FreeNAS and vice versa, preserving the data. There are few FreeNAS 8 users in the profile thread, and some complain about problems (see FAQ thread). However, it has not yet been created software product, which at least no one would complain about.

OMV

OMV(on the forum site) is based on Debian Linux, which provides rich functionality and extensibility. The product is created and maintained by Volker Theile, formerly one of the leading developers of FreeNAS. Distributed under the open GPL license.

There is no support for ZFS in the product, and, according to the developer, it is not planned, which seems to be its main drawback. You can find a hack online for installing zfsonlinux on OMV.

OMV is installed on a hard drive or USB flash drive, and takes up the entire media. This installation does not look optimal either for a disk or a flash drive. Weird to use all hard a disk for a system that only needs a gigabyte. It is scary to install a product on a flash drive that writes intensively to it. However, for both problems, enthusiasts have developed hacks that solve these problems: a special script brings write-intensive directories into memory, and simple editing of the distribution allows you to create system disk section for data.

There is no particular point in describing the functionality of OMV. Basic functionality similar to NAS4Free and FreeNAS, with the notable absence of ZFS, is available out of the box or as a set of add-on modules. But OMV is essentially Debian, a variant of Linux for which there are an incredible variety of applications. They can be installed in the standard Linux way.

An important advantage of OMV over the above-mentioned assemblies is the ability to utilize a gigabit channel on fairly weak hardware, such as an Intel Atom with a gigabyte of memory (cf. the padavan assembly in the first part of the article).

Other options

In addition to the three most popular assemblies, there are many others. The author practically did not consider paid options; their popularity is low. We can mention that it is free in the basic version, up to 3 discs, and not prohibitively expensive in the paid ones. This is not quite a NAS, but a solution that allows you to keep a home file dump on different-sized disks, including those formatted in NTFS, and also add disks to the system. Moreover, due to the presence of a parity disk, data survives the death of any one disk.

Many free builds are at an early stage of development, which does not allow them to be used by an amateur. A potentially interesting example can be given. This is a Linux (CentOS) project with zfsonlinux integration. If and when the author brings the product to release, it could become an interesting alternative.

Many NAS builds are rooted in corporate applications. For a home this can be a disadvantage. It’s not so bad that the emphasis is on functionality, which is of little interest at home. What’s worse is that what you need is missing from the box, and adding it is difficult. Most often, such assemblies lack a torrent client and a DLNA server. An example is , which also differs in the paid documentation.

If, like the author of these lines, the presence of ZFS seems like a must-have NAS functionality, then sooner or later attention turns to options that have roots in Solaris. All Solaris derivatives were marked by the strangulation of OpenSolaris by Oracle after the purchase of Sun. Most went through a difficult phase by switching to the Illumos codebase, some died out, but that's another topic. There are several options here, for example. Pros - performance with a slightly smaller appetite for hardware compared to options on FreeBSD and Linux. Cons - narrower list of hardware and software compatibility and relatively high requirements for the administrator. So high that it is usually much easier to deploy a system on a full OS.

A special feature is the use of modified software from purchased NAS on standard hardware. The author is not a lawyer to fully evaluate the details of the application of licenses, so just in case we will do without links. But for a non-lawyer, the picture looks very similar to the situation with OpenWRT. Original firmware written by NAS manufacturers based on open source with GPL license. Under the same license, the result was published in source codes. Enthusiasts, again under the GPL license, take this code, modify it and publish the result. This result is a generally working Linux-based build that can be installed on bare metal, a virtual machine, or a suitable NAS from another manufacturer. The latter, by the way, has been practiced for many years and is still not covered up - probably precisely because of the absence of legal violations in such practice. The advantage of this option is price, but there are also disadvantages. Firstly, in addition to the GPL code, the purchased NAS also contains proprietary code, mainly for communication with hardware. Therefore, such assemblies have problems with switching to sleep mode, saving energy, regulating fan noise, etc. Secondly, a purchased NAS from a leading manufacturer also provides Internet services, intended, naturally, only for buyers, and not for everyone. So exactly the same thing does not happen as a result of installing such an assembly; rather, this is an option to try, including in a virtual machine.

Web interface for full OS

Members of the profile thread more or less actively use ZFSguru and napp-it. There are undoubtedly other products available, starting with . But they are less suitable (or not at all suitable) for the purposes discussed. And the author has not encountered them, see epigraph.

ZFSguru

Uses FreeBSD. The product today is a convenient FreeBSD installer that allows you to install complete system on a ZFS pool, for example on a mirror, configure data pools and get a high-quality semi-finished NAS. Semi-finished product - because some of the basic functionality for NAS has not yet been implemented and is planned for the indefinite future. You will have to connect to UPS manually, network access to files, etc. High-quality - because what has already been done is done well.

napp-it

The project looks like a rare exception in terms of its level of readiness. The product allows you to literally turn a clean installation of a Solaris-like operating system into a NAS with ZFS with just a few clicks of buttons. The current version recommends using OmniOs or OpenIndiana, supported with some limitations by Nexenta, Illumian and Oracle Solaris 11.1. The secret, apparently, is that the developers successfully commercialized the product. Basic functionality is free, extensions are also free for home use, primarily the UPnP server Mediatomb. Extensions for purely corporate purposes are paid. Based on the results of short tests by the author on a virtual machine, the impressions were positive. But diesel fuel is diesel fuel. In the repositories, even the transmission is quite bearded, and a more or less modern one needs to be assembled, which the author did not have the curvature of his hands for. Comrade padavan somewhere on the forum described passes with a tambourine, which allowed him to solve the problem, but, as they say, what is allowed to Jupiter is not given to the bull. So, although napp-it greatly adds friendliness to Solaris-based NAS, without significant UNIX experience it is better not to jump into this cart.

Full *nix system

Here it is briefly. To teach a scientist is only to spoil him. A *nix server product from scratch at home is built either by people with professional experience or by advanced amateurs whose hobbies no longer fit into the sandbox finished assembly(or boxes) with frills sewn onto it. Judging by the profile thread, they work with a wide variety of software. Often combined through virtualization strengths and/or developed functionality of products under different OS.

Virtualization on NAS

Using virtualization in NAS is a natural practice for an advanced user. Maybe, simplest option- install VirtualBox with a PHP web interface on the NAS and raise several virtual machines that do things that are difficult or impractical to do on the main axis. First of all, launch more or less exotic software. Special extensions have been written for NAS4Free and OMV that make virtualization feasible for an amateur. Of course, VirtualBox can be installed on almost any full axis. The task of controlling a virtual machine via the monitor, mouse and keyboard of a desktop computer is solved even easier, including using a VNC client. The downside of VirtualBox is the significant performance hit compared to bare metal systems.

The second option is soft virtualization via FreeBSD jails. Owners of full-axis systems more often use cells for their intended purpose, to isolate potentially dangerous processes, such as a web server, accessible from the outside. Assemblies use cage mechanism to bypass installation restrictions additional programs. In FreeNAS this is a boxed functionality; for NAS4Free an extension (TheBrig) has been written that integrates into the web interface.

Finally, a virtualization option that goes beyond the NAS, quite popular in the profile branch, is called “” at the suggestion of the developers. Briefly - ESXi is installed on hardware, it raises virtual machine, whose sole task is to create ZFS storage. To do this, a disk controller is forwarded inside it, and the disk space is exported via file and block protocols for other virtual and real machines. If you don’t understand why such perversions are needed, you definitely don’t need it.

Total

If you have at least read that many letters diagonally, then you will be 99.9% successful in creating a home NAS. There would be a desire. Good luck, and if anything happens, please contact the relevant thread.

I would like to express my gratitude to all participants in the profile thread on the forum.. Sh, TPAKTOP, iZEN and RU_Taurus for many useful comments.

Special thanks to the developers of free software: Olivier Cochard-Labbé, Daisuke Aoyama, Michael Zoon, Volker Theile and many others. They made the very existence of the DIY NAS theme possible.

In almost any local computer network, a file server is in demand. Data storage is also necessary in a “homemade” network - on the scale of a home, village, school, or holiday village. This is simply convenient when there is a separate storage for “heavy” content - HD videos, music, software, etc. But a branded file server is not a cheap pleasure. You can save a lot of money by turning your old PC into a home file server. To do this, you just need to install special software and configure it.

In fact, we will make our own NAS (Network Attached Storage) - network system data storage, network storage. That is, a computer with some disk array connected to a local network and supporting operation according to the protocols adopted in it.

In our example, we use the FreeNAS distribution to organize a NAS. FreeNAS is a free operating system for network-attached storage. FreeNAS is based on FreeBSD using Samba and PHP, and supports software RAID. It can be accessed via CIFS (SMB), Apple Mac AFP, FTP, SSH, iSCSI and NFS protocols. To run FreeNAS, you need a computer with an i386 or x86-64 processor, with at least 128 MB of RAM and 500 MB of disk space. It also requires the ability to boot from an optical drive.

We will look at installing and configuring the 7th branch of FreeNAS. Since FreeNAS is based on FreeBSD, the list of supported hardware is the same. As practice shows, for normal operation of the system, at least 512 MB of RAM is required. For a home NAS, 1-2 GB of memory will be more than enough.

The main component of a home NAS is hard drives. It is clear that, if possible, you should choose capacious HDDs with big buffer and a rotation speed of 5400-5900 RPM - they will not make much noise and heat up during operation. But the advantage of the described system is precisely that it can be assembled from a bunch of various old hard drives, combining them into a disk array. At the same time, for SATA drives it is worth setting the BIOS to IDE compatibility mode.

FreeNAS does not require a powerful system - an old Pentium or Athlon will suffice. If the NAS system is being built from scratch, a board with an Intel Atom chip and passive cooling- such a platform will be quiet, cool and energy efficient. It also makes sense to reduce video memory to a minimum. During installation we will also need a CD drive - then you can turn it off.

Having assembled the system, install FreeNAS. Download the ISO image of the system, write it to a CD, specify in the BIOS to boot from the optical drive and reboot. The bootloader offers several options for starting the system. When booting into default mode, FreeNAS displays the main menu.

We select the Full installation option and indicate the disk on which we will install the OS. It is advisable to allocate approximately 500 MB of disk space for the OS partition. Installation only takes a couple of minutes, after which you need to reboot. Optical drive You can already turn it off.

The first step is to change the network interface settings. We select item number two in the menu - if the local network has an addressing different from 192.168.1.0/24. It is best to set a static IP address for the file server - just remember to specify the address of the default gateway and DNS server.

Once these settings are applied, the monitor and keyboard can also be disabled. Next, all setup will take place only through the web interface at http://ip-address-NAS/ (we set it earlier). The default login is admin, password is freenas.

Having entered under them, we go to the System > General Setup section. There we change the interface language, set the clock, and, if necessary, enable synchronization with the NTP server. We save and update the control page. Don’t forget to change the password to enter the web interface, save again, exit and log in again.

Now you need to connect the swap partition. We go to the “Diagnostics” > “Information” > “Partitions” section and look there for information about the disk partition. Our disk is divided into three sections of different sizes - for the OS, data and swap. Determine the path to the swap partition. The disk name in our example is /dev/ad0 (it can be seen at the top); judging by its size (256 MB), it is clear that the third partition is used for swap. The path to it will look like /dev/ad0s3. During installation, this path was shown to us immediately after formatting the disk. Go to the path "System" > "Advanced" > "Swap file", select the device type and specify the path. Let's save.

Now you need to add disks to the system. Go to "Disks" > "Management" and click on the list. Select the required disk from the list. Enable SMART support. If you use only one disk (on which the OS is installed), select UFS with Soft Updates. When adding another, already formatted data drive, you must specify the appropriate file system type. Click "Add".

If the system was assembled using disks that have not yet been formatted, then go to the "Disks" > "Format" section, select required disk and format it. Experts recommend using UFS, although it is not required.

Next, we mount all the HDDs we used. To do this, go to “Disks” > “Mount Point”, click the plus sign, select “disk” as the type, then the drive itself, indicate the partition number and file system type, and also enter the name of the mount point. Note that for each disk they must be unique. Click the "Add" and "Apply changes" buttons. Basic installation FreeNAS is complete.

Now let's open access to the NAS over the network. To do this, you will need to enable the CIFS/SMB (NetBIOS) service. In the settings, change the name of the workgroup, the name of the NAS on the network, set the encodings, enable the time server and enable AIO. Leave other parameters as default, and then click “Save and restart”. Next, you should add at least one network resource: specify the name and comment, as well as the path to it.

Initially, all mount points are located in the /mnt directory. Accordingly, the path to the root of the drive looks like this: /mnt/mount_point/ (in our case - /mnt/data/). When setting up, it is recommended to create several folders in the root of the disk and add them to network resources. If the NAS contains several disks, they should all be “shared” in the same way.

Now online Windows environment the created file server with full access is visible. To manage files and folders directly from the web interface, use the file manager from the "Advanced" section. The login and password for it are similar to those for FreeNAS users.

SMB resources are used on the local network; For external access, you must enable the FTP server. Accordingly, you need to open TCP port 21 on the router, and also enable the DDNS service (present in FreeNAS). In the FTP service settings, we allow only authorized users to log in. Save the settings.

User management - through the "Access" > "Users" section. For user access to the FTP server, specify ftp as the main group.

In the case of a NAS for a home network (as in our case), it is also worth enabling the Transmission Bittorrent client built into FreeNAS. In its settings we specify the folder where the downloaded files will be stored. Then we select a directory to track torrent files - as soon as a torrent is uploaded to it, Transmission will automatically add the download. The default link to the Bittorrent client web interface looks like http://ip-address-NAS:9091/.

Well, lastly, we set up the UPnP media server. Here you just need to specify the folders with media files and select the directory in which the database of this service will fit. We also indicate a suitable profile for compatibility with network media players. If needed additional settings- click on the link at the bottom of the page with parameters.

When everything is configured, Windows easily identifies the NAS as a network media device and allows you to directly listen to music from it, view videos and pictures.

This whole procedure has been described more than once in various sources on the RuNet. In practice, we used it when we made a collective file server for our home network - in my house it unites more than fifty PCs. We assembled the NAS by stuffing an old desktop with hard drives - mostly not new either. However, everything works quite fine. We installed the assembled file server in one of the apartments - in the same place where there is an ADSL modem serving the home network.

Victor DEMIDOV