Igor's Blog

A few days ago I wrote about when I physically put together my Odroid-XU4 home media server. This article deals with the software side of the setup. This server runs Plex, shares all the media files via Samba (Windows file sharing) and also runs the Deluge torrent client.

When I was initially looking at my options there was only one NAS oriented OS that seemed to meet all my requirements - OpenMediaVault. I did install it and tried to get it set up the way I wanted, but after much struggle, headache and frustration I decided to give up and use a bare minimum distribution instead.

I chose DietPi as the OS to run on my XU4. I was a little skeptical at first given how gaudy their web site is, but it's actually a very well put together Debian (Jessie) Linux based distribution for ARM.

If you read my previous posts, I jumped the gun in sealing my XU4 in the enclosure so was forced to boot from the SD card and transfer files over to the eMMC afterwards. That wasn't a big deal, just meant a couple extra reboots. When booting from the SD card, the eMMC is visible as the first block device so copying the DietPi image is as simple as...
dd if="DietPi_v127_OdroidXU4-armv7-(Jessie).img" of=/dev/mmcblk0 bs=1M

After booting from the eMMC, the initial setup was simple and guided by the installer...
  • Login as root
  • Accept update request
  • Set up networking
  • XU4 restarts here
  • Login as root again, installer runs again

At this point you're given the option to select which software you want, I picked the following:
  • Plex Media Server
  • Deluge
  • Samba

Then just select GO and let the installer do its thing.

At this point I had most of the software I wanted, but not all. Specifically, webmin was missing. Installing it was a little more involved, the following commands did it though...
echo "deb http://download.webmin.com/download/repository sarge contrib" >> /etc/apt/sources.list
wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc
apt-get update
apt-get install webmin -y

That took care of webmin, but a few others were still required. I needed HFS+ support since the disks I was copying from were from an OS X server. The rsync, and other utilities were there to assist in the file migration process and avahi-daemon for aesthetic reasons I'll cover later. I installed these using apt-get...
apt-get install hfsplus hfsprogs hfsutils rsync locate screen avahi-daemon

I was going to use Plex for the media server, which goes hand-in-hand with Trakt.tv so the Plex Trakt Scrobbler was installed. I had major issues trying to get this working when I had OpenMediaVault installed, on DietPi the install and running of this plugin went without a hitch. Install instructions can be found here.

Next was time to copy my 3Tb+ of data from the HFS+ disks. These mounted without any issue and I used rsync to copy them over. It took about two days (with breaks in between). The maximum transfer speeds I could get were 40Mb/s, which is well under USB 3.0 speeds, which is probably more due to the HDD enclosure than the XU4. This was the command I used to copy data...
rsync -vrW --chown=nobody:nogroup --size-only --progress /mnt/Temp/* /mnt/Data1

While data was being copied (in a screen session) I did some research on performance, fan speed and cooling of the XU4. This thread on fan control was very useful. I experimented with setting the fan speed as follows:
echo "0 40 65 95" > /sys/devices/odroid_fan.14/fan_speeds
echo "50 70 85" > /sys/devices/odroid_fan.14/temp_levels

To make these permanent I created the /etc/udev/rules.d/60-odroid_fan.rules file with the following contents:
DRIVER=="odroid-fan", ACTION=="add", ATTR{fan_speeds}="0 45 65 95", ATTR{temp_levels}="50 70 85"

At the same time, using dietpi-config I set Performance Options as follows:
 Performance Options
Governor | conservative
Throttle up | 85% CPU usage

Why those (non-performant) settings? Mostly because there is no need to run the XU4 flat-out when it is idle or in light use. Those settings work well for file copy and direct Plex streaming. It does ramp up when needed but my main focus was having just enough performance while keeping the whole setup cool.

I noticed that i had the spi1 process running all the time and taking up considerable CPU (around 20%). After some research I found this process is for the CloudShell and since I don't have one, I decided to disable the SPI module by creating the /etc/modprobe.d/blacklist file with the following contents:
blacklist spi_s3c64xx
blacklist spidev

To make the module blacklisting permanent, I ran the command below and restarted.
update-initramfs -u

I was getting annoyed by the heartbeat LED on the XU4 flashing all the time. Fortunately this was easy to disable on boot by adding the following line to /etc/rc.local. That makes the blue heartbeat LED flash only during eMMC access instead of on timed intervals.
echo "mmc0" > /sys/class/leds/blue\:heartbeart/trigger

In my setup I use an SSD as a kind of temporary/cache drive. That is so that the large 4Tb disk is not used unnecessarily. That means torrent downloads, data for my traffic cam and Plex metadata are located there. By default Plex metadata is on the eMMC (or the / partition) which is not ideal, so I moved it to the SSD (mounted at /mnt/Stage1) after shutting down the plexmediaserver service (/etc/init.d/plexmediaserver stop). Instead of just moving the data I made a copy and renamed the old directory to keep as a backup...
mkdir /mnt/Stage1/PlexData
cp -prv /var/lib/plexmediaserver/* /mnt/Stage1/PlexData
mv /var/lib/plexmediaserver /var/lib/plexmediaserver.old

After copying metadata, the /etc/default/plexmediaserver config file was updated with the new location as follows:
PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/mnt/Stage1/PlexData/Library/Application\ Support"

Now coming back to the aesthetic reasons I mentioned earlier. I wanted to control how the server name and icon appeared when viewed form my MacBook Pro. The first image shows the before and second image the after version of what Finder displays. The second is much more pleasant I think.

avahi1.png avahi2.png

To set that up, I added the Samba service to Avahi configuration as follows:
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<name replace-wildcards="yes">%h</name>

To make the above work the hostname was also set to 'PulseDroid' i.e. it was in camel case, not standard lower case.

Lastly, after a couple of days of usage I noticed that the hard disk was spinning down and spinning up constantly. That's not so great for the disk health so I decided to change the spin down time to 2.5 hours and disable advanced power management.

Those changes can be done on the fly by running:
hdparm -S 243 -B 255 /dev/sda

To make them permanent, the /etc/hdparm.conf was updated with the following contents (I did it for both disks though it's not actually needed for the SSD):
/dev/sda {
spindown_time = 243
apm = 255
/dev/sdb {
spindown_time = 243
apm = 255

That's pretty much it for the setup. I did add a script to display system stats on the Odroid-Show2 that I have attached to the XU4, which I'll cover in a separate post.


, , , ,
About — I'm an enthusiastic software engineer and consultant interested in many fields including J2EE, programming, electronics, 3D printing, video games, wood working and gardening.
See my Resume for more information.
The views expressed in this blog are my own and not those of my employer.
comments powered by Disqus
My other posts you may like...
Programming, DIY, Games, Hacks, Tech and more.
Follow me on...
Current and Past Projects
See my Resume


RSS Feed

My Other Web Sites

Igor and Elise's Travels
Riverside Expressway Cam
StrFunc() Online
300 George St Blogumentary
Guru JSON-RPC Tester
Extrudifier Object Designer

Recent Blog Posts

Older versions of JD-GUI crashing on macOS Sierra

How does Seeed Fusion stack up as a low budget PCB fab

Where to find the last item (Robbie's lost lyrics) in GravityFalls Lake level

Detecting print requests to print contents of a DIV with JavaScript

Using Google DFP with AdSense on responsive pages

How to change the email subject line in Gmail

Force PHP GD library to load JPEG images that have invalid data

How to uninstall Samsung Smart Switch from your Mac

Facebook adds weather forecasts but forgets to adjust them to your time zone

No sound or microphone when answering calls on an iPhone

Recent Galleries

Space Food - Chocolate Ice Cream with Chocolate Chips

Legeod Star Wars AT-DP kit

DIY spare parts computer build with a RAIDMAX Anura case

Fake 'Lepin' brand Lego packaging

Hardwood garden bench with clear resin void filler

Fixing a 3D printer extruder that stopped heating up

Easily increase disk space in a Lenovo Ideapad 100S 14" laptop with an M.2 SSD

Making a multi-piece 3D printed solder spool holder stand

DIY indoor apartment grow light wiring

Good Friday Electronics fun Easter Bunny LED PCB Kit IBEABU-01.0

Top Categories

Blogs I follow

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth


RAWS Parts Online
Alpha Dimensions Hosting
Kristensen Photography
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity
Follow me on... 
...or subscribe for updates!

Don't show this again