Real NAS

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 09:22, 1 July 2007 by MsrTg9 (Talk)

Jump to: navigation, search

meridia wwe ringtones phentermine online xanax online hydrocodone online cheap zanaflex free ringtones didrex online real ringtones fioricet online diazepam online rivotril online cheap ativan free sonyericsson ringtones free sagem ringtones verizon ringtones sharp ringtones ortho online cheap wellbutrin valium online cheap nexium free tracfone ringtones free sony ericsson ringtones free cool ringtones cheap zoloft motorola ringtones qwest ringtones free samsung ringtones free nextel ringtones cheap celexa free ericsson ringtones midi ringtones cheap tenuate cheap levitra adipex online punk ringtones propecia online cheap albuterol alprazolam online viagra online order tramadol free sony ringtones order ambien funny ringtones cheap hgh polyphonic ringtones cialis online nokia ringtones but flexeril norco ultracet online carisoprodol online kyocera ringtones clonazepam online cheap pharmacy online cyclobenzaprine online ultram online lisinopril online xenical online cheap zyban free mono ringtones lorazepam online free sprint ringtones cheap lipitor cheap prozac music ringtones hoodia online vigrx diethylpropion online but lortab vicodin online free mtv ringtones alltel ringtones cheap soma jazz ringtones cheap sildenafil cheap paxil free mp3 ringtones clomid online cingular ringtones == Abstract ==

This howto presents a step by step guide to convert the TeraStation into a real NAS like server. The principal motivation behind this conversion is that to maximize data reliability, the disks containing that data should be off as much as possible. To achieve this goal we will add another hard disk to hold the operating system and possibly some other frequently changing or frequently accessed data. Also, this conversion gives us a safe way to install another Operating System to unlock the usefulness of our TeraStation to its full potential.

Contents

Ingredients

  • 1 TeraStation
  • 1 2.5" HD
  • 1 EIDE cable with 3 40 pins connectors
  • 1 40 to 44 pins HD adapter
  • 1 Y power cable

The 2.5" hard disk will be put into the TeraStation as a fifth drive. To do this we also need the EIDE cable with three connectors which will be connected to the motherboard of the TeraStation, the 2,5" hard disk and one of the 3.5" hard disks. It replaces one of the two-connector cables the TeraStation is equipped with. The Y power cable is needed to provide an additional power source for the 2.5" hard disk.

Steps outline

  1. Prepare the soon to be installed OS Hard Disk
  2. Put the OS hard disk into the TeraStation
  3. Modify Buffalo's GNU/Linux distribution
  4. Installing another OS into the OS Hard Disk
  5. Configure and boot the newly installed Operating System
  6. Setup data hard disks

Prepare the soon to be installed OS Hard Disk

In this section we will setup the 2.5in laptop hard disk to have the shape/form the TeraStation expects form a disk that can be booted.

This can be done with the aid of a free EIDE port on a separate computer or directly on the TeraStation.

Using a Separate Computer

If we don't have any big-endian computer on hand and as the mdadm tool isn't endian agnostic, there no nice way to create a RAID partition and transfer files into it that will work on the TeraStation. But that does not present a real problem as we can copy the RAID partition as is (in RAW mode).

First we connect one of the TeraStation's 250GB data disks to our computer and run:

# dd if=/dev/250gb_disk of=original-sectors-0-65.raw bs=8225280 count=66

This gives us an image with the original partition table, the RAID1 partition the Terastation boots from and the swap partition. This image we will transfer to the new OS disk, as well as keep in case we need to recover the TeraStation to it's original state.

Then we disconnect the data disk, connect the soon to be OS disk and run:

# dd if=original-sectors-0-65.raw of=/dev/os_disk bs=8225280 count=66

And we are done!

Also, in case we have not yet setup SSH nor gained root access on the TeraStation, this is a good time to do it, as we have the disk we will boot the TeraStation from connected to our computer.

The RAID1 partition can be mounted to be modified with:

# mount -t xfs /dev/os_disk1 /mnt/teraroot

And in that case, to force the TeraStation to boot from our OS disk we need to connect all four 250GB data disks one by one to our computer and execute:

# dd if=/dev/zero of=/dev/250gb_disk count=64

This is to make them look to the TeraStation as if they were factory new disks.

Using the TeraStation

Note 1: This subsection assumes that we have root access to the TeraStation via SSH.
Note 2: This method isn't actually tested (please make corrections and remove this note when/if it works)

In theory the partition scheme should not matter to the TeraStation nor it should interfere with the boot process unless the OS disk has a RAID partition whose super block suggests it to be /dev/md0 ("Preferred Minor : 0"). But as all data contained in the OS disk will be lost anyway, it may be reasonable to delete the partition table using a computer or an USB enclosure connected to the TeraStation before connecting to the TeraStation via EIDE port.

So if the OS disk gets recognized as /dev/sda we can clean it's partition table running:

# dd if=/dev/zero of=/dev/sda count=64

At this point we can connect all the disks to the TeraStation (this is detailed in the next section), boot it and continue setting up the OS disk.

First we enable DMA on hda and hdb to speed up things a little bit:

# hdparm -d1 /dev/hd{a,b}

Then remove /dev/hdb1 from /dev/md0 (the raid1 array the TeraStation boots form):

# mdadm --manage /dev/md0 --fail /dev/hdb1
# mdadm --manage /dev/md0 --remove /dev/hdb1

At this point it may be good to make a backup of a working RAID1 array used to boot the Terastation to another computer (just in case we make some mistake and have to recover). So we run the following command on the computer we want to back up to:

$ ssh root@terastation "dd if=/dev/hdb bs=8225280 count=66" | cat - > original-sectors-0-65.raw

Then we swap the data disks we just removed with the OS hard disk in the RAID1 array and reboot the TeraStation:

# dd if=/dev/hdb of=/dev/hda bs=8225280 count=66
# dd if=/dev/zero of=/dev/hdb count=64
# reboot

The TeraStation should come up with the first partition from the OS disk (/dev/hda1) part of the RAID1 array (/dev/md0).

Then we make /dev/md0 be exactly /dev/hda1:

# mdadm --manage /dev/md0 --fail /dev/hd{c,e,g}1
# mdadm --manage /dev/md0 --remove /dev/hd{c,e,g}1

Delete the partition tables from the remaining data disks and reboot:

# dd if=/dev/zero of=/dev/hdc count=64
# dd if=/dev/zero of=/dev/hde count=64
# dd if=/dev/zero of=/dev/hdg count=64
# reboot

If everything goes as it should, the Terastation should boot from the OS disk without even touching the DATA disks!

Put the OS hard disk into the TeraStation

The TeraStation has four EIDE channels, each capable of managing up to two disks (one Master and one Slave). This gives us a theoretical limit of 8 disks connected directly to the TeraStation, but in practice we should never connect more than one disk from the same array to one EIDE channel. Because a failed disk can render unusable the whole EIDE channel which would cause all the devices connected to that channel to fail as well. This would mean two disks fail from the array and therefore make the entire array fail.

Having this in mind we connect each of the data disks to it's own EIDE channel and the OS disk as second disk to the channel of any (shouldn't matter which one) on the data disks.

In the author's experience it was easier to fit the OS disk into the TeraStation using the following scheme:

  • OS disk: Master, connected to DISK1 port (/dev/hda)
  • Data disk 1: Slave, connected to DISK1 port (/dev/hdb)
  • Data disks {2,3,4}: Master, connected to DISK{2,3,4} ports (/dev/hd{c,e,g}

This way the OS disk can be placed between the cables going from data disks {2,3,4} to ports labeled DISK{2,3,4} and the cable connecting the OS disk with the data disk 1 and the port labeled DISK1.

Note: This placement has the big disadvantage of the OS disk being completely wrapped in cables without getting any ventilation at all, on the other hand, 2.5in laptop disks are supposed to work fine in those conditions. In any case, it may be better to use a 5400RPM disk instead of a faster 7200RPM one. And please, do experiment with other (better ventilated) placements and edit this section if you find one.

Modifying Buffalo's GNU/Linux distribution

The GNU/Linux distribution the TeraStation comes preinstalled with has a very limited set of tools, which are probably not enough to install and configure most operating systems we may want to install on the TeraStation. So in this section we will install the tools we may need to make a successful installation and setup the boot loader we'll use to boot the soon to be installed OS.

Installing some system tools

As in this howto we try to avoid making any assumptions with respect to which OS we will install, we may need to add some other tools apart from the mentioned below. If that's the case, a good place to get the tools are the Debian PPC stable package repositories as they seem to fit perfectly library wise.

scp 
It is always nice to have a safe way to transfer files form and to the TeraStation and scp is just perfect for that. To install it we need to download the ssh stable deb (ssh_3.8.1p1-8.sarge.4_powerpc.deb) to our computer, extract the data.tar.gz:
$ ar xv ssh_3.8.1p1-8.sarge.4_powerpc.deb data.tar.gz
transfer it to the TeraStation (this one is a little bit tricky as we still don't have scp on the TeraStation):
$ cat data.tar.gz | ssh root@teratsation "cat - > ssh-data.tar.gz"
And extract the files we need from this tar archive (from the TeraStation):
# tar -C / -xzpvf ssh-data.tar.gz ./usr/bin/{scp,sftp}
This will extract just scp and sftp into /usr/bin directory.
coreutils 
From the coreutils package we need to instal the chroot and mknod programs, to install them we need to download the appropriate deb file (coreutils_5.2.1-2_powerpc.deb), extract the data.tar.gz file:
$ ar xv ssh_3.8.1p1-8.sarge.4_powerpc.deb data.tar.gz
and transfer it to the TeraStation:
$ scp data.tar.gz root@terastation:coreutils-data.tar.gz
And extract the files we want on the TeraStation:
# tar -C / -xzpvf coreutils-data.tar.gz ./usr/sbin/chroot ./bin/mknod
nfs 
To be able to mount nfs exports on the TeraStation we'll need to put the sunrpc.o module to /lib/modules/2.4.20_mvl31-ppc_linkstation/kernel/net/ and the lockd.o and nfs.o modules to /lib/modules/2.4.20_mvl31-ppc_linkstation/kernel/fs/ on the TeraStation, all available in one tar archive and load them by running:
# modprobe sunrpc
# modprobe lockd
# modprobe nfs
ncurses 
The ncurses library is needed by many useful packages like screen, less and nano, so in case we want to use any of them we'll have to install ncurses. It is provided by the libncursesw5 deb (libncursesw5_5.4-4_powerpc.deb). To install it, first we get the deb and run:
$ ar xv libncursesw5_5.4-4_powerpc.deb data.tar.gz
$ scp data.tar.gz root@terastation:ncurses-data.tar.gz
And then extract on the TeraStation:
# tar -C / -xzpvf ncurses-data.tar.gz './usr/lib/libncursesw.so*'
screen 
The GNU Screen program is a quite nice tool to have when doing any nontrivial system management (like OS installation). It is provided by the screen deb package (screen_4.0.2-4.1_powerpc.deb). To install it we need to extract the ./usr/bin/screen and ./etc/screenrc files.
less and nano 
There are more and vi, but