Build Your Own Ubuntu NAS
Build Your Own Ubuntu NAS
In Part 1, we got a basic Intel Atom-powered NAS up and running, using FreeNAS as its operating system. Read performance was good, write performance, so-so, but speeds were far from being limited by drive and network speeds. So, taking another suggestion from the SNB Forums, I loaded up Ubuntu Server and gave it a spin. Ubuntu Server edition might look big and enterprisey from its webpage description, but it's perfectly usable for SOHO and SMB NAS use. The key is to add two more pieces: the Webmin administration GUI; and Neil Brown's mdadm Linux RAID utility. Webmin is the Linux-world standard for GUI-based server administration. My first exposure to Webmin was years ago when I briefly set up my first Linux LAMP server for local website development. It was really a godsend to me as a Linux newbie and sure beat the hell out of editing Apache and other config files! In a similar way, mdadm is the Linux world's solution for software RAID arrays. It allows you to create, tweak, grow and reconstruct RAID arrays and supports linear and RAID 0, 1, 4, 5 and 6 arrays. Forms of combination striped and mirrored arrays (variously referred to as RAID 0+1, 1+0, 01, 10) can also be created. (I found the MythTV Wiki to be the most informative about this.) Since this isn't just a download, install and go process, I'll spend some time showing you how to put it all together.
Software Installation
I first downloaded Ubuntu Server 8.0.4.1 and installed it on the Atom NAS. The install did not go well with several attempts, each one eventually hanging before completion. After some Googling, I found that there is a bug related to the Realtek RTL8102EL chip driver. Since I was going to be using the Intel gigabit NIC anyway, I took the suggestion I found here. Once I disabled the onboard NIC, the install went as smooth as buttah! Note that when you reach the point in the Ubuntu install where you are asked which servers to install, just select the "Samba File server" option. Installing mdadm was very easy. All I had to do was log into Ubuntu and type the following at the command prompt (with a working Internet connection, of course):
sudo apt-get update sudo apt-get install mdadm
Webmin doesn't appear to be in the standard apt-get or aptitude databases. So you either need to add the webmin download site into the apt-get sources list or download the package from the Webmin site and install it.
Following the Webmin Debian install instructions, I opted for the apt-get method (Using the Webmin APT repository section). So I opened up /etc/apt/sources.list in the vi editor (command summary here) and added this line:
deb http://download.webmin.com/download/repository sarge contrib
With everything now installed, pointed my browser to the Atom NAS' IP address like so:
https://10.168.3.249:10000/
Note that you must specify port 10000 since Webmin won't auto-forward. But if you forget to specify a secure connection, you will get an error page with a proper clickable link. When you successfully connect, you should see the Webmin home screen shown in Figure 1.
Note that the install would have fit nicely on a 2 GB flash drive. But I used an old 10 GB Maxtor IDE drive that I salvaged from a long-gone system.
Setup Overview
The overview of the RAID creation process for the Ubuntu Server / mdadm / Webmin combination is similar to the one used in FreeNAS. Here is the outline, with the appropriate Webmin modules referenced (including links to the online documentation pages): 1. Partition Disks [Hardware > Partitions on Local Disks] 2. Create Disks Filesystem [Hardware > Partitions on Local Disks]
3. 4. 5. 6. 7.
Create the RAID device [Hardware > Linux RAID] Create the RAID device filesystem [Hardware > Linux RAID] Create the Mount directory [Others > File Manager] Mount the RAID device [System > Disk and Network Filesystems] Configure File Sharing [Servers > Samba Windows File Sharing]
Note: If you don't see the Linux RAID module in the Webmin left-hand menu, try clicking Refresh Modules.
1- Partition Disks
You start by creating a Linux RAID partition on each of the disks that will be used in the array. Go to the Hardware > Partitions on Local Disks page, click on the drive name, then on Add primary partition on the next page to reach the screen shown in Figure 2. Select Linux RAID from the drop-down menu and click the Create button. Repeat for the other drive(s).
Your screen will then look something like Figure 4. Repeat for the other drive(s).
After clicking the Create RAID device of level button, you should see a screen like Figure 6. If the Partitions in RAID section does not appear, you should try rebooting the server since sometimes new partitions are not recognized until reboot. Once you get the Partitions in RAID section to appear, select the desired partitions and click the Create button. Note that I set the Chunk size to 32 kB, based on this recommendation.
File Manager is found under the Others menu and clicking it launches a Java applet that provides a Windows Explorer flavor file browser. I decided to put my mount point under the /mnt directory, using a nested directory of /mnt/raidarr/public. Figure 9 shows that I clicked on the mnt folder in the left hand pane, then clicked the New folder icon to pop up a small window where I could enter my new folder name. Note that I had to first create the raidarr directory, then the public directory in it.
Once the directory was created, I had to set its permissions. This is a bit tricky since it only works when you select the folder in the right-hand pane! But once you get the folder to appear, just click on the Info icon and set the permissions as shown in Figure 10. The full-sized image shows that I also set the folder Ownership to user nobody and group nogroup.
The changes on this page are circled in red. Mounted As points to the mount directory, RAID Device is set to the created RAID array and Allow Users to Mount this Filesystem is selected.
If you have set everything correctly, you won't get an error when you click the create button and will be rewarded with a screen that looks like Figure 13.
The only changes you need to make in Figure 15 are the Windows Workgroup name (if it is not "Workgroup") and to disable the Master Browser function. The latter is optional, but probably a good idea to prevent Master Browser battles that can mess up Windows Network browsing. Make the changes and click the Save button.
You should now be back at the main Samba screen. Click the Create a new File Share link at the top of the page to open the page shown in Figure 16. I named the share "public" and navigated to the previously-created /mnt/raidarr/public folder.
Note that I have set the Automatically create directory button to No. I originally tried creating a share this way, but it didn't work. You can also enter a comment if you like. Click the Save button and your screen should look like Figure 17.
But we're not done yet! Click on the share name to open the Edit File Share screen (Figure 18), then click on the Security and Access Control icon in the Other Share Options area. The changes here are to set Writable to Yes, Guest Access to Guest only. Leave the Guest Unix user set to nobody. Save the changes and the main Samba screen should now show the share security as Read/write to everyone.
All you need to do now is to browse to the share. You should be able to open it and not get a login popup. Drag a file over to test writing, open it to test reading, then delete it to test, well, deleting! We're finally done! Now we can see if the switchover to Ubuntu was worth it!