Building an Ultra-Low-Power File Server with the Trim-Slice
For serving up video files to my PS3, I use the MediaTomb UPnP media server. Or at least, I would, if I didn't have the Popcorn Hour. MediaTomb, like mt-daapd, is a nice piece of software and works just fine for what it does, but devices like the PS3 can be very picky about what file types they will support. On-the-fly transcoding (supported by both mt-daapd and MediaTomb) can eliminate some of these issues, especially with audio files (for example, by transcoding a FLAC file to WAV while it is being transferred, so that iTunes can play it). Transcoding isn't practical for video files though. It can be done, but the CPU requirements are hefty to say the least, especially when you start talking about 720p and larger video files.
Figure 4. The Media Tomb File Browser
Limitations aside, installing and configuring MediaTomb is similar to mt-daapd. First, enter the following:
sudo apt-get install mediatomb-daemon
After the install completes, edit the /etc/mediatomb/config.xml file to
enable the graphical user interface (GUI) and set the default user and
password. To do this, change
enabled="no" in the following lines to
enabled="yes" (both of them), and set the password to something more
<ui enabled="no" show-tooltips="yes"> <accounts enabled="no" session-timeout="30"> <account user="mediatomb" password="mediatomb"/>
The above lines should be near the top of the file. Save the file, and restart the server with:
sudo /etc/init.d/mediatomb stop sudo /etc/init.d/mediatomb start
Once restarted, connect to http://trimslice:49152/. Enter the user name and password, and you will be in the GUI. To add a folder, click the Filesystem link, and browse to the folder you want MediaTomb to index. With the correct folder selected in the left pane, click on the plus, or plus-with-a-circle icon, to have MediaTomb scan the contents of the folder. The plus-with-a-circle icon adds the folder as an autoscan folder, meaning it will rescan the folder periodically looking for new files.
For PS3 support, a couple lines need to be changed in the config.xml file; they are commented and easy to find if you search for "PS3".
With this new file server, I lose the protection of RAID, so backups are more important. RAID, of course, does not eliminate the need for backups; it just makes the primary filesystem more reliable. Because I already needed backups with my old setup, I had a backup system in place.
The "system" itself is a custom rsync backup shell script. The backup drive contains several directories: one named current and then 14 others named 01, 02, 03 and so on, up to 14. The basic flow of the script is:
rm -rf '14' mv '13' '14' mv '12' '13' ... mv '01' '02' cp -al 'current' '01' rsync drive-to-back-up to 'current'
-al part of the copy command above is important. It tells the command to
operate in archive mode, which preserves attributes and copies directories
recursively, and to create hard links instead of actually copying the
files. When rsync comes upon a changed file, it will de-link the file
before updating it, so the combination of rsync and the cp command gives
me 14 days of backups (assuming the script is run once a day).
The extra space required for these backups is low, so I can use the same size drive for the backups that I do for the primary. Once a backup drive starts nearing its limit, the primary drive likely will be close to its limit too, and it will be time to shop for an additional pair of drives.
I've used variations of this script for years, and if I had to start from scratch today, I might use it or something else. Lots of excellent backup programs are available for Linux. The point is to make backups, as many as necessary.
The Trim-Slice has worked out very well as a file server. The built-in serial port lets me operate it completely without a monitor, and the hardware has so far been more than adequate for my household's modest file-serving needs.
With dual 2TB external USB disk drives (and more to come), the Trim-Slice is even more energy-efficient than I thought it would be. My consumer-grade "Kill-a-Watt" power meter (which I admit is probably not very accurate) shows an average power draw of 0.28 amps, which, completely accurate or not, is much better than the 1.8 to 2.0 amps the old server was pulling. The power draw of the Trim-Slice by itself is an astounding 0.08 amps.
Power is just one benefit. I also like the smaller footprint. Noise is much better too. The old case needed several fans, but the Trim-Slice is passively cooled. There are fans in the external drive enclosures, but they don't come on very often, and when they do, I don't notice them at all. The Trim-Slice does get a bit hot to the touch, but I suppose that's what you get when you make the outer casing a heat sink.
The jury is still out on how long this new setup will last. I consider USB drives to be less reliable, and although the build quality of the Trim-Slice appears high, it's a new product with no history. To mitigate this, I am going to be very careful to make sure important stuff is copied across all future drives. Despite my worries, I must admit, I did replace a few of the drives in my RAID5 over the years, and I don't imagine the difference in reliability will be so great as to cause any huge problems.
The Trim-Slice: http://trimslice.com
The Trim-Slice User Manual: http://trimslice.com/download/documentation/trim-slice-user-guide.pdf
Linux NFS-HOWTO: http://nfs.sourceforge.net/nfs-howto
Firefly Media Server: http://en.wikipedia.org/wiki/Firefly_Media_Server
The Popcorn Hour: http://www.popcornhour.com
Free DevOps eBooks, Videos, and more!
Regardless of where you are in your DevOps process, Linux Journal can help!
We offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, and advice & help from the expert sources like:
- Linux Journal
- Users, Permissions and Multitenant Sites
- New Products
- Flexible Access Control with Squid Proxy
- Security in Three Ds: Detect, Decide and Deny
- High-Availability Storage with HA-LVM
- Tighten Up SSH
- DevOps: Everything You Need to Know
- Solving ODEs on Linux
- Non-Linux FOSS: MenuMeters
- Nmap—Not Just for Evil!