Running Unraid on Thecus N5200


Recommended Posts

I have run unraid for a couple of years now on a regular computer. I also have a Thecus N5200 NAS (600Mhz Pentium M with 512 RAM). Specs for the Thecus are very similar to the Norco DS-520G that somebody on the forum has said runs Unraid ok. In fact, I think that the hardware is virtually identical except that the Norco processor runs at 1GHZ and the Thecus does not have a VGA port (although there is a header on the motherboard for VGA).

 

I want to try unraid on the thecus, but have no way to change the bios to boot from usb instead of the internal CF (attached to a 44 pin IDE controller). I have discovered that there is a boot loader shell script from Thecus that is normally used to load firmware directly on boot if the web interface gets messed up. What you do is put a file (example in code box below) on the usb flash drive along with the firmware and it sets up the Thecus. The shell script is named factory_test.sh - - the Thecus looks for a file named that and executes the file if it is attached to the USB at boot time.

 

I was wondering if it would be possible somehow to hijack the boot process of the Thecus using a file named "factory_test.sh" to get the box to boot off the Unraid on the USB flash drive.

 

I admit it is a long shot, but seems more do-able than soldering on a VGA connector in order to change the boot order in the bios.

 

#!/bin/sh
fwfile="N5200upgrade.1.00.07.bin"
raid_test=0
nonettest=0

function copy_otherfile() {
mountpath="/mnt"
normal=`cat /proc/scsi/scsi|awk  '/Thecus:/{FS=" ";printf("%s:%s\n",$2,$3)}'|awk -F: '{if ($2> {printf("%s\n",$4)}}'`
for i in $normal ;do
	strExec="cat /proc/partitions|awk '/${i}/{FS=\" \";print \$4}'"
	mount_usbs=`eval ${strExec}` 
	for mount_usb in $mount_usbs ;do
  		#create folder
  		strexec="mount|awk '/\/dev\/${mount_usb}/&&/\/mnt/'"
  		chkmount=`eval ${strexec}`
  		if [ "${chkmount}" == "" ];then
  			/bin/mount -o iocharset=utf8,umask=0,fmask=001,uid=99,gid=99 "/dev/${mount_usb}" "${mountpath}"
  			if [ $? = 0 ];then
  				if [ -f ${mountpath}/led_test.sh ];then
  					cp ${mountpath}/led_test.sh /app 
  					chmod +x /app/led_test.sh
  				fi
  				if [ -f ${mountpath}/ether-wake ];then
  					cp ${mountpath}/ether-wake /app 
  					chmod +x /app/ether-wake
  				fi
	  			sync
  				umount ${mountpath}
  			fi
  		else
  			if [ -f ${mountpath}/led_test.sh ];then
  				cp ${mountpath}/led_test.sh /app 
  				chmod +x /app/led_test.sh
  			fi
  			if [ -f ${mountpath}/ether-wake ];then
  				cp ${mountpath}/ether-wake /app 
  				chmod +x /app/ether-wake
  			fi
  			sync
  			umount ${mountpath}
  		fi
 	done
done
}

function copy_fw() {
mountpath="/mnt"
normal=`cat /proc/scsi/scsi|awk  '/Thecus:/{FS=" ";printf("%s:%s\n",$2,$3)}'|awk -F: '{if ($2> {printf("%s\n",$4)}}'`
for i in $normal ;do
	strExec="cat /proc/partitions|awk '/${i}/{FS=\" \";print \$4}'"
	mount_usbs=`eval ${strExec}` 
	for mount_usb in $mount_usbs ;do
  		#create folder
  		strexec="mount|awk '/\/dev\/${mount_usb}/&&/\/mnt/'"
  		chkmount=`eval ${strexec}`
  		if [ "${chkmount}" == "" ];then
  			/bin/mount -o iocharset=utf8,umask=0,fmask=001,uid=99,gid=99 "/dev/${mount_usb}" "${mountpath}"
  			if [ $? = 0 ];then
  				if [ -f ${mountpath}/${fwfile} ];then
  					cp ${mountpath}/${fwfile} /tmp
  				fi
	  			sync
  				umount ${mountpath}
  			fi
  		else
  			if [ -f ${mountpath}/${fwfile} ];then
  				cp ${mountpath}/${fwfile} /tmp
  			fi
  			sync
  			umount ${mountpath}
  		fi
 	done
done
}
##for fwupgrade
#echo  "agent2 0 BTMSG Start FW upgrade" > /tmp/avrpipe
if [ ! -f /tmp/${fwfile} ];then
#echo  "agent2 0 BTMSG Copy N5200 FW" > /tmp/avrpipe
copy_fw	
fi
sync
ifconfig eth0 172.16.77.100 netmask 255.255.255.0 broadcast 172.16.77.255
ifconfig eth1 192.168.2.254 netmask 255.255.255.0 broadcast 192.168.2.255
sleep 3
echo  "agent2 0 BTMSG Start Upgrade ..." > /tmp/avrpipe

if [ -f /tmp/${fwfile} ];then
cd /tmp
/usr/bin/des -k 2006N5200 -D /tmp/${fwfile} /tmp/${fwfile}.tar.gz
tar zxfp /tmp/${fwfile}.tar.gz
/tmp/upgrade
sh -x /tmp/upgrade/postup.sh
fi

rm -rf /app/factory_test.sh /app/ether-wake /app/led_test.sh

###Reset to factory default######
sh /img/bin/resetDefault.sh

exit

 

Any ideas would be appreciated!

 

thanks

 

Bill

Link to comment

 

You cannot use the "shell script" you described to boot from, as the OS is already running by the time it gets to it.  The only way is to replace the OS.  Here is one possible way.

 

What I would try is this:

 

I would purchase a second compact flash drive, similar to the one in the Thecus.  (Doesn't have to be too big, so almost anything over 64 meg will do.)

 

Then, format it and use syslinux -ma on it, the same way you would load syslinux on your flash drive.  Next, download the unRAID software and load it on the compact flash drive.  You probably don't need the "config folder" but you can copy it in place if you like.  Do NOT set the volume label to UNRAID, set it to anything else you would like.

 

At that point, it should boot the same as your original OS.  Before you boot you should also plug in your USB flash drive into the Thecus.  It should have the volume label set to UNRIAD 

 

Now, it should boot off of the compact flash.  When it goes to look for the usb device with the UNRAID label it should find the USB drive and mount it to get to the configuration files on it.  (The config folder on the Compact flash will probably not even be used at all if I'm right)

 

In any case, if the network chipset is supported you'll be able to log in and set everything else up as needed.

 

 

Joe L.

 

 

Link to comment

I was wondering about this too. I have a Thecus 5200BR also.

I opened it up and considered using a small laptop hard drive on the 44pin adapter. (it is removable).

 

In the end I bought the Norco.

 

However, this subject still interests me.

 

As far as booting off USB, not so sure it's possible.

From what I can see with the shell provided, a linux kernel is already running.

The whole issue here is getting it to switch and run another kernel.

It's possible, I've seen it done on my kuro box, but I don't know how to do it.

 

I wonder if you could actually boot from one of the hard drives? (or USB) if the flash device was not connected.

Link to comment

What I would try is this:

 

I would purchase a second compact flash drive, similar to the one in the Thecus.  (Doesn't have to be too big, so almost anything over 64 meg will do.)

 

Maybe the newer versions use a compact flash card.

I know my version has an embedded flash (not compact) connected to a 44 pin adapter.

 

Is this the same technical specs for a real compact flash?

If so, perhaps it could be reset with the unraid OS then.

 

Link to comment

If the 44 pin connector is similar to the one used for laptop drives, then something like this: http://www.buyextras.com/bethiquide44.html would allow you to load a compact flash drive format as FAT, use syslinux -ma, load files from unRAID distribution.  Just do not set volume label.  Then, format your USB flash drive as FAT, load the unRAID distribution on it and set its volume label to UNRAID.  You probably do not need to use syslinux on it, as it will not be booted from, it is used after you boot from the CF card.

 

Joe L.

Link to comment

Yes - of course - it is not a CF card - as you say WeeboTech, it is an embedded flash (I think it is sometimes called a DOM?) For some reason I remembered it as a CF card. Mine is actually the older (not Pro) model and only has two ethernet ports (not the router version).

 

But, it sure looks like Joe L.'s idea might work with the CF to 44 pin adapter. I am going to order it along with a CF card and let you know how it works.

 

I wonder if the 600Mhz processor will be adequate for unraid?

 

Also, I have upgraded to 512 RAM (came with 256), but the thecus usergroup has several reports of some 1 GB modules working - do you think upgrading to 1 GB RAM would be necessary? 

 

Using the Thecus firmware, the device is pretty snappy as a file server and has been super stable (so - it is time to change something!).

 

thanks

 

Bill

Link to comment
Also, I have upgraded to 512 RAM (came with 256), but the thecus usergroup has several reports of some 1 GB modules working - do you think upgrading to 1 GB RAM would be necessary?

512MB RAM is the minimum for unRAID.

If you plan to add 3rd party packages and tools and you can validated and access a 1GB ram chip, I would highly recommend it.

 

From what I read on one of the Thecus forums, 1GB modules dd NOT work.

If you have a post that says they do, I would like to see it.

Link to comment
From what I read on one of the Thecus forums, 1GB modules dd NOT work.

If you have a post that says they do, I would like to see it.

 

At the following page,http://thecususergroup.proboards106.com/index.cgi?board=n5200modifications&action=display&thread=1499&page=2, several users report using 1GB modules - the last post indicates that it might be the version of the bios that matters. Without the vga header connected I don't know how to check the bios versions though.

 

Bill

Link to comment

Just an update. I had the idea to remove the embedded flash and see if the bios would allow boot from the USB disk.

 

Sure enough, when the embedded flash drive was removed, Unraid booted as long as there were no hard drives attached. Using 4.2 of Unraid, I was able to boot into the Thecus N5200 and, if I inserted the hard drives after the boot began, I was able to see and use all the hard drives in the Unraid interface.

 

The clean shutdown command, however, did not work (at least to turn off the unit)- the usb drive would power off (red light on the drive would go off), but the Thecus unit itself stayed running - had to manually power off. 

 

Also unfortunately, when I upgraded my key drive to 4.3.3, I could not get the unit to boot all the way - never got to the web screen. Since I cannot see the boot sequence without a monitor attached, I can't tell where the boot is hanging. Seems to start ok, (light on USB flash drive blinks as normal) but stops early.

 

I ordered the device mentioned earlier in this thread - hopefully that will allow the boot with the hard drives attached - don't see how that will solve the boot into 4.3.3 problem though.

 

Is there a way to log the boot sequence onto the flash drive so that I could see where the process stops?

 

Bill

Link to comment

You mentioned the web screen does not come up, However, did you try to telnet into the machine via IP?

If you can telnet into the machine, then you can review or copy the syslog file to the /boot folder on the flash drive.

 

What device are you going to use to replace the flash drive.

I found a couple of horizontal 44 pin flash units. Just want to compare notes.

 

As far as putting in 1GB of ram. all the posts in the prior link referred to the 5200PRO not the regular 5200.

Link to comment

I didn't try telnet - will try that next time. I have reverted to the stock firmware until I get the adapter.

 

I ordered this http://www.newegg.com/Product/Product.aspx?Item=N82E16812186034 along with a 44 pin 2 inch cable (couldn't find the cable on newegg though)

 

Will let you know if it works.

 

You are right about the PRO ram. Probably doubtful that 1 Gig will work in the non-pro n5200.

 

Bill

 

 

Link to comment
  • 2 years later...

Hi All,

 

I know this is an old one, but I thought I would update anyways...

 

I have 5200BR, I HAVE a working 1gb mem module in it, I soldered in the VGA header.

 

I currently have windows 2008 server running (on a 60gb laptop drive in place of DOM), all be it a little slow but very usable.

 

I tried the latest unraid, however post 4.3.3 they built the kernal with pae and the thecus does not support this hence why the usb wont boot any more (above)

 

I'm currently trying to install freenas, the usb boot of freenas halts on the USB setup during boot, so i'm going to image my windows 2008 install and then replace with the freenas image and see what happens...

I managed to get the 10.10 desktop edition of ubuntu running off a live usb pen too.

Link to comment

For the record, I was able to get unRAID running on the Thecus 5200BR after I recompiled the kernel.

I took out PAE support and enabled pentiumM support(I think). I know there were two cpu kernel features I adjusted.

 

Also After taking out the DOM(cuz mine died) it allowed booting from USB.

Just thought I would post this in case someone else was attempting to get unRAID running on an older Thecus.

Link to comment

The adapter that Joe L mentioned http://www.buyextras.com/bethiquide44.html says it doesn't need power if connected to the 44 pin IDE port - I assumed that the adapter won't need any separate power - it is supplied through the 44 pin connector. The one I am buying looks identical to that one.

 

Guess I will find out later this week.

mine did need the extra power connector.  I guess it depends on the motherboard.
Link to comment
  • 2 years later...

WeeboTech, would you be able to build a Thecus 5200BR kernal for the 5rc11 build? I really want to put my second license on this device to make use of it again in a new project.

 

Alternatively, let me know if there are any special instructions to build a 5rc11 compatible kernal, and I'll start googling 'kernal rebuilds' :-) (i'm not a linux person!!)

 

Thanks in advance!

Johner

Link to comment

WeeboTech, would you be able to build a Thecus 5200BR kernal for the 5rc11 build? I really want to put my second license on this device to make use of it again in a new project.

 

Alternatively, let me know if there are any special instructions to build a 5rc11 compatible kernal, and I'll start googling 'kernal rebuilds' :-) (i'm not a linux person!!)

 

Thanks in advance!

Johner

 

I'm sorry, my thecus and all my computers were submerged during Hurricane Sandy. I no longer have any of the code or computers.  What you have to do is recompile the kernel with the .config, but do a make menuconfig and change the CPU support.  Turn off PAE and turn on Pentium M/Celeron M support.  After that you should be OK.  At least I do not remember doing much more then that.  Maybe one of the gang on the forum can assist with this. It'll be a while yet before I build an ESXi host and can do unRAID development again.

 

Also, I did have to take out the DISK ON MODULE.. and I had to rig up a VGA connector from an old motherboard onto the thecus so I could see the BIOS. Then change how it booted.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.