Wednesday, January 4, 2012

qnap lost drive

My QNAP lost the HDD. That is when I started it it asked to format my drive.
Apparantly this can happen and there is FAQ item on this qnap site.

http://www.qnap.com/faq_detail.asp?faq_id=531

This did not work for me. Maybe because I did some other trying out before.

Anyway I tried took out one of the disks and put them hard drive dock. And I managed to mount it under linux as ext3 filesytem. Nice. So I managed to rescue my data and the reformat the drives.

Some more info on NFS. To mount from command line:
sudo mount QNAP_ADDRESS:/folder/already/setup/to/be/shared /home/username/folder/in/your/local/computer/home/music /home/poningru/music

Also something that could be useful from http://www.mpcclub.com/forum/showthread.php?t=13723

"user and grouid is a bit tricky to enable access in write from macosx/linux....

i mean that a new file should be created with one of the local user of QNAP

then i specify it: (the write request anonymous is translated in user 
500, group 500 (the first user, pass of yor QNAP.. see cat /etc/passwd 
and cat /etc/group

then my exports file in /opt/etc is:

/share/Public (rw,all_squash,anonuid=500,anongid=100)
" 




Friday, January 4, 2008

Installing optware and NFS on a QNAP TS-201/TS-101

With optware installed on the turbostation you can install additional packages. So you
can make your turbostation to do what you want.

This post describes how to installl optware without changing the firmware in your turbostation.
It also describes how to install NFS as an example on installin packages. And as last in detail how to change so that when you boot up you can start services automatically, so you do not have to redo it manually (On reboot the firmware overwrites changes made.)

As always be aware and it done on your own risk.

This post is a compilation of the information found in:

Prerequisites

To be able to install things on your TS-201 is that you have a firmware with telnet enabled. If you do not have it, you can download it from QNAP homepage:
Install the firmware according to the instructions.


Telnet

First you have to telnet into your TS-201.
The port to use is 13131 and with username administrator.
The default password for administrator is admin if
you have not changed it through the webinterface.

telnet TS201_Address 13131

Now you are in ash shell as root on your TS-201.

Install optware

1. Create directory structure

cd /
rmdir /opt
mkdir /mnt/HDA_ROOT/opt
ln -sf /mnt/HDA_ROOT/opt /opt


2. Get and install latest ipkg. Currently the below is latest.


cd /tmp
wget http://ipkg.nslu2-linux.org/feeds/optware/ts101/cross/unstable/ipkg-opt_0.99.163-9_powerpc.ipk
tar -zxOf ipkg-opt_0.99.163-9_powerpc.ipk ./data.tar.gz | tar -zx -C /
# Add where to download packages from
echo src ts101 http://ipkg.nslu2-linux.org/feeds/optware/ts101/cross/unstable >> /opt/etc/ipkg.conf


NOTE: The above 'wget ipkg-opt...' does not work right now since it is deleted in the feed for some reason. According to:
http://tech.groups.yahoo.com/group/OpenTurbostation/message/1002
So use this instead:

wget http://www.mediamax.com/bzhou/Hosted/optware/ts101/ipkg-opt_0.99.163-9_powerpc.ipk


Now you can install all packages that you want in your TurboStation

Install NFS

1. Install NFS with optware. See above to install optware.

/opt/bin/ipkg update
/opt/bin/ipkg install unfs3

2. Create exports file and start nfs.

echo /share/Public (rw,no_root_squash) > /opt/etc/exports
portmap
/opt/sbin/unfsd -e /opt/etc/exports


Above example exports the Public folder. Also the no_root_squash option should only be used if you trust your users. That if they mount the folder as root they will have root permissions.

If you want to mount the TurboStation with fstab you should have something like the below in there.


Your_TS_Address:/share/Public /qnap/Public nfs auto,nosuid,user,nolock,tcp 0 0


Backup configuration

Backup your configuration. I find it best to do the backup inte /share/Public
which the TurboStation should not overwrite.

cd /share/Public
tar -cf backupTS201.tar /mnt/HDA_ROOT/opt

Edit autorun.sh

When the turbostation is rebooted the firmware overwrites the changes that have been made. What is kept is what is on the harddrives. You also have to restart the services manually. This can be done automatically by editing the autorun.sh in mtdblock4 which the firmware isnt overwriting on a reboot.

If you reboot after the above, the opt symlink would need to be redone and start of nfs aswell. There is also no guarantee that the things in HDA_ROOT are kept. So you might need to extract your backup aswell.

But everything can be done automatically with autorun.sh.

1. Mount mtdblock4

mkdir -p /tmp/config
mount -t ext2 /dev/mtdblock4 /tmp/config

2. Edit config/autorun.sh you can use vi or the echo method above.

vi config/autorun.sh

Add this to the script:

rmdir /opt
ln -sf /mnt/HDA_ROOT/opt /opt
portmap
/opt/sbin/unfsd -e /opt/etc/exports -t

3. Save the file and umount.

umount /tmp/config

Now NFS will be started and the symlinks to opt will work.