BigDiver

Dive away, explore the net…

Archive for the ‘TeraStation’ Category

Installing the Debian Package Management in the Buffalo TeraStation

without comments

If you need to manipulate .deb packages directly in your TeraStation you should download and install the dpkg Debian package.

I did this procedure on Mac OS but you should be able to replicate it on a Linux machine as well. If on Windows get a utility that can extract the files inside of a Debian (.deb) file and you should be ok.

  1. Get the package dpkg for AMRel for Debian Lenny. The Mac in my case
  2. Extract the files from dpkg_1.14.25_armel.deb
    dpkg-deb -x dpkg_1.14.25_armel.deb dpkg
    cd dpkg
  3. Copy the extracted files to the TeraStation with scp. If you are on Windows use Putty.
    scp -r * root@:/

For this to work you should have SSH access to the TeraStation. Please read this post.

Now you can download (wget) and extract deb packages (dpkg-deb) directly in your TeraStation.
Good luck

Written by bigdiver

November 16, 2009 at 3:34 pm

TeraStation and Apple Time Machine

with one comment

Finally I got my iMac backing up to the TeraStation using Time Machine by following the instructions on this site.

The trick was creating the Sparse file by hand, after enabling the use of network volumes. I am using AppleTalk to mount the TeraStation share for the backups, and I setup a different share just for the backup files.

If the file “com.apple.timemachine.supported” does not get created automatically by Time Machine you’ll have to create it yourself.

Some sites discourage the use of SMB, all I can say is that the referenced procedure only worked for me with AFP. Maybe your mileage will vary.

Time Machine

Great job Newb @ MacTimes!
Thanks!

Written by bigdiver

September 4, 2009 at 4:08 am

Posted in Apple, MAC OS, TeraStation

Repair Disk problems on your TeraStation

without comments

If you suspect your TeraStation HDDs are failing and need to recover before it is too late you should use xfs_repair. You’ll need to unmount the XFS volumes before you can use the repair tool

unmount /dev/md2

 

If you try to unmount the TeraStation’s data disk (/dev/md2) and you get a device busy check if you have the media server running and the unmount again.

umount /dev/md2
Device is Busy

 

Go to http://your_terastation_ip:8080/ and select disable.

umount /dev/md2

 

Now you can run XFS Repair

xfs_repair

Written by bigdiver

September 2, 2009 at 3:31 pm

Posted in TeraStation

Recover from TeraStation Live Boot Errors

with 2 comments

If you found this post odds are that your TeraStation is in problems won’t boot, and Buffalo’s Tech Support is telling you to format your disks, and wipe out your data. First things first, hard disks today are very reliable, you have multiple copies of your data in the TS disks do not wipe them out and cause your own misery.

To follow this recovery procedure you’ll need 

  1. Telnet or SSH access to you TeraStation, check this article on how to do it
  2. A Linux PC (Debian, Ubuntu, Red Hat), or Linux Live CD for to boot on you Windows PC
  3. SATA Cables or powered SATA USB Adapter

Well it had to happen I was so happy with my TeraStation that it finally had to die or show some stupid design flaw.

I got a PS3 for my birthday and immediately  wanted to stream all my music from the TS to it. Buffalo sell’s the thing with a build it DLNA Mediaserver so I thought the process would be simple enough… Big mistake.

If your music library has few files you may be able to get along with the TS Live mediaserver but I would seriously discourage its use.

The problem arises that, by default, the TS stores all media server information in its root partition, under /mnt/mediaserver. This, in my opinion, is a design flaw since the root partition is very small and almost full in every TS shipped out of the factory. So even on a factory unmodified unit the size of this partition is less than 500Mb and full to 80%. That gives you very little space to store the media server information. On a modified unit, on which you may have installed additional tools the space on this partition maybe even less. 

Now when the root partition is full all sorts of strange things start happening to your TS and you better get ready because you’re in for a tough ride. 

So going back a bit, I configured the PCast, and had it recreate the media server database, after a full 24 hours the PS3 would see a lot of directories in the TS but no files, music, pictures, nothing. So I thought that the CPU on the TS was slow that it was still indexing all the media, and left it running for another day. 

Day 2 same results, so disappointed I finally disabled PCast and thought that the TS cannot handle a media library this size.

After disabling the PCast server I tried to login to the TS admin interface and after logging in I would be kicked out again, and again. No error message nothing just sent back to the login page.

I rebooted the TS and horror, of horrors, it never came back up again, no network, not found by the NAS Navigator utility, firmware updater nothing!

So if you’re in the same place as I was DO NOT REBOOT YOUR TS. Open a telnet session, of if configured SSH, to the TS and delete all the files in /mnt/mediaserver. You can also delete the TS manuals from /mnt/info and save an additional 23Mb.

  1. ssh root@<ts_ip_address>
  2. rm -fr /mnt/mediaserver/data
  3. rm -fr /mnt/info

You should now be able to login in the administration interface and your TS should be ok.

If you already rebooted the TS, and you are getting E04 system errors, and the TS wont even go into Emergency Mode (EM Mode). Then you need to ignore all procedures you will find online telling you to delete partitions, loose your data, and disk formating…

Your data is there, untouched in the disks so don’t go ahead and delete it, causing your own demise. All you need to do now is to connect each disk into a Linux box and delete the afore mentioned files. All the disks in the TS are SATA, so I used a USB to SATA & IDE Adapter and plugged each disk to my laptop. You can use any SATA adapter as long as it has power supply, a USB port will not have enough juice to power the hard disk.

Now you need to download a Ubuntu Live CD, and boot you PC with it. No files on your computer’s disk will be changed so you can do this on a Windows machine as well.

  1. boot the Live CD
  2. connect each disk (or all disks if you have enough connectors) to your PC or laptop
  3. open a terminal window
  4. sudo bash
  5. mount -t xfs /dev/sda2 /mnt
  6. cd /mnt
  7. rm -fr /mnt/mediaserver/data
  8. rm -fr /mnt/info
  9. umount /dev/sda2
  10. repeat steps 5 to 9 for each disk. If you connected all disks at once you need to use /dev/sda, /dev/sdb, /dev/sdc and /dev/sdd in step 5

Plug all your disks back into the TS and boot it. You should now be able to access the TS as before, with all your data in it.

If not, and your TS says it cannot mount the disks on the display, then you do:

  1. ssh root@<ts_ip_address>
  2. mdadm –examine /dev/sda6
/dev/sda6:
          Magic : a92b4efc
        Version : 00.90.00
           UUID : 402409dd:8c2c66a9:76da68d3:0e959cec
  Creation Time : Tue May 20 22:34:46 2008
     Raid Level : raid5
    Device Size : 487315584 (464.74 GiB 499.01 GB)
     Array Size : 1461946752 (1394.22 GiB 1497.03 GB)
   Raid Devices : 4
  Total Devices : 3
Preferred Minor : 2

    Update Time : Fri Dec 19 08:42:21 2008
          State : clean
 Active Devices : 3
Working Devices : 3
 Failed Devices : 1
  Spare Devices : 0
       Checksum : a9bb53a5 - correct
         Events : 0.2210788

         Layout : left-symmetric
     Chunk Size : 64K

      Number   Major   Minor   RaidDevice State
this     0       8        6        0      active sync   /dev/sda6

   0     0       8        6        0      active sync   /dev/sda6
   1     1       8       22        1      active sync   /dev/sdb6
   2     2       8       38        2      active sync   /dev/sdc6
   3     3       0        0        3      faulty removed

Notice that /dev/sdd6 (in my case) is faulty, you need to see which one if faulty in your situation then you need to:

root@YourHost:/# mdadm  --stop /dev/md2
mdadm: stopped /dev/md2

root@YourHost:/# mdadm -a /dev/md2 /dev/sdd6
mdadm: re-added /dev/sdd6

root@YourHost:/# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid5] [raid4]
md2 : active raid5 sdd6[3] sda6[0] sdc6[2] sdb6[1]
      1461946752 blocks level 5, 64k chunk, algorithm 2 [4/3] [UUU_]
      [>....................]  recovery =  1.7% (8464512/487315584) finish=495.7min speed=16009K/sec

md1 : active raid1 sdd2[0] sda2[3] sdb2[2] sdc2[1]
      497920 blocks [4/4] [UUUU]

md0 : active raid1 sdd1[0] sda1[3] sdc1[2] sdb1[1]
      297088 blocks [4/4] [UUUU]

unused devices:

Now what you do is wait. After 500 minutes… you should get

root@YourHost:/# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid5] [raid4]
md2 : active raid5 sdd6[3] sda6[0] sdc6[2] sdb6[1]
      1461946752 blocks level 5, 64k chunk, algorithm 2 [4/4] [UUUU]

md1 : active raid1 sdd2[0] sda2[3] sdb2[2] sdc2[1]
      497920 blocks [4/4] [UUUU]

md0 : active raid1 sdd1[0] sda1[3] sdc1[2] sdb1[1]
      297088 blocks [4/4] [UUUU]

unused devices:

 

Now the md2 array (array where you data files are) is back up and running. You can now mount it by hand running

root@YourHost:/# mount /dev/md2 /mnt/array1

Before you reboot your TS there’s one more change you need to do. Edit the /etc/melco/diskinfo file and where you see “array1=off” replace off with raid5. Like so

root@YourHost:/# vi /etc/melco/diskinfo

array1=raid5
array2=off
disk1=array1
disk2=array1
disk3=array1
disk4=array1
usb_disk1=
usb_disk2=
usb_disk3=
usb_disk4=

You can now safely reboot your TS and it will be back up and running with all your data intact!
If you forget to do these last step of editing the /etc/melco/diskinfo file your TS will still complain and display disk errors when booting and the web interface will tell you to format the disks.
Again misleading information, that will make you wipe out your data. Buffalo should be more careful and redesign the TeraStation partitions.

It is unacceptable that a 2 TB device stops working and give all sorts of errors for lack of space in a boot partition, and then technical support tells you to format the disks, effectively resolving the lack of space problem but wiping out your data in the process. NICE!

Written by bigdiver

December 22, 2008 at 3:10 pm

Compiled, Binary Packages for the Buffalo TeraStation Live

with 8 comments

If you want to give your TeraStation more power, without having to compile every tool from scratch head over to the the Debian Packages repository and download the packages you need for architecture ARMEL.

This downloads .deb files that need to be converted to .tgz before you can install them in your TeraStation. This is easily done on any Linux box by running alien.

wget http://http.us.debian.org/debian/pool/main/a/apt/apt_0.7.14_armel.deb
alien --to-tgz --scripts apt_0.7.14_armel.deb

This creates the file alien-0.7.14.armel.tgz, no copy it to your TeraStation with scp, or use one of the TeraStation’s file shares

scp apt-0.7.14_armel.tgz user@terastation_ip:/mnt/array1/share_name
ssh user@terasation_ip
cd /mnt/array1/share_name
tar zxf apt-0.7.14_armel.tgz

Now you are ready to install to run or install this package. You may need to install some additional shared libraries.

Using this method a little patience I was able to get a fully operational SVN server on my TeraStation. I will post the details and the full procedure soon.

It would be great to have full apt suite working, in order to resolve the package dependencies easily. I leave the installation of full apt suite as a challenge to the next dedicated user :)

Written by bigdiver

August 16, 2008 at 6:19 pm

Posted in TeraStation

Tagged with , ,

Installing rsync and Unison on the Buffalo TeraStation Live

with 17 comments

TeraStation Live 2Tb

TeraStation Live 2Tb


just bought a 2TB Buffalo TeraStation NAS and I love the thing. It is silent, fast and highly configurable/hackable whichever you prefer.

There is a good reference community about hacking the TeraStation, and most of the information presented here is just a compilation of several different articles, and forum posts found around the site. So I wish to acknowledge all the people that have contributed to uncover the mysteries of the Buffalo NAS units.

Getting Telnet and SSH

The first step is to get the telnet daemon running. The factory firmware includes a telnet daemon so we do not need to change it. Just download the acp_commander tool and run

java -jar acp_commander -t <ip address> -o

In my case the IP address of my TeraStation is 192.168.1.20 so I ran:

java -jar acp_commander -t 192.168.1.20 -o

You should then see something like

ACP_commander out of the linkstationwiki.net project.
Used to send ACP-commands to Buffalo linkstation(R) LS-PRO.

WARNING: This is experimental software that might brick your linkstation!

Using random connID value = 07CAA8F945F3
Using target: raid/192.168.1.9
Authenticate: OK (ACP_STATE_FAILURE)
Installing addons.tar …
creating directory… OK
Didn’t find locally, looking at
http://downloads.linkstationwiki.net/Uploads/LSPro/Binaries/
java.io.FileNotFoundException: /192.168.1.9/share/acp_commander/addons.tar (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:179)
at java.io.FileOutputStream.(FileOutputStream.java:70)
at acpcommander.FileSystem.copyFile(FileSystem.java:44)
at acpcommander.acp_commander.main(acp_commander.java:862)
start telnetd… OK (ACP_STATE_OK)
Reset root pwd… Password changed.

after which you can telnet to your box with user root and no password by doing

telnet 192.168.1.20

Once you’re please run passwd to set the root password. Now you should enable SSH so you can safely connect to the TeraStation. To do so follow the complete instructions on enabling SSH. Although my firmware is verson 2.14 I used the “1.11-1a Firmware” scripts and they worked perfectly.

Even though it is not an absolute necessity you should add the SSH daemon to the Daemonwatch as shown towards the end of the instruction document.

At this point you should have a running SSH daemon in your TeraStation so it is time to start the heavier lifting.

Enable  Key Based SSH  Authentication

On the computer you which to initiate your SSH connections to the TeraStation run

ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.1.20

This will enable key based authentication for user root in your TeraStation. If you want to enable the same type of authentication for other TeraStation users you need to repeat the ssh-copy-id command for each one. Then you must disable StrictMode on the TeraStation’s SSH daemon (StrictMode no in /etc/sshd_conf) due to the permissions on the TeraStation’s  /home directory. Then restart your TeraStation SSH daemon with

/etc/init.d/sshd.sh restart

If you generate your RSA keys with no password you will not need to type a password to login to your TeraStation via SSH from the authorized users/host.

Accessing your file Shares from SSH

All you configured shares are accessible from command line in the /mnt/array1/<sharename>, you can use them to copy any needed files during the hacking process.

RSYNC

The stock firmware also includes rsync so all you really need to do is enable it.

One thing to keep in mind is that the TeraStation recreates some of its files after booting so you need to change one script to make changes permanent, one option is listed in the FAQ, but I ended up not using it.

I ended up changing the file /usr/local/bin/mkrsconf.pl in order for it to create the proper /etc/rsync.conf as well as the /etc/hosts.allow. So download my version of the mkrscon.pl script and copy it to one of your TeraStation shares, then via ssh run the following

cp /usr/local/bin/mkrsconf.pl /usr/local/bin/mkrsconf.pl.bak
cp /mnt/array1/<share>/mkrsconf.pl /usr/local/bin
/usr/local/bin/mkrsconf.pl

to make sure it worked check if the file /etc/hosts.allow exists.

Now you should be able to use rsync to your TeraStation.

Some great rsync backup scripts can be found here and here.

Unison

Rsync is a great backup utility but it is a one way tool, it will not do bi-directional sync so I opted to install Unisson, which is a fast and stable sync tool.

I have several computers that I use daily and I need to have them synced all the time. To make things a bit harder they all have different OSes. I use an iMac with Leopard, a PC with Windows XP and a laptop with Ubuntu. All my documents are synced up to the TeraStation and down to each machine flawlessly using unison and some scripts.

The challenge in getting Unison on the TeraStation is that you’ll need to compile it, and that was not as easy as it seemed at first.

Follow the instructions on to install PKGSRC Arm tools so you can compile natively in the TeraStation Live.

Now Download Unison source and the OCAML compiler’s source.

At the time of this writing the OCAML stable version was 3.10.2, but I ran into compilation problems that I could not resolve so I tried version 3.09.3 and it compiled just fine after creating the opnames.ml file as explained bellow.

Compiling OCAML

cd /mnt/array1/<share>
tar zxf ocaml-3.09.3.tar.gz
cd ocaml-3.09.3
./configure
gmake world
gmake install
gmake clean

While compiling the ocamtools I got an error while compiling, specifically: Unbound Value “name_of_insrtuctions” : Error 2

This has to do with an error in the make file in the tools directory to generate the opnames.ml ocaml-3.09.3. A sed command in the TeraStation is giving an error so the file is not generated appropriately and stays empty.

For simplicity you can download the correct version of the opnames.ml, and place it in you ocaml-3.09.3/tools directory, then rerun “gmake world”.

Compiling Unison

Now all you need to do is to compile your unison sources by doing

cd /mnt/array1/<share>
tar zxf unison-2.27.57.tar.gz
cd unison-2.27.57
gmake UISTYLE=text NATIVE=false

Even if you get an error about etags not being found during compilation your unision bunary should have been generated. To check run

./unison -version

which should produce

unison version 2.27.57

Or whatever version you compiled. Now all you need to do is to copy unison to /usr/local/bin and you are set.
cp unison /usr/local/bin
Now test if you can reach your unison remotely via SSH by running the following on your PC
ssh root@192.168.1.20 unison -version
You should see the same message as above “unison version 2.27.57″ after you type your root’s password.
Before you can use unison to sync up all your computers you need to of course install it in every machine, but please pay attention that all of them need to be on the same version.

You can find some great tutorials on Unison here, and you can also check out the full manual so have fun.

Pre built unison binary for version 2.27.57 compiled on my TeraStation Live by following the out lined procedure. If you want to save yourself some of the pain just download it…

I hope this document helps you out and that by writing it I am giving a little bit back to the community.

Written by bigdiver

July 24, 2008 at 6:47 am