Building an Ultra-Low-Power File Server with the Trim-Slice

NFS

NFS is the classic Network File System, and it is has been in use for decades on Linux and UNIX. The Popcorn Hour media player connected to my TV supports NFS, and I don't have any Windows computers, so NFS is really the only classic file-serving protocol I need (or want) on my network. NFS has very limited security, so it's not ideal for everyone, but it's lightweight and easy to configure. In my opinion, if you have a device that supports NFS and SMB, go with NFS.

On Ubuntu, the NFS server I use is called nfs-kernel-server, and you can install it with the following:


sudo apt-get install nfs-kernel-server

To create an nfs share, edit the /etc/exports file, and add the directory you want to export. Here is an example:


/mnt/disk01 popcorn(ro,sync,root_squash,no_subtree_check)

The above line exports the /mnt/disk01 directory to my Popcorn Hour, with the following flags:

  • ro — read only: in other words, don't allow anything that could change the filesystem. The Popcorn Hour has the ability to delete items, but I don't want to let my kids delete things arbitrarily or accidentally with the remote.

  • sync — reply to requests only after the changes have been committed to stable storage.

  • root_squash — map requests from uid/gid 0 to the anonymous uid/gid. This makes things a little more secure.

  • no_subtree_check — from the man page: "This option disables subtree checking, which has mild security implications, but can improve reliability in some circumstances." See the man page for more information (man exports).

With the line in place, I run the sudo exportfs -ra command to refresh the exports. Then on the Popcorn Hour, I can mount the exported directory, and away I go. There are several other options you can use in the /etc/exports file. See the exports man page for details.

The example entry above can't be mounted on any other host, but to permit other hosts to do so, I either can change popcorn to the IP address and netmask of the network I want to share it with (for example, 192.168.10.0/24 for every host with an IP address starting with 192.168.10.), or I can add additional host definitions to the end of the line.

With the exports file updated and refreshed, I can mount the export with something like this:


sudo mount -t nfs trimslice:/mnt/trimslice/disk01 
 ↪/mnt/trimslice/disk01

Or, I could add an entry like the following to my /etc/fstab file:


trimslice:/mnt/trimslice/disk01  /mnt/trimslice/disk01  
 ↪nfs  defaults  0 0

and the NFS share always would be mounted at boot time.

Samba SMB/CIFS

Samba, aka SMB/CIFS, is how you go about sharing files with computers running Windows. If I had a Windows machine or two, using Samba would be a given. I don't, but I'll go ahead and describe the process here. For starters, Samba is installed on the Trim-Slice with the following:


sudo apt-get install samba

After installation, edit the /etc/samba/smb.conf file to set up your shares (add them to the end of the file). A read-only share equivalent to the NFS one described above is:


[disk01]
    comment = trimslice disk01
    path = /mnt/disk01
    browsable = yes
    guest ok = yes
    read only = yes

Add the above to the end of the smb.conf file, and the share will pop into existence on the network. With Samba, there is no need to restart the service or run a command after editing the smb.conf file; any changes are applied automatically as soon as the file is saved.

It's a good idea to uncomment the security = user line in the smb.conf file to add some security (and if you do want security, you should set guest ok in the above example to no). And, if you have a proper Windows network, you should change the workgroup name in the smb.conf file to the actual name of your Windows workgroup.

As with NFS, you can enter a lot more settings in the smb.conf file to tweak things just the way you want them. The default file is filled with examples, and the Samba documentation goes into even greater detail.

DAAP

DAAP, in case you are interested, stands for Digital Audio Access Protocol. An older, but serviceable, standalone DAAP server for Linux is mt-daapd, also known as the Firefly Media Server. Unfortunately, it is not under active development. Some forks are in the works (which aren't in the Ubuntu repositories yet), so maybe the situation will improve in the future. To install it, do the following:


sudo apt-get install mt-daapd

After installing mt-daapd, set the password for the admin account in the /etc/mt-daapd.conf file. Technically, the password already is set, but it's good practice to change it. You can tweak other settings in the file, but the GUI is easier.

Figure 3. mt-daapd, aka the Firefly Media Server

After changing the password, restart mt-daapd with:


sudo /etc/init.d/mt-daapd restart

Then, go to the Web interface to configure it: http://trimslice:3689 (replace "trimslice" in the URL with the correct IP address or name).

The configuration page is simple and self-explanatory. You can set the name, change the admin password and set a password for listening to the music (in case you don't want to share your collection of classic Dr. Who music with everyone on your network). You also set which folder or folders contain your music (multiple folders can be specified). Finally, you can configure how often to have mt-daapd rescan your music folder(s).

Once the changes are to your liking, pressing the Save button saves the settings to the /etc/mt-daapd.conf file. But, the GUI is there so you might as well use it.

All should be well and good at this point. Unfortunately, mt-daapd, as packaged in the repository the Trim-Slice uses, does not support FLAC files. If your collection is mostly MP3 files, that won't be an issue. If it is an issue, your options are to compile your own, live with the limitation or find an alternative.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I have my TrimSlice running now.

loughkb's picture

I had some fun setting it up, really enjoyed the project. I am a bit dismayed by some of the comment thread here, the political skew is annoying.

Really, this is a technical forum regarding a shared interest in warm and sometimes glowing machines that do amazing things with electrons. People should be able to discuss and share their 'shared' interest in such without regard for governments. That belongs elsewhere. We're the people, we are separate from the egomaniacal stuffed suits that play their power games, sometimes to our detriment. We are not them, leave that bickering to those who want to get themselves dirty and smelly.

Now, back to the subject at hand. I am really happy with this little device. It's providing exactly the service I desired, and at a power consumption level I can't see matched in any other hardware without making big compromises in performance.

As to power consumption. I run it off a 12 volt DC supply system that is augmented and backed up by a solar battery system. For about 6-8 hours of the day, it and the external 1 TB hard disk are completely powered by the sun. The rest of the time, it's drawing 250 - 700 milliamps, depending on rather the HD has been spun down. That's WAY below what I could achieve with other hardware.

Mine is running off an SD card in the front slot, no internal SSD. Although I don't plan on rebooting or shutting it down any more than once a year for an fsck, I should point out something I discovered.

When you shut down the unit, it doesn't sync the filesystem, just goes into a kind of suspend mode. This will cause some serious file system corruption. I know this from experience with it.

So my tip is this. Before shutting down or sending a reboot, manually do a 'sync' to flush out buffers. The file system will still indicate it was not cleanly unmounted when you fsck it, but errors will be very minor and no data will be lost.

Kevin

That pretty expensive

Mace Moneta's picture

You can get one of these instead:

Google for yourself:
ASUS E45M1-I Deluxe AMD E-450 APU AMD Hudson M1 Mini ITX Motherboard/CPU Combo

You can find it as low as $160. A lot more function and performance for a lot less money. The CPU, video, sound, gig-e are included; add 4GB RAM for $20, and you're still under $180. Power consumption with a couple of hard drives is about 25W.

You can get away with a lot

Anonymous's picture

You can get away with a lot cheaper hardware then a tegra2 powered system.
Why would you want that much graphics processing power on a fileserver anyway?

I would buy one today...

Sidney's picture

...if it wasn't made in Israel. I never buy anything from Israel, not even their avocado.

Cheers,
Sid

Curious

deandownsouth's picture

I don't usually care where something is made. Is there an issue with Israel made electronics over those from Asia or elsewhere?

No, there is an issue with

Sidney's picture

No, there is an issue with Israel and how they treat the Palestinians and get away with it.

This is really not a place

Webmistress's picture

This is really not a place for political discussions about Israel. If you have a problem with Israeli products because they come from Israel, please share those opinions somewhere else. If you think the technology behind them sucks/is awesome, then have at it.

Katherine Druckman is webmistress at LinuxJournal.com. You might find her on Twitter or at the Southwest Drupal Summit

i stopped watching mel gibson

Anonymous's picture

i stopped watching mel gibson movies due to mel gibson being an anti-semite.

Oh, I see

deandownsouth's picture

I do hate it when folks like you mix politics and FOSS. Like that idiot that does the Mint distro. He broke the rules, IMO, with his anti-Israel statement, of which he is free to do so, but not on a Linux forum. Linux and FOSS is open to anyone regardless of race, nationality, gender, religion, politics, or sexual persuasion. It's a great example of how people from all over the world can come together regardless of who or what they are and communicate and contribute. There was no reason to post what you post as it had no bearing on the product at hand.

Politics and FOSS?

Sidney's picture

What's FOSS about the Trim-Slice?

No bearing on the product at hand? Isn't the Trim-Slice made in Israel?

Come on, get real!

Really?

markdean's picture

It runs Linux you dolt. On top of that, the hardware specifications are clearly disclosed, including reference diagrams and mechanical drawings, etc.

Israel

Anonymous's picture

Hmm, did you ever do some history leasons about Israel and Palestinians?
Did you know that the Jews actually bought the land in Israel before becoming a state? Do you care to know that there were no such thing as Palenstiaians before the Israel was declared a country.

It is fools like you that make the US looks stupid, ones that don't bother to do your own research, just go off on a tangent based on rumors and lies.

Incorrect. The British used

Anonymous's picture

Incorrect. The British used the term Palestinian to refer to people from Palestine since at least start of 20th century. http://en.m.wikipedia.org/wiki/Balfour_Declaration 1917 and other documents of the era use Palestine/Palestinian terms.

Israel

Anonymous's picture

Oh it's made in Israel? Thanks for pointing that out, def getting a few now.

A1000 + Sata

PePa's picture

Not a fan of RAID for this kind of a setup. I would get a Mele A1000 ($70) with an external Sata HD (no USB, spins down, hot-pluggable). It's ARM, but Ubuntu is already running on it, I'm sure Debian won't be a problem. Or it can come with Android, but I wouldn't prefer that.

Do the same thing with my laptop

Tacra's picture

I do basically the same thing with an old lenovo T61p laptop. I put a 500GB hd in it, installed centos 6.0 (upgraded to 6.2 now), and setup it up like a functional desktop. Then setup nfs and samba, email, apache, mysql. I have a nice place to centralize all my data, ability to access anywhere in the world, enjoy all my content, and if the crap hits the fan, I can walk out the door with my system under my arm.

The T61p can take external usb hds and should be able to raid them if needed. If I were truly worried about a drive failure, I'd get say 6 usb drives, put them into 2 drive mirrors then stripe across the mirrors aka Raid 10. That setup can get me 4.5 TB today with plenty of speed and redundancy using common, off the shelf 1.5 TB hds I can buy anywhere. With lvm and xfs, I can grow the raid 10 as needed with the mirrors. Not bad for cheap commodity hd and a clone of RHEL.

I even run mediawiki off of it and can check email or cruise the web from anywhere else and have all my stuff on tap.

Asigurari Locuinte

pufos's picture

Great article!!

First, there is classic "file

Asigurari Locuinte's picture

First, there is classic "file server" software: NFS and Samba. These systems don't care what your data is. All they see are files, and no file is any different from the next (apart from size and permissions).

Price is around $350, but I

Asigurari Locuinte's picture

Price is around $350, but I bought mine on sale for $250. I've seen it go to that price at least 2x in the past 2 years.

Power consumption?

Kevin Loughin's picture

Hello,

My low power server for a few years has been an old maxterm thin client. One nice thing was the 12V power req. I run it off an old 12V PS, with a bleed over suplement from my solar power system. Most days it spends about 6 hrs totally powered by solar. (after my batts are topped off).

What is the amperage draw on the thin slice? I've been wanting to redo the server and this might just fit the bill.

I run on Debian currently, but the cpu is so weak that I can't take full advantage of Gb ethernet on my hardware.

Kevin

External RAID

Adam Casto's picture

Couldn't you use one of the external drives with built-in RAID? It's been a while, but I know I've come across some reasonably priced external USB to SATA hard drive cases with RAID options. I've been interested in them primarily for external backups with mirroring.

There are better alternatives

Vinh Nguyen's picture

I bought the Acer Aspire EasyStore (1.6ghz single-core atom) almost 2 years ago. It is energy-efficient, has a small footprint, and can hold up to 4 hard drives. I wiped out Windows and installed Ubuntu server. I serve files throughout my network via ssh, samba, and mediatomb (similar to yours). Price is around $350, but I bought mine on sale for $250. I've seen it go to that price at least 2x in the past 2 years. Seems like a better setup than yours. Just my 2 cents.

Dead tree

smitty1e's picture

A printer-friendly link would be a nice addition to a great article.

I agree :)

sis's picture

I agree
:)

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix