This guide will walk you through setting up a NAS (Network Attached Storage) on the Odroid HC2 Single board computer. There is no reason why it wouldn’t work for the HC1 or XU4, however the XU4 uses USB3 instead of SATA. The guide is written for those with no linux experience and minimal computer building experience. I’m writing it because I had minimal Linux experience and it was a pain to figure out how to set it up involving reading a few dozen guides.

Parts List

ODROID-HC2 : Home Cloud Two

12V/2A Power Supply Unit US Plug for ODROID-HC2

ODROID USB-UART Module Kit

SanDisk 32GB Ultra Class 10 SDHC UHS-I Memory Card Up to 80MB, Grey/Black (SDSDUNC-032G-GN6IN)

AmazonBasics RJ45 Cat-6 Ethernet Patch Cable – 3 Feet (0.9 Meters)

ODROID-HC2 Cases (Black)

WD Red 2TB NAS Hard Disk Drive – 5400 RPM Class SATA 6 Gb/s 64MB Cache 3.5 Inch – WD20EFRX

The HC2 is superior to the raspberry pi 3 in that it has gigabit ethernet, a SATA hard drive connection, a faster 2Ghz CPU and 2GB of memory. It is very purpose build to be a network attached storage device or light weight server. The Raspberry pi3 is superior in the amount of support available from manufactures and the community. I opted for the HC2 over the HC1 because high capacity 3.5-inch drives are cheaper than 2.5-inch drives. The HC1 would be more energy efficient if that is a concern. The HC2 does not have a HDMI output so everything must be setup before the image is burned to the MicroSD card, over a VNC remote connection or over a Serial Connection via Command Line. This guide will cover setup with a Serial connection but it is worth setting up a VNC server latter because linux is easier to use with a GUI if you don’t know the console commands very well.

The HC2 needs a 12Volt/2Amp power supply, a Micro SD Card and a 3.5inch SATA hard drive. I used a 3TB Toshiba hard drive I had laying around. The HC2 with the lid only supports hard drives up to 27mm tall.

Additionally, you may need screws to attach the hard drive to the aluminum HC2 fixture if the included screws are too short.

You will also need a Ethernet cable to connect to your router and the internet. You will also need a ODROID USB-UART to connect to the serial port on the HC2.

Pick up a HC2 case for $5 when your buying parts to close everything up when you are done.

Assembly

Assembly is extremely simple. Place the hard drive on the bottom of the HC2 and slide it into the SATA port. Supporting the hard drive and the aluminum body flip the two pieces over ensuring the hard drive does not put weight on the SATA connector. Once you have it upside down, use screws to attach the bottom of the hard drive to the HC2. Flip it back over and connect the ethernet cable from the HC2 to your router. Connect the USB-UART to the serial port on the HC2. Plug the USB end into your computer. Do not connect the power supply yet.

Software

Cited sources: https://wiki.odroid.com/accessory/development/usb_uart_kit

https://wiki.odroid.com/troubleshooting/odroid_flashing_tools

Download Odroid’s ubuntu-16.04.3-4.9-mate-odroid-xu4-20171025.img.xz release. Ubuntu is a linux distribution that is free and stable.

Link to download page: https://odroid.in/ubuntu_16.04lts/

Direct link to download if the list of files was overwhelming: https://odroid.in/ubuntu_16.04lts/ubuntu-16.04.3-4.9-mate-odroid-xu4-20171025.img.xz

While that is downloading, download Etcher: https://etcher.io/ Etcher is software that will flash the Ubuntu Image onto your Micro SD Card. Put your Micro SD card into your computer’s Micro SD adapter and start Etcher. Select the Ubuntu image you downloaded and the Micro SD card then click flash. It will take a few minutes to run. When it finishes Windows will pop up a message about formatting a drive before using it. CLICK CANCEL.

Take your flashed Micro SD card and insert it into the HC2’s Micro SD slot

Download drivers for the USB-UART from here https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers

Extract and install the drivers. Once the drivers are installed you will find it listed as a COM port in the device manager.

Download and install Putty: http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe

Putty is a free serial console program we will be using to send commands to the HC2. Putty will propt you for connection setting. Type the COM number from the device manager 115200 for the speed and check serial for the connection type. Save your configuration in case you need to use it in the future.

Configuration

Cited Sources: https://wiki.odroid.com/odroid-xu4/os_images/linux/ubuntu_4.14/20171212

Click Open in putty and connect power to the HC2. The console window will show all the boot up messages and eventually give you a login prompt. The default login info is

User: odroid Password: odroid

and Root Access as

User: Root Password: odroid

We are going to login and install updates first. The sudo command is “Super User Do” command to run commands as Admin or Root. Type

odroid login: odroid

Password: odroid



sudo apt update

sudo apt upgrade

sudo apt dist-upgrade

sudo apt install linux-image-xu3

When you install the linux-image-xu3 it will throw out a prompt telling you what updating the kernel is dangerous. Do you want to abort the update? Select “NO”

sudo reboot

Some times it will throw errors about files being in use on your first boot if it does enter

sudo reboot

and pick up where you left off.

Partition the Hard Drive

Cited Sources: https://askubuntu.com/questions/517354/terminal-method-of-formatting-storage-drive

https://help.ubuntu.com/community/UsingUUID

Log back in and type

sudo apt-get install lshw

sudo lshw -C disk

This will list all attached storage.



You want the logical name for the hard drive in this case “/dev/sda”.

Next we will partition the disk. Type

sudo fdisk /dev/sda

Create a new partition type

n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4):

1

For the partition start and end hit enter twice to use the defaults of the entire drive

Type

w

to write the partition table and exit fdisk.

Format the Hard Drive

In this guide we are going to format the hard drive as ext4. If you ever have to recover the data on the drive ext4 not natively supported by windows. This is not major issue since Ubuntu/Nextcloud will be handling all of the read/write operations. If you need the drive to be directly comparable with windows or mac format it as vfat(fat32). Be aware vfat can only handle files up to 4gb and partitions up to 2TB. Make multiple partitions to work around the partition size limit.

Time to format the drive. Type

sudo mkfs -t ext4 /dev/sda1

When it finishes formatting we are going to set up the hard drive to mount on boot. We are going to create a directory Ubuntu to mount the hard drive to. I am naming mine “SATAHD” but you can use any name you want. Type

sudo mkdir /media/SATAHD

Next we need the UUID of the hard drive. When a hard drive is partitioned a UUID is generated and assigned to the partition. Our hard drive is physically identified as “/dev/sda1” with “sda” being the drive and “1” being the first partition. If the hard drive was swapped /dev/sda1 would be the first partition of the new drive. However the UUID of the partition is unique to only that partition. If you want Ubuntu to automatically mount whatever drive you put in it as SATAHD you may use /dev/sda1 instead of the UUID. To look up the UUID type

sudo blkid

search the results for /dev/sda1 uuid=

copy the UUID to notepad or scratch paper.



Next we are going to set the drive to automatically mount on boot. The “sudo nano” command is a terminal based text editor. Type

sudo nano -Bw /etc/fstab

use your arrow keys to go down to the bottom line add

UUID=7300860a-9dd1-4dd2-8978-d70f3f7bab1b /media/SATAHD EXT4 defaults 0 2

Use the UUID you copied in the last step instead of the one I used. “/media/SATAHD” is the mount point and the directory we created earlier. ext4 is the file system we used in formatting the drive. If you used something other then ext4 substitute the correct file system.



hold “Ctrl” + “X” to exit. Press “Y” to save changes and Enter to save over the old file.

Type

sudo reboot

The drive should automatically mount on boot.

Installing NextCloud

Cited Sources: https://docs.nextcloud.com/server/13/admin_manual/installation/source_installation.html

In this guide we are going to install NextCloud with a snap package. If you want to manually install and configure Nextcloud the documentation is here https://docs.nextcloud.com/server/13/admin_manual/installation/source_installation.html

Type

sudo snap install nextcloud

Nextcloud has a list of authorized domains or addresses by default the first IP address you access nextcloud from will be added to that list. After that you must manually add addresses. I prefer to have my router automatically give the same IP address to the HC2 using the MAC Address. You can set your IP address to be a static self assigned instead of DHCP if your router doesn’t support assigning IP addresses this way.

Type

ifconfig -a

look for the eth0 ip address of your HC2

Open your web browser and type in the ip address of your HC2. You will be greated with a, “Make a new admin account” screen. Enter your choice of username and password. On the next screen close the, “Welcome to nextcloud” pop up. Click the gear in the top right corner. Select apps. Scroll down the list of apps looking for, “External storage support”. On the right side click the Enable button.

Click the gear in the top right corner again. Select admin. On the left side bar select, “External Storage.” click the, “Add Storage” drop down box and select local. Fill in the location as, “/media/SATAHD” Hit the check box on the right to save changes.



Your hard drive will now appear on the home screen as local.

If you need to change the servers config.php file type

sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php

The setting you will most likely have to mess with is the trusted domains should your IP Address change.

As a good security practice you should change your password for the odroid account and root. Type

sudo passwd

and

passwd

You can enable HTTPS but web browsers won’t like self signed certificates so do it right and use Lets Encrypt.

You can also set up your Nextcloud to be accessible through a Dynamic DNS but that will be another tutorial.

Updated: Performance test

Farther reading

https://help.nextcloud.com/t/adding-a-new-trusted-domain/26

https://github.com/nextcloud/nextcloud-snap

https://docs.nextcloud.com/server/13/admin_manual/