[FIRMWARE] FreeNAS on PR4100 - updated!

FreeNAS is free and open-source NAS software based on FreeBSD.
It offers several extra features missing in the WD OS, e.g. ZFS storage and virtualization.
This guide provides a complete replacement for the WD OS3 firmware.

Official website: http://www.freenas.org/

Recommended to run with 2x 8GB DDR3L SODIMM ram.
FreeNAS requires at least 8GB ram, so it probably doesn’t work on the PR2100.


Here is a zipped image of FreeNAS 11.2-U3 you can flash to a USB drive of at least 16GB. Unzip the image first!
On windows, you could use rufus to flash it.
On unix, use dd.

dd if=fn.img of=/dev/sdX bs=4M

Alternatively, create your own FreeNAS boot disk with debian/ubuntu

create FreeNAS boot disk with QEMU

Get the FreeNAS installer ISO (v11.2) on the website.
Run the installer on a virtual machine with UEFI (and 2G ram) and install to an empty USB flash drive (at /dev/sdX).
Qemu needs to find bios.bin in the bootloader path.

apt install qemu-kvm ovmf
cp /usr/share/ovmf/OVMF.fd ./bios.bin
kvm -L . -cdrom <freenas.iso> -hda /dev/sdX -boot once=d -m 2G

Make sure you select UEFI bootloader during the installation process.
When it is ready, shutdown the VM.

Plug the USB flash drive in the PRx100 NAS.
Reboot, wait about 5 minutes and lookup the IP address on your router.
Open this IP address in your browser and enjoy FreeNAS!
Login as root - freenas. (change this asap!)

Create a storage pool

Warning: this will erase all data on the disks. The file system is incompatible with the original OS.
I’d suggest to only insert the drives you want to be used, unplug the others. The NAS supports hotswap so you don’t need to shutdown. Refresh the web interface.

In the left column, select “Storage”, then select “Pools”.
On the right, select “Add Pool”.
Then select “Create Pool” (or import an existing one).

All available devices are now listed, including the internal mmc flash. I’d definitely not write to that one as it voids your warranty.
Select the ada devices from the available devices list and press the left arrow to move them to the Data VDev list.
You may also setup an SSD cache here.

Pick a name for the pool and then select “Create” to initialize the pool.

You can now install extra applications.

Hardware control

As of FreeNAS 11.2 you can control the hardware (fan, lcd, leds, …) as the kernel supports the braswell UART and I2C device.
Here’s a hardware control script that can be used as a post-init script. Add it in Tasks - Init/Shutdown scripts.

  • temperature monitor for CPU, RAM, disks with fan control
  • led control
  • shows IP address on LCD button press

You may want to tune it to your liking… e.g. add shutdown conditions, weather forecast, recent downloads, …

Manual interaction with the hardware can be done with screen and this list of commands.

screen /dev/ttyu3
# FAN=20        # better not to rely on this low fixed fan speed value
# LN1=Hello World


Use this at your own risk.

You can’t import your existing data as FreeNAS does not support ext4 file systems. Your drives will be fully wiped when you create a ZFS array. However, a preview of the webgui without creating an array is harmless…

Hardware control is available, but use it with common sense. Read the script.
Don’t fry your NAS by turning the FAN off. Without temperature monitoring it may melt / burn.
The hardware control script may get some important upgrades in the future so check for available updates.

To go back to the My Cloud OS, shutdown the NAS, unplug the FreeNAS boot usb drive and reboot.

Create a virtual test setup

Virtual test setup

You can test the whole flow first by writing to a virtual disk instead of an actual disk.

dd if=/dev/zero of=ovmf.disk bs=1 count=1 seek=$(( (10 * 1024 * 1024 * 1024) - 1))
kvm  -L . -cdrom <path_to_freenas.iso> \
                   -hda ovmf.disk -boot once=d -m 2G

Test by booting the disk.

kvm -bios ./bios.bin -hda ovmf.disk -m 2G
1 Like

The following posts contain some notes I took during development. I’ll update the first post when necessary.

The Braswell SMBus driver for FreeBSD is called ichsmb_pci.
Source: https://github.com/freebsd/freebsd/blob/384c7fc01983878ebbe90da5c3a309fd9b338373/sys/dev/ichsmb/ichsmb_pci.c
It’s the starting point to get the fan / lcd control working.

List kernel modules


Load modules

kldload iicbus smbus smb ichsmb

Show pci devices (lspci)


Edit /etc/devfs.rules and add this section to enable creation of smb devices

add path 'i2c*' mode 660 group uucp                                                                                                 
add path 'smb*' mode 660 group uucp                                                                                                 
add path 'ichsmb*' mode 660 group uucp 

Reload these new devfs rules

devfs rule applyset

Reload ichsmb driver and you’ll see /dev/smb0 is created now.
Now poll for devices on the bus.

[root@freenas /usr/include/dev]# smbmsg -p                                                                                          
Probing for devices on /dev/smb0:                                                                                                   
Device @0x10: w                                                                                                                     
Device @0x60: rw                                                                                                                    
Device @0x62: rw                                                                                                                    
Device @0x98: rw                                                                                                                    
Device @0xa0: rw                                                                                                                    
Device @0xa2: rw

Read temperatures from 2 sensors (like here)

smbmsg -s 0x98 -c 0x00 -i 1 -F %d
24  --> 36 degrees celcius
smbmsg -s 0x98 -c 0x01 -i 1 -F %d
25  --> 37 degrees celsius

I did not manage to get the stty device working yet. This is the serial config on debian, I just need to convert this info to something usable in BSD.

root@pr4100:~# dmesg | grep -C4 tty
2.259560] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    2.286971] serial8250: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[    2.296401] serial 0000:00:1e.3: enabling device (0000 -> 0002)
[    2.303396] 0000:00:1e.3: ttyS1 at MMIO 0x8161e000 (irq = 18, base_baud = 2764800) is a 16550A
[    2.313233] serial 0000:00:1e.4: enabling device (0000 -> 0002)
[    2.320173] 0000:00:1e.4: ttyS2 at MMIO 0x8161d000 (irq = 19, base_baud = 2764800) is a 16550A
[    2.330182] Linux agpgart interface v0.103

root@pr4100:~# cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:28149 rx:0 RTS|DTR
1: uart:16550A mmio:0x8161E000 irq:18 tx:0 rx:0 CTS
2: uart:16550A mmio:0x8161D000 irq:19 tx:58 rx:0
3: uart:unknown port:000002E8 irq:3

The sio module is possibly the missing link… but it’s not part of the default FreeNAS kernel.

EDIT: the sio module is outdated. Just get the uart.ko and puc.ko modules from the trueos kernel (= FreeNAS baseline).

1 Like

Great work as always @Tfl - the PR*100 hardware is pretty impressive embedded hardware (even if it’s not the most well documented by the system manufacturer :roll_eyes:). This is getting close to unRAID territory (which itself is a bit bloated and has some non-FOSS elements).

Okay I found the missing piece to get UART for the PMC module: https://github.com/freebsd/freebsd/blob/d8596f6f687a64b994b065f3058155405dfc39db/sys/dev/uart/uart_bus_pci.c#L138-L141
Now I just need to rebuild FreeNAS with uart and puc modules in the kernel, then figure out how to load them with tunables.

Good news: as of FreeNas 11.2 the puc driver is included in the kernel (uart was already there).
This is what you get out of the box:

freenas# dmesg | grep uart
uart2: <Intel Cherryview SIO HSUART#1> mem 0x8161e000-0x8161efff at device 30.3 on pci0
uart3: <Intel Cherryview SIO HSUART#2> mem 0x8161d000-0x8161dfff irq 19 at device 30.4 on pci0
uart0: <16550 or compatible> at port 0x3f8 irq 4 flags 0x10 on isa0
uart0: console (115200,n,8,1)

You may recognize the device with irq 19 from the debian setup…
Now it is as simple as

screen /dev/ttyu3

Type STA and hit return to get the current status (use caps, it may show ERR on the first attempt). Unfortunately you can’t see what you’re typing (echo is off).


This means the communication with the PMC chip is successful…
Let’s calm down the fan and set a welcome message on the LCD.

> FAN=20
> LN1=FreeNAS runs 
> LN2=on your PR4100

Press CTRL+A and then CTRL+\ and y to exit screen.

Time to setup wd hw tools…

I have no FreeBSD experience but everything is well documented.
The current challenge is to setup the wdhw tools.

It’s recommended to use a jail.
Create one with the name wdhws
In jail properties, set devfs_ruleset to 0 to allow access to /dev/ttyu3 (this can be tuned later).

A jail needs an ip address. As I had connection issues via the GUI so this part was done in the shell (ssh).
Get your ip address and network interface from the FreeNAS dashboard - Network info.
Let’s assume it is at re1.
Pick a valid ip for your network and set it on the jail

iocage set ip4_addr="re1:" wdhws

Start the jail and open the console (can be done in the gui)

iocage start wdhws
iocage console wdhws

Bootstrap pkg and get python with the serial module.

root@wdhws:~ # pkg install py27-serial
root@wdhws:~ # miniterm.py

--- Available ports:
---  1: /dev/cuau0           'n/a'
---  2: /dev/cuau2           'n/a'
---  3: /dev/cuau3           'n/a'
--- Enter port index or full name: 3
--- Miniterm on /dev/cuau3  9600,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

Unfortunately, the wdhw tools by Michael Roland require an smbus package. I’m now looking for a workaround.

@Tfl and all the other members who put time into software packages–thank you.

I have a question: Would you run this on your home NAS? I realize it isn’t out of testing yet, but when compared to the stock OS it may have an edge. IMHO the PR4100 as shipped behaves like a beta anyway. :slight_smile:

If not this would you recommend anything other package to achieve better reliability and functionality? I’m considering selling it if I cannot find a solution to various issues.


My PR4100 at home is running debian stretch + OMV with a 4 disk ZFS RAIDZ pool. It runs from an external USB harddrive (WD passport). I can also boot with a FreeNAS usb flash drive and import my pool again.

At work, I have box with 16GB ram with debian on disk 2. Sometimes I boot into the original OS by simply unplugging that disk (NAS in shutdown). I used debian+ext4 to run a few VMs for an experiment but the performance was not that great. Disk 3 and 4 are a mirrored ZPOOL, the original OS doesn’t like it but it doesn’t touch it.

Main reason to switch to custom firmware is the flexibility, functionality and security. Some of the My Cloud software packages are 8 years old… and the most recent are still at least 2 years old.

Both OMV and FreeNAS are great improvements… Both support a wide array of applications (much wider than what we have here) and the GUI has a lot more features too. I’ll summarize some of the main selling points for each.

Debian (+OMV)

  • Supports EXT4 so you can keep your data. Just import the array in the web ui.
  • Supports ZFS and snapraid
  • It’s more likely you’re familiar with the OS.
  • More documentation, more packages available.
  • Warning: you need to build a custom kernel to have full hardware support (fan, lcd, …). It’s not difficult but it looks a bit scary (to me it was :slight_smile: ). But you set this up once and you’re good to go for months.


  • Better GUI (personal opinion), more features in the GUI. Unlikely you’ll ever need a shell.
  • Documentation is very clean.
  • As of 11.2, hardware support is included. All you need is a simple startup shell script (pm me if you want mine)
  • Security and network stack are the best you can get.
  • ZFS only

It is quite risky to use these small (4 disk) arrays with these huge 8TB+ disks. A raid rebuild takes very long.
Using ZFS with sufficient RAM may put less stress on the disks.
Furthermore you’ll get scrubbing, which checksums your data to detect corrupted files. This feature simply doesn’t exist on the ext4 file system.

So yeah, I strongly suggest to pick one of them… or both if you pick ZFS. The guides here on the forum do not affect the internal flash so you can always go back to the initial state.

How much Ram does Freenas use? The required min. seems 8GB.
How is the overall performance?

EDIT: 4GB is okay to do a quick test.
However it is still strongly recommended to upgrade to 8 or 16GB, especially if you want to run VMs.

EDIT2: I didn’t get any complaints about the boot image, but imo it’s a bit too small to be useful and it’s based on the nightlies. I’ll make a new one based on the 11.2 beta and with an updated HW control script.

I’ve updated the image to FreeNAS 11.2BETA3 from a month ago with a minimum required USB disk size of 8GB. The previous image was too small to run upgrades from.
Default credentials are root - freenas.
In the meantime is the 11.2 release candidate 1 available, so you should upgrade to that one from within the GUI.

The hardware control script can be tested quickly from the shell in the web interface:

curl -L https://git.io/fpL06 | bash

You’d want to set /root/wdhws as a post-init command (Tasks - Init/Shutdown).

curl -L https://git.io/fpL06 -o wdhws
chmod +x wdhws

Use nano or vi to inspect it and make changes.

nano wdhws

@Tfl You said you are running debian stretch + OMV on your PR4100 from a USB harddrive. How does one go about doing this?! I really want to set this up.

Install Debian Stretch, with kernel and hw tools.
I used a USB flash drive with the installer and an empty USB My Passport drive.
Then install OMV.

This looks great! My only issue here is whether or not the Plex-hardware-transcoding will still work? Have anyone tested this, and how do you run the app to get hardware-transcoding?

If you have a Plex Pass, it should work out of the box (I didn’t test it but I’d be amazed if it didn’t work).
If you don’t have a Plex Pass, it’s not impossible but you’ll need to repackage the Plex PR4100 binaries.

See https://www.reddit.com/r/freenas/comments/9vm19l/is_hardware_transcoding_now_available_for_plex_on/

Some useful posts on Plex for FreeNAS:

Once I’m through the whole setup, I’ll post instructions here.

I fell a bit silent on the Plex HW transcode for FreeNAS … the answer is to wait for FreeNAS 12.
See https://www.ixsystems.com/community/threads/activating-plex-hardware-acceleration.75391/post-525442

I post similar message on Github, maybe no one read it there.
Something changed in smartctl command, and get_disktemp gives something like 24/55 (it is actual and maximum temperature)
I changed script line 65 a little and it worked well by now:
smartctl -n standby -A /dev/ada$1 | grep Temperature_Celsius | cut -d’/’ -f2 | cut -d’ ’ -f2 | awk ‘{print $NF}’
I don’t have a bash scripting experience at all, please correct if needed.

Update process to 11.3U1 is quite long, i am doing in on my “not so modern” notebook and it took an hour (USB3.0 flash). On PR4100 it should take longer

1 Like