AE EP#38 Qnap TS-212 NAS Teardown & Debian Installation

Hrhr christmas was early this year and I got myself some little Network attached storage (NAS). It is a qnap TS-212, so it has 2 disk-bays and I paid about 160 € on amazon. (The 1-bay version is here).
For disks I chose 2 Western Digital WD20EURS 2 TB interne Festplatte (6,5 cm (3,5 Zoll), 5400rpm, 64MB Cache, SATA) for their low power consumption and reduced noise level.
Enjoy the teardown:

Again, sorry guys, there will be no more parts to this video. I actually recorded ~4 hours of video. 4 very LONG, BORING hours. Instead i write these things down. For the first part I mostly followed this instruction. Thank you Martin Michlmayr! (I’ll have ha copy if his page ever goes down;)

All right? Lets go! Once you backed up the Flash partition and wgetet (lol) you can ssh into the device.
ssh installer@
Password is install

This would be the assigned IP-address after you booted up with disconnected network (or with no DHCP server present in your network). You can also use the DHCP page of your router to get its assigned IP of course.
Expert mode crashed on my try, so I started standard installation.
I set up the two 2TB hard drives partly as raid 1, partly as plain disk (no JBOD or any fancy stuff like that ;). My original plan failed due to the installer not recognizing my usb drives space (showed only 256 MB instead of 1GB Bug?) so I went and gave the system some raid1 on the hard drive.

the disk setup looks like this:

>>partition 1: 20 GB space reserved for raid /dev/sda1
>>partition 1: 500 GB space reserved for raid /dev/sda2
>>partition 1: 1,5 TB space ext4 /dev/sda3

>>partition 1: 20 GB space reserved for raid /dev/sdb1
>>partition 1: 500 GB space reserved for raid /dev/sdb2
>>partition 1: 1,5 TB space ext4 /dev/sdb3

After running Debian’s raid setup (inside the installer it looks somewhat like this:

>>partition 1: 20 GB space reserved for raid /dev/sda1
>>partition 1: 500 GB space reserved for raid /dev/sda2
>>partition 1: 1,5 TB space ext4 /dev/sda3

>>partition 1: 20 GB space reserved for raid /dev/sdb1
>>partition 1: 500 GB space reserved for raid /dev/sdb2
>>partition 1: 1,5 TB space ext4 /dev/sdb3

20GB raid1 /dev/sda1 and dev/sdb1
no spares and 2 drives

500GB raid1 /dev/sda2 and dev/sdb2
no spares and 2 drives

After that installation should be smooth, just be sure to select ssh server when the package selection comes up.

Now let’s generate us some rsa key for passwordless log-in. on your pc type:

# ssh-keygen -t rsa

you can choose if you safe them into your ~/.ssh/id_rsa or somewhere else. I chose to put it in a folder named qnap-TS-212 (everything concerning this device goes there).
We get two files keyname and
Use scp to get the pub file to your server (erebus will be my NAS’ Name):

# scp root@
# mv erebus erebus.key #just to make things clear ;)

You will need your root password from Debian setup. This will put the pub key to root’s home on the server.
Ssh into the NAS:

# ssh root@

# cd /root
# mkdir .ssh
# mv erebus.key .ssh/authorized_keys
# chmod 700 .ssh
# chmod 600 .ssh/authorized_keys

Now log out…
…and back in:

# ssh root@ -i erebus.key

Nice, now lets set up the hostname and network:

# nano etc/hostname and change to name of your desire (strg-x to quit y to save)
# nano etc/hosts
# #mine looks like this: localhost erebus erebus #that domain stuff broke the workings with windows xp :DD

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

I’m changing the network to static now coz’ the installer crashed on doing it in it.
To get networking to static Lets change /etc/network/interfaces to something like this:
WARNING YOU CAN LOCK YOURSELF OUT HERE!! visit for recovery information!

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static

The easy way is to reboot you can also type (in one line!):

ifdown eth0 && ifup eth0

You can add $NASNAME to your /etc/hosts file to replace the IP on connecting: erebus
Now let’s set us up some encrypted folder on the /dev/md1 partition:

# useradd claudio
# useradd isabell
# useradd guest
# passwd claudio
# passwd isabell
# passwd guest

# mount /dev/md1 /mnt
# apt-get install ecryptfs
# mkdir -m 700 /mnt/.secure #actual encrypted file system
# mkdir -m 500 /mnt/secure #mount folder, unwriteable when ecfs not mounted
# chown claudio:claudio /mnt/.secure && # chown claudio:claudio /mnt/secure

# mount -t ecryptfs /mnt/.secure /mnt/secure

Before we add the share lets get us a swap-file. Type this on /
dd if=/dev/zero of=swap bs=1M count=512
This will prompt you some questions, write down what you answered, we will ned that in the next step:
Edit /etc/fstab to the following example:

# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# proc /proc proc defaults 0 0
# / was on /dev/md0 during installation
UUID=b729436e-426a-476f-9d0a-ee10a5c6164b / ext4 errors=remount-ro 0 1

/dev/md1 /srv/md1 ext4 errors=remount-ro 0 1
/dev/sda3 /srv/S1 ext4 errors=remount-ro 0 1
/dev/sdb3 /srv/S2 ext4 errors=remount-ro 0 1

/srv/md1/.secure /srv/md1/secure ecryptfs noauto,users,ecryptfs_sig=1f5d64d72507df5f,ecryptfs_cipher=aes,ecryptfs_key_bytes=32,ecrypfs_unlink_sigs 0 0

/swap swap swap defaults 0 0

This adds all partitions and a swap file on next boot or if you type mount -a.
Finally it’s time to get the samba server going (I really don’t like it, it seems to always break somehow 🙁 but you gotta use what we have…):

apt-get install samba
smbpasswd claudio
smbpasswd isabell
smbpasswd guest

Since there are about 1000 better or worse samba how-to’s out there I’ll just post my configuration, test changes with testparam.

workgroup = STRANGENET
server string = %h server
map to guest = Bad User
obey pam restrictions = Yes
guest account = guest
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Entersnews*spassword:* %nn *Retypesnews*spassword:* %nn *passwordsupdatedssuccessfully* .
unix password sync = Yes
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
smb ports = 139 455
dns proxy = No
panic action = /usr/share/samba/panic-action %d
valid users = %S
create mask = 0700
directory mask = 0700

comment = All Printers
path = /var/spool/samba
printable = Yes
browseable = No

comment = Printer Drivers
path = /var/lib/samba/printers

path = /srv/md1/secure
valid users = claudio
read only = No

path = /srv/md1/important
valid users = claudio
read only = No

path = /srv/S1/claudio
valid users = claudio
read only = No

path = /srv/S1/isabell
valid users = isabell
read only = No

path = /srv/S1/guest
valid users = isabell, claudio, guest
read only = No

path = /srv/S2/AE
valid users = claudio
read only = No

path = /srv/S2/Media
valid users = isabell, claudio
read only = No

At last run:
/etc/init.d/samba restart
Okay thats it! Sorry, there is no part 2 or 3 video. My footage just sucked too hard.
your AE

Luxury Junk

I just couldn’t resist bidding on some ebay deal where a guy sold his cellar of HIFI-electronics.
There was /much/ more than shown here. This are the parts, I probably gonna use in some way.

JVC GR-SX9 Video Camera

Some very old (1991) Camcorder, I gotta look into connecting it do the pc to finally get some descent webcam input.

AIWA AD1250 Stereo Cassette Deck

This is some very solid case, it will probably house a synth or a mixer in the future.

Blaupunkt 60W 3 Ohm Car Speakers

Just that, they’ll go into a boom-box.

Premier CB 2000 Citizen Broadcast Radio

This one is interesting because i want to get a ham license in the near future. It does not work atm but I’m on it. the amp on top is known as a “Brenner” (afterburner) or “Oma” (grandmother) here in austria. using such an HF-amp with CB is strictly forbidden. (4W only, 12W with SSB)

Hornyphon 6391 Stereo Amplifier, front face

Hornyphon 6391 Stereo Amplifier, inside

Yeah this one needs some serious cleaning and testing but it could very well become a good mate in the future.

AE EP#27 Gameboy Crystal Hack

robot797 asked me to play around with the clocks of gaming consoles and I liked that idea. So I think fiddeling with an N64 in that way could work but I settled with a classic Nintendo Gameboy. Turns out, that ye olde Z80 doesn’t mind the dodgy clock at all.All I needed was a rotary switch and some quartzes (2, 3.3, 4,19(original) MHz).

AE EP#26 The Ultimate Breadboard

While I was working on my Oscilloscope project I discovered, that breadboards are only semi-useful for Bigger things. Everything seems not to add to your project but to just pile up on it. After you added some probes and things that need a bus you will sit on a fragile, unforgiving crapstack, that just waits for you to stick a jumper-wire in the wrong hole. So I decided to make myself some room on the board and push connectors, displays and meters away from the center. Just take a look what came out:
Breadboard in a pic

check out the vid to get a walkthrough

So here is a little list what it includes:

* 2 max 232 Level converters
* An arduino NG
* 3 BNC connectors
* 8 banana Plugs
* A 50 V voltmeter
* Tiny tiny breadboard for displays and button stuff
* 4×7-segment display with driving transistors
* Datavision DV-20208 HD44780 compatible LC-display
* 2x lm3914 bar-graph displays with jumper selectable voltage range
* Avr-Net-IO for some Ethernet
* A -10V -5V GND +5V +10V earth 0V 35V Power supply
* and of course a humongous breadboarding area

This is of course just a source of ideas so if you make one of your own please let me know and if you don’t publish yourself, I’d be delighted to show off pictures of yours here!

Some words on construction:
The base is made from a piece of structured plastic (45 x 30 cm) on top of that are some pieces of wood with some plastic veneer that form the body. This makes up the wedge form in the back. On top once again I used some sign plastic covered with red spraypaint, why red? because its shiny 🙂
Ground and Earth are normally separated and can be connected on demand.

List of inspiration and components the Voltmeter was in this pack: Einbau-Meßgeräte-Sortiment 10 verschiedene, Volt- und Ampermeter und Hz-Messer

Here is a little zipfile containing the PSU-design and the VU-meter: PSU_LM3914

PS.: the space above the tiny breadboard is reserved for some raspberry-pi…