The ODROID-HC4 is a relatively new device created and produced by Hardkernel, the most prominent feature are two slots at the top of the plastic housing that reveals two SATA ports.

I had been looking into NAS for a long time, the thing that always stopped me from buying one was the software. Devices for consumers and small companies usually come with a limited feature set, and you depend on the support of the manufacturer to provide updates and new features. As a Linux user for many years, I’m used to installing the software and tools that I need.

I also looked into different SOC-boards like the Raspberry Pi, since the first Raspberry Pi many new boards were created and sold for releatively low prices. Many of these boards have limits in their IO because they use the USB as a bridge for Ethernet and the actual USB ports. Of course that limits the performance as a NAS a lot.

Luckily, manufactures have started to build more specialised boards for specific use cases.

Requirements

Next to the HC4 itself, you will need a power supply, which is often offered as a bundle. Also, I would recommend using a micro SD card to store the OS. And of course depending on your needs, one or two drives. You can use 2.5" as well as 3.5" drives, if you want to use an SSD or 2.5" HDD it might make sense to get a little support printed.

Hardkernel provides a customized Ubuntu (and Android 9) as official image. If you need a graphical interface you can use the Mate version, Mate is a lightweight desktop environment. I haven’t tested this though and I don’t know how well it performs. Else use the minimal image, it’s much smaller and only comes with the things you need.

Flash the image

After downloading the image from Hardkernel you need flash to the SD card of course. balenaEtcher is an excellent and simple tool to flash OS images to SD cards and USB drives.

Flashing the image with Etcher should be pretty much self explanatory. After flashing the image put the SD card in a safe stop, we will need it later.

First boot

Before you connect the power supply, connect an Ethernet cable to your router so that you have internet access, a USB keyboard and a monitor via HDMI, do not insert the Micro SD card at this point. The HC4 uses Petitboot, a bootloader supporting Linux and FreeBSD, it also supports to boot via network.

Before we start with the actual OS, we need to update Petitboot else you might experience something like I did after my first kernel update, ending up with a system refusing to boot. I found that information in the forum which in general is very helpful.

After connection the cable lastly plug in the power supply and watch boot process on the screen as Petitboot won’t find anything to boot from, you will end up in a menu with “Exit to shell” preselected. Hit enter and type pb-update.

If you don’t use an English keyboard layout, check which key to press to get the dash.

Now you need to wait a little while Petitboot will update itself from the internet, it will download a new version and update the different partitons on the integrated storage of the HC4. When the update process is done and the HC4 has rebooted into the same menu again you can unplug the power supply and insert the SD card, if you need the HDMI connection and keyboard you can connect them to the original host again, we will continue via ssh from here.

Starting with Ubuntu

If you haven’t already now would be a good time to insert your drives into the HC4. With that done and the SD card inserted, you can finally plug in the power supply. And now wait for the HC4 to boot into Ubuntu. While waiting, you can configure your ssh connection and check the IP address of your HC4.

If you are unable to determine the IP address of your HC4 after booting into Ubuntu, you may connect HDMI and keyboard again to login directly from the shell and use ip a to list the interfaces and IP Address.

Now use ssh to connect to the HC4, user is root and password is odroid. First thing you should do is change the password of root just enter passwd and follow the instructions. After that run apt update and apt upgrade to get your OS up to date, this may take a while depending on how old the image is that you used.

Create a raid1

I retested this part inside a VM to make sure that the steps work, but I’m not an expert.

First get an overview of your disks just run fdsik -l, in my VM I get the following output:

...

Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: VBOX HARDDISK   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: VBOX HARDDISK   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

...

These two drives are my future raid 1 drives.

Now you need to start parted on the first drive parted -a optimal /dev/sdb.

Label the drive as “gpt” partition mklabel gpt and create a ext4 partition mkpart primary ext4 0% 100%.

Now you created tag the partition as raid set 1 raid on and run the align-check with optimal, the partition number is 1.

Finally, run print:

(parted) print                                                            
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdb: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  10.7GB  10.7GB               primary  raid

Exit via control + c.

And do the same steps for your second disk for me that would be /dev/sdc

If you check fdisk -l again you will see that you have two new RAID partitions.

Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: VBOX HARDDISK   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 50C5F6A9-E8EB-4656-B2A8-4FDAE98BE2AE

Device     Start      End  Sectors Size Type
/dev/sdb1   2048 20969471 20967424  10G Linux RAID


Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: VBOX HARDDISK   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 0D3FF90A-2708-4CCD-AA26-C3563CE8D339

Device     Start      End  Sectors Size Type
/dev/sdc1   2048 20969471 20967424  10G Linux RAID

Next we create the actual array, make sure to adjust the devices at the end.

mdadm --create /dev/md0 --level=1 --raid-devices=2 --spare=0 /dev/sdb1 /dev/sdc1

It will warn you that this array might not be bootable, that doesn’t matter in our case.

We type yes and “mdadm” will create the array.

With cat /proc/mdstat you get a status overview of your array.

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
md0 : active raid1 sdc1[1] sdb1[0]
      10474496 blocks super 1.2 [2/2] [UU]
      
unused devices: <none>

Now we need to format md0 as ext4 mkfs.ext4 /dev/md0

In my case that process is very quick, yours might take longer depending on the size.

Edit /etc/fstab and add a new line:

/dev/md0     /mnt/vault      ext4      defaults 0 2

Create the mount point mkdir /mnt/vault and mount your new raid 1, mount /dev/md0

Now save the config of mdadm mdadm --detail --scan >> /etc/mdadm/mdadm.conf and finally run update-initramfs -u

To make sure everything is working fine reboot your HC4 and check if the raid is mounted at /mnt/vault.

Final comment

The ODROID-HC4 is a very nice little server that offers you two SATA ports and a gigabit Ethernet port as highlights. It allows you to be very flexible regarding software and install all the services you need.

I personally use it as a backup at home, borg rsync and cron are enough to get a second backup of my main server. And I can simply create backups of my notebook and PC over the local network.

Of course, you could also set up a Nextcloud or another nice service that can run locally in your network.