Features NAS with Rockstor Lead image: Photo by Lane Smith on Unsplash
Photo by Lane Smith on Unsplash
 

NAS with Btrfs-based Rockstor

Rock On!

Set up network-attached storage and manage it from a web interface with Rockstor, the easy-to-install and free Linux distribution that uses the still new Btrfs filesystem. By Tim Sch¸rmann

Even small companies keep data on a central network storage device. All you need to build a network-attached storage (NAS) solution yourself is a server and the free Rockstor [1] operating system, which is tailored for NAS operation and can be installed on the server with just a few mouse clicks. Afterward, you can manage the NAS conveniently in your browser. Clients and users access the network storage via NFS, SMB/CIFS, SFTP, and AFP.

Additional functions can be loaded with optional software packages. Using what are known as Rock-ons, you can easily add ownCloud, thus extending your NAS to provide a private cloud. Rockstor currently only runs on 64-bit processors with x86 architecture or in a virtual machine. Prefabricated NAS servers with an ARM brain therefore cannot be retrofitted with Rockstor.

Based on Btrfs

Rockstor is based on the CentOS 7 Linux distribution with a more recent kernel version provided by the ElRepo project. Thus, compared with CentOS, Rockstor supports some additional hardware components. The individual Rock-ons run in Docker containers, but thanks to the Rockstor web interface, you don't need to be familiar with Linux or Docker.

Most NAS operating systems (e.g., FreeNAS) rely on the ZFS filesystem, but Rockstor uses Btrfs, a filesystem that is replacing the ext4 filesystem in the Linux world and offers a range of functions similar to ZFS but is licensed under the GNU General Public License (GPL). Rockstor harnesses the capabilities of Btrfs for its own purposes. If so desired, the NAS automatically compresses all data in the background. Thanks to flexible volume management, retrofitted hard disks can be integrated quickly.

Moreover, you can expand or reduce the available storage space for each directory on the fly. Snapshots freeze the current data when needed or at specified intervals. Administrators can thus restore a previous state (rollback) at any time. The snapshots use the copy-on-write (CoW) principle, which means that Btrfs does not copy a file until it is actually changed. Snapshots can therefore save considerable storage space compared with an immediate copy of the complete database. Btrfs also uses appropriate measures to prevent data errors (bit rot).

Graphical Installation

If you want to set up NAS with Rockstor, you first need a server with a 64-bit processor from AMD or Intel and at least 2GB of RAM. Installation is easier if Rockstor can simply take over the entire hard disk. Manual partitioning of the disk is possible but a bit cumbersome with the installation wizard. Rockstor also requires a certain partitioning of the hard disk, which in turn requires Linux knowledge. Rockstor itself requires 8GB of hard disk space.

The NAS system also requires an Ethernet interface to access the Internet so that Rockstor can retrieve updates automatically, among other things.

To install Rockstor, download the installation medium from the project homepage [1]. You will receive an ISO image that you burn to a CD or DVD, or you can write to a USB stick with UNetbootin, for example. If you want to support the project, you can order a preconfigured USB stick from the Rockstor shop. In any case, start the server from the installation medium created in this way and press the Enter key in the Rockstor boot menu (choose the Install Rockstor item).

The installation wizard now appears and should look familiar to CentOS users. The installation process varies depending on the situation on the hard disk: If it is completely empty, the installation starts directly without further questions. In this case, click on the Root Password icon and enter a new password for the all-powerful Linux root user. After entering the password twice, click Done and wait for the wizard to copy Rockstor to the hard disk. Restart the system with Reboot, remove the installation medium, and continue reading the "Administration in the Browser" section.

If partitions already exist on the hard disk, the installation wizard offers the Installation Summary page. First click on Date & Time, where you set the local time zone. After setting your choice of language and keyboard setup, if needed, you are done in the Localization section.

Change to the Installation Destination item in the System section. In the top row, the built-in hard disk should already be checked, and thus selected as the installation target. If Rockstor is allowed to use the entire hard disk, the Automatically configure partitioning radio button should be selected below. Now, click on Done in the top left corner and confirm the message with Reclaim space. In the next dialog, delete all partitions by clicking Delete all, followed by Reclaim space. The installation wizard will then create the appropriate partitions itself. Now continue to the "Administration in the Browser" section.

If you want to partition manually, select I will configure partitioning in the Installation Destination dialog and press Done. Rockstor requires at least an 8GB root partition with Btrfs. The list on the left side shows all existing partitions when you expand Unknown. Use plus and minus buttons to add new partitions or delete existing ones. Once you have added a mount point to a partition, it will appear at top left in the list below New Rockstor 3 Installation. When you finish partitioning, click Done and apply the changes by pressing Accept Changes.

However you choose to partition your drive, you'll need to click Network & Host Name in the System section of the Installation Summary page. At the bottom left, the wizard proposes Rockstor as the hostname. You will have to define it later in the Rockstor web interface, anyway, so you can adopt it here now. If another computer is already called Rockstor, enter a different hostname for the NAS in the bottom left corner.

The list contains all currently available network interfaces. With the default settings, Rockstor obtains its IP address by DHCP. If you want to specify a static address, select the corresponding network sections, click Configure and then fill out the configuration in the IPv4 Settings and IPv6 Settings tabs. Usually, all you have to do is set the Method to Manual and then add a new IP address by clicking Add. Save stores the settings.

If the network interfaces have been set up, return by pressing Done and click Begin Installation. The wizard now transfers Rockstor to the hard disk. Meanwhile, click Root Password and give the root user a new password. The wizard warns you if the password is weak. Now click Done (twice if your password is weak), wait until the wizard is finished, and restart the system by pressing Reboot.

Administration in the Browser

After starting Rockstor, only the classic text-based login prompt of a Linux system appears. In the background, the system sets up all the necessary services and starts them up. Just let Rockstor work for a few more seconds; then, use the browser to access the IP address of the Rockstor server from another computer using the encrypted HTTPS protocol. If you do not know the IP address, log in with the root username and password assigned during installation and type the ip addr command; a list of all network interfaces and their respective IP addresses will appear. Log out of root with exit.

If Rockstor fails to access the Internet after booting or if the network configuration is faulty, the necessary services will not launch in the background. However, Rockstor does not show a corresponding error message during the very first boot process – only after a further restart. The only indication of an error is your browser: If it does not want to establish a connection after a few seconds, the network configuration is probably incorrect.

To correct it, log in at the Rockstor login prompt as the root user with the root password and type the nmtui command. A wizard appears that helps you set up network cards. In particular, make sure that Rockstor is connected to the Internet. When you have quit the wizard, restart the system with reboot. From now on, Rockstor should always display the IP address at the login prompt, which you can use to reach the browser user interface. If the server has several network interfaces, the IP address displayed here will probably be the one that Rockstor uses to access the Internet.

If your browser can access Rockstor, you will receive a warning message: Rockstor uses its own self-signed certificate, for which you need to create an exception in the browser. You will then be greeted by the setup wizard. After you have confirmed the license terms, enter a name for the server in the top input box. Finally, you need to set a username and password to access the user interface. The password you set when you installed Rockstor only lets you log in to the underlying Linux system.

Install Updates

An offer to update Rockstor will most likely appear next. Go for this by clicking on Update Now. If this does not appear, switch to the System | Software Update menu item at the top of the screen. If this menu item is missing, your browser window is probably too narrow, and you can click on the menu icon in the upper right corner and select System | Software Update there.

Updates can be sourced from two different channels, both of which have their advantages and disadvantages (Figure 1). If you are using Rockstor in a production environment, you should go for the Stable Updates channel; the updates here are well tested. Access to these stable updates is only available if you purchase an activation code. To get it, first click on the green Activate button, follow the link, and enter the code in the box.

The table lists the differences between update channels. You can subsequently switch between channels.
Figure 1: The table lists the differences between update channels. You can subsequently switch between channels.

Alternatively, you can obtain the updates from the Testing Updates channel. Rockstor provides a new update every two to three days, which allows you to receive new functions promptly; however, they are not very well tested and could still be buggy. In return, you can use the channel free of charge. To activate Testing Updates, click on the red Activate button and confirm the request with Activate.

Rockstor now looks for updates. If a new version is available, install it with Start Update. The update takes a few minutes, during which you should let the system work in peace. Rockstor can check independently for updates once a day and install them automatically. To do so, click the Enable auto update button and confirm. The Rockstor developers do not recommend using this feature if you have activated the Testing Updates channel.

Once the system is up to date, click on Dashboard in the top menubar (not shown in these figures); if you have a narrow browser window, the item is hidden behind the menu icon. Figure 2 shows the overview page, where you will always land right after registering with Rockstor. The statistics displayed here provide an overview of the current status of the system and, above all, its utilization.

The Dashboard provides an overview of your NAS.
Figure 2: The Dashboard provides an overview of your NAS.

Shared Pools

To set up sharing for users, work through the Storage menu once from top to bottom (Figure 3): The Disks item lists all physical disks and partitions installed in the system. Clicking on the name of a data carrier leads to numerous diagnostic statistics, which you can use to detect defects and estimate the service life of your disks.

Rockstor creates a share named Documents from the rockstor_rockstor pool with a maximum capacity of 10GB.
Figure 3: Rockstor creates a share named Documents from the rockstor_rockstor pool with a maximum capacity of 10GB.

Continue to Pools, where you can combine several volumes or partitions to form a storage pool. Such a pool looks like a single large partition to the outside world. If you have only installed one hard disk in the server, a pool named rockstor_rockstor already exists after installation.

Under Shares, you can now create a directory in one of the pools that users can access with Create Share. Rockstor usually names this directory Share. If possible, give the share a descriptive name in the top field. If you primarily store documents in the share, the name Documents is recommended (Figure 3). Below this, select the pool in which you want Rockstor to create the share. In the simplest case, leave the default rockstor_rockstor. Rockstor can automatically compress the files stored in the share, although you will not be aware of this process. The compression saves storage space but consumes compute time.

If you want to enable compression, select a procedure in the next field down the page. Although zlib saves more disk space, it is slower than lzo. Use the Size slider to determine how much disk space is available. If you select around 10GB, you are allowed to store a maximum of 10GB in the share. To create the share, press Submit. You can adjust the size of a share at any time by calling Storage | Shares, clicking on the name of the share in the table, opening the Shares tab, and clicking on Resize under the Usage tab.

Once a share exists, you still need to allow access to it. Rockstor can share the directory via NFS, SMB/CIFS, SFTP, and AFP. To do so, expand Storage in the top menubar and select the desired protocol under the File Sharing area in the vertical bar on the left. If you want to share the directory via SMB or CIFS, click on Samba.

On the new page, activate the service and then add a share by clicking Add Samba export (Figure 4). By clicking on the top input box, Rockstor now offers all shares for selection. The Browsable radio button lets you decide whether clients can find the share on the network. You can share access to guests by selecting yes beside Guest Ok, which means that no password is required when accessing the share. Write access is allowed if Read only is set to no. After clicking Submit, the share is available on the network. As a rule, you only need to access the URL smb://192.168.100.1/Documents/ with your file manager to open the Documents share on the 192.168.100.1 server.

Sharing with the SMB/CIFS protocol is enabled for Documents, which only selected users can access.
Figure 4: Sharing with the SMB/CIFS protocol is enabled for Documents, which only selected users can access.

To change the share settings at any time, search for the share line in Storage | Samba and click on the pencil icon in the right-hand column. If you only want to allow certain users to access the share, set Guest Ok to no in the settings and save the changes with Submit. From now on, only known Rockstor users, which you can manage under System | Users, have access. You can add a new user through Add User. All you have to do is enter a username and the user's password. As soon as you create the user account by pressing Submit, they can access the share with the assigned username and password. By default, the domain is called WORKGROUP.

Using the same principle, you can create an NFS share through Storage | NFS, selecting NFS, and clicking on Add NFS Export. After clicking in the input box at the top of the screen, select the share and decide which computers are allowed to mount the share under NFS Clients. An asterisk (*) allows all clients access, whereas entering 192.168.100.* would allow only computers from the 192.168.100 subnet to mount.

Snapshots and Rock-ons

To create a snapshot, go to the Storage | Snapshots menu item and click Create in the upper right corner. Give the snapshot a meaningful name, which cannot contain spaces, and then select the share for which you want to take a snapshot from the drop-down list. If you check Writeable, Rockstor allows write access to the snapshot. To initiate a rollback, call Storage | Shares, click on the name of the share in the list, switch to the Snapshots tab, check the box in front of the snapshot to which you want to return, and click Submit, Confirm, and finally Rollback in the upper right corner. The corresponding function is only available if at least two snapshots exist.

Rockstor can be extended to include additional functions using the above-mentioned Rock-ons. Before installing a Rock-on, you should create a new share in which Rockstor can collect all the Rock-ons. This way, you don't run the risk of the Rock-ons on your hard disk successively taking up valuable space on the other shares. First switch to the Storage | Shares menu item and create a new share that offers at least 5GB of free storage space.

To install a Rock-on, select Rock-ons in the top menubar and activate the Rock-on service slider on the left. Under the root share, select the share you just created and click Submit. If you end up in the table with the shares again, toggle back to Rock-ons and activate the Rock-on service again. Rockstor should now report that there are no Rock-ons installed. Switch to the All tab, where you will find all available Rock-ons for installation (Figure 5).

Rockstor offers various Rock-on extension packages.
Figure 5: Rockstor offers various Rock-on extension packages.

Conclusions

Thanks to Rockstor, you can easily set up free and powerful network-attached storage, which can then be supplemented with additional functionality by expansion packages. With the self-built version, you can extend your NAS as needed. NAS with a Btrfs filesystem is unusual and provides the NAS with many professional functions. If you want to run Rockstor in production environments, you need to buy access to the commercial updates.

Rockstor offers a few more interesting features, as well; for example, the NAS can quickly replicate the stored data and inform you by email if any problems crop up.