Latest working smartmontools for Buffalo Linkstation

Some point of the repository history of Buffalo linkstation optware, smartmontools got broken and no-one seemd to care enought to fix it properly for the repo.

The reason was gcc optimization bug.

Here is the instructions to fix it from scratch.

Prerequisites are Buffalo Linkstation e.g. LS-QVL like mine, install optware and gcc 4.2.3 for it from optware repo. Then follow this.

Download latest package from here with e.g. lynx directly to buffalo or transfer via other methods.

tar -xvf smartmontools-6.5.tar.gz
cd smartmontools-6.5

Edit Makefile and replace all -O2 optimization flags with -O0


Ok, so now you have working smartctl which you can run from your compile directory with e.g ./smartctl –all -d marvell /dev/sda and it will work. Just copy it e.g. over the non working 5.4 or so.

Hope this helps.

Setting up Buffalo Linkstation Pro Quad LS-QVL proper way

Buffalo Linkstation Pro Quad LS-QVL is remarkable little machine. I have purchased several of these devices and can safely recommend them to everyone. You don’t need to necessarily root them and you can use them as they are, but if you want to take most out of these boxes, then you’ll better do it proper way. This is the complete walk through for that, procedures on setting up Buffalo Linkstation.

Basic procedures on setting up Buffalo Linkstation

First of course follow the basic procedures, unpack, inspect, then plug it in mains and network as described in the Quick Setup Guide. Press the power button of the machine so that the blue led will start blinking and it will go through the disks (Green lights). Then from the disk provided, install NASNavigator2 (I had 2.56 version).


It should find your device and show it in the navigator e.g. LS-QVLE7C. It will pick up the IP from your DHCP server automatically, for me it gave FW Version it showed 1.65. Then I first changed my ip for static ip from properties and ip-settings in NASNavigator2. The default password is password. For me the Finnish version of NASNavigator2 shows like this.


After that you can invoke the web interface with admin and password. You can go go around the webui and look the settings, but I mainly went straight to

System – Maintenance – Firmware Installation page. It shows that you have the latest already, but then open up this page from Buffalo NAS-Central Forums to install Shonks pre modified version of the firmware.

From there it points you to pick up the proper firmware. You should be getting ls_series-165-mod1a.rar file which is about 230MB.

Flashing custom firmware to your LS-QVL

Then extract the package to your pc and start LSUpdater.exe. Pick the correct linkstation (if you have many) and click update. Mine was updating from 1.65-3.40 to 1.65-3.41.


Then it will inform that Linkstation has been rebooted. Please wait… And finally LinkStation has been updated. After that, log in to web console and System – Restore/Erase – Restore Factory defaults – Restore LinkStation.

buffalo4This procedure will remove your root password from the device.
In the process of doing this, you might end up back again on DHCP IP:s so then again do the NASNavigator2 IP Change procedure to change the ip back to what you want.

Then just telnet to your device (ssh won’t work) and log in as root with no password. Then use passwd to change proper secure root password.

Now you should be able to do things in the box (named Nas now)

root@Nas:~# passwd
Enter new UNIX password:
Retype new UNIX password:passwd: 
password updated successfully
root@Nas:~# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/md1               4920624    870908   3799760  19% /
udev                     10240       184     10056   2% /dev
/dev/ram1                15360       172     15188   1% /mnt/ram
/dev/md0                992440     30320    962120   3% /boot
/dev/md2             8742533120     34388 8742498732   0% /mnt/array1

So there you go, you have succesfully rooted your NAS.

This is now the basic setup and your device is rooted. You can also apply these same procedures for upgrading the custom firmware to newer. I will go more detailed on the customization in later posts.

Duplicity backups

Duplicity backups

I’m running Buffalo Linkstation as an home storage for some files. I have previously rooted (to be able to install my own apps) that and installed some opt packages. I also have service from ISP where I can store several Gigabytes of data e.g. for backup purposes.

Recently I finally completed the Duplicity backups,  here is how it basically went.

Prerequisites for me was:
– Linux server where you store your files to be backed up (I have Buffalo Linkstation)
– Remote place where you store (I have Kapsi ISP)

First install the duplicity

For me as I’m using rooted Buffalo Linkstation LS-QVL 8TB I’m using commands like

ipkg install py25-duplicity
ipkg install py25-boto
ipkg install py25-crypto
ipkg install py25-paramiko

I had to install quite many packages but paramiko is the one that I’m actually using (ssh, sftp). This process wasn’t that straight forward and first tries didn’t end up in success, thats why implementing this took so long.

Also prerequisites for duplicity there is librsync GnuPG NcFTP Boto and Python 2.4 or later. Those you will have to install also.

Then I created the following scripts to do the backup.
# duplicity full backup to kapsi

#Email address of recipient. Adjust to suit.
export Email=""

# timestamp for email
date=`date +"%d.%m.%Y %k:%M:%S"`

# Export the PASSPHRASE variable
export PASSPHRASE=Your_secret_password!
export TMPDIR=/opt/tmp/duplicity

# Get the date
repDate=`date "+%Y%m%d_%H%M%S"`

# Cleanup first (anything older than 60 days)
/opt/bin/duplicity-py2.5 remove-older-than 60D -v9 --force scp:// >>/var/log/fullbackup_$repDate.log

# Now do the backup
/opt/bin/duplicity-py2.5 full /mnt/array1/path --asynchronous-upload --volsize 100 --include-globbing-filelist=/mnt/array1/path/cfg/backupaccount.txt scp:// >>/var/log/fullbackup_$repDate.log

# Get the disk space
echo "Availble Disk Space on Server" >> >>/var/log/fullbackup_$repDate.log
echo >>/var/log/fullbackup_$repDate.log
/opt/bin/ssh -p22 quota -v -s >> >>/var/log/fullbackup_$repDate.log
/opt/bin/ssh -p22 du -h ///home/users/account/siilo/backup/duplicity >>/var/log/fullbackup_$repDate.log

# Mail me the results
cat /var/log/fullbackup_$repDate.log | nail -s "Backup Full [$date]" $Email

–volsize parameter changes the default 25MB filesize to 100MB and –asynchronous-upload starts sending the package immediately once it’s ready and packs the second package. This increases the temporary space needed but makes transfers faster.

I have similar script with incremental option to use in incremental backups.

00 4 1 * * /opt/local/bin/
00 4 2-31 * * /opt/local/bin/
- /mnt/array1/path/Dir4/misc
- /mnt/array1/path/Dir4/not_important
- /mnt/array1/path/trashbox
- **

On backupaccount.txt file I just say the directories under /mnt/array1/path what I want to be included and excluded. So the /mnt/array1/path/Dir4 gets copied but it excludes few directories. Also in the end there is to exclude trashbox and ** for rest from /mnt/array1/path.

This is basically how the things gets backed up.



– Crypted backups, so you can send them where ever you want without fear of getting your files to wrong hands
– Space and Bandwith efficient. Incrementals are really clever and fast to do even for big file repositories.
– Adaptivity, it supports many different protocols and file format is standard. You can probably have it running same way in the future services also.

I think for my purposes duplicity backups is really good way to do backups to remote location safely.

SSH Key handling on multiple servers environment

To have fluent access to securely walk through you servers, I have collected here some helpful instructions. I’m not going to go too detailed and the simplest things but some that I have found useful.

First of the tools, on linux and other unix machines and mac, I use the basic OpenSSH tools that there are, so ssh, scp, ssh-keygen and so on. On Windows I use putty family tools + some extra tools like Connection Managers.

So first create keys like one with passphrase and one without:

ssh-keygen -t rsa -b 4096

Then I rename them some way like adding userid on the name and ppk extension for the private file to make it easier to handle in Windows machines. I also modify the comment string to have something useful there.

On Windows you can use puttygen.exe for the same.

Then of course make sure your private key is only as few places as possible and in trusted places. I keep mine only on my trusted personal devices.

Then with the following command I copied the files to servers where I need them.

cat ~/.ssh/ | ssh "cat >> ~/.ssh/authorized_keys"

Now if you need to log on to many machines loops, you can do that with Agent forwarding. In ssh you can simply do this with -A switch, and in Putty you can enable that on the profiles with Connection – SSH – Auth – Allow agent forwarding.

After that you have on your favorite laptop or desktop private file once, and there you will use eg. in Windows pageant to load that key by giving password for authentication only once. Then you will have the agent program running and with those Agent forwarding enabled, you will get the authentication to all your machines.

There is some security considerations here to take in account so you should consider that also when doing this.


Raspberry Pi with BerryBoot and OpenELEC

I recently noticed that BerryBoot with OpenELEC makes really good combination on your Raspberry Pi and it is also really easy to setup.

Some time ago I purchased couple of RaspberryPi:s. I was waiting once they were comfortably running XBMC in 1080p resolution. I have had them on use with OpenELEC and RaspMC and recently liked OpenELEC a lot. I had to renew and do one installation from scratch.


First downloaded BerryBoot. Installation with that goes smoothly, just formatted 8GB SD card to fat and extracted the zip to sd-card. Then plugged in keyboard, mouse, rj45 network cable, hdmi to monitor + Nokia usb charger to feed power. Selected OpenELEC and then some configuring. I added following to config.txt



# Berryboot settings, do not change
initramfs berryboot.img

Once OpenELEC booted up, selected OpenELEC OS Settings and changed Keyboard layout to fi and Hostname to bit better and under Services – SSH – Start ssh server at boot. Then rebooted and after that you can log in as root with password: openelec.

Nowdays nano is bundled with OpenELEC so that you have there default.

Now logging in with ssh you can verify the speed change with cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq It should show 850MHz.

More detailed you can get with following command

for src in arm core h264 isp v3d uart pwm emmc pixel vec hdmi dpi ; do echo -e "$src:t$(vcgencmd measure_clock $src)" ; done
arm:    frequency(45)=850000000
core:   frequency(1)=399999000
h264:   frequency(28)=240000000
isp:    frequency(42)=240000000
v3d:    frequency(43)=0
uart:   frequency(22)=3000000
pwm:    frequency(25)=0
emmc:   frequency(47)=100000000
pixel:  frequency(29)=154000000
vec:    frequency(10)=0
hdmi:   frequency(9)=163683000
dpi:    frequency(4)=0

With vcgencmd measure_volts;vcgencmd measure_temp command you can determine the current voltage and chip temperature.

If you wanna really push more, you can try settings in config.txt like:


but try safely one thing at a time. And remember, if you loose your filesystem undetectable, that almost always is because of overclocking or bad power supply. You can find more info from RPI Config Overclocking options.

So basicly playing around with BerryBoot and OpenELEC is really easy. The only troublesome things are doing upgrades, as at least for now I haven’t been able to configure BerryBoot to do auto or even manual updates. Hope to get back on that later how to solve it.

Enabling MPEG2 and VC-1 decoding in Raspberry Pi XBMC

If you have tried to play on your Raspberry Pi XBMC mpeg2 content like DVB-T or DVB-T2 stored *.ts content, you might have noticed that only audio is played but not video. For this you will have to purchase licenses and install them.

You can start from Raspberry Pi Store. You will have to ssh to you Raspberry Pi and run following and pick the Serial.

root ~ # cat /proc/cpuinfo
Processor       : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 000e
Serial          : 0000000048421123
root ~ #

I’m doing this for several devices + also VC-1 codecs at the same time. Once you have all the serials needed, just add the serials to and purchase the licenses.
I didn’t found out other than paypal as payment. You will receive some email with instructions. Once you get the actual keys you just add following lines to config.txt. First one is for MPEG2 and second one for VC-1.


And that should be it.

Deleting partitions from SD card with Windows

If you play around with SD cards, eg. with Berryboot or similar for RaspberryPi, you might end up having many partitions in a SD card. If you need to use them in some other way, you might find it difficult to get rid of the partitons. You might be able to delete everything, but might also notice that some partions are hard to delete or remove.


You might end up showing like this but you can’t Delete Volume. There is an easy way to get rid of that though with the standard windows tools.

Invoke cmd prompt
# Run diskpart with admin rights
# type list disk to show the disk what you have (your sd must be detected and inserted)
DISKPART> list disk

Disk ### Status Size Free Dyn Gpt
——– ————- ——- ——- — —
Disk 0 Online 298 GB 0 B
Disk 1 Online 1920 MB 0 B

# you might see something different, but select the correct SD card disk as mine is Disk 1
DISKPART> select disk 1

Disk 1 is now the selected disk.

# then list partitions that you have, they might be more or different size, mine was this small berryboot partition
DISKPART> list partition

Partition ### Type Size Offset
————- —————- ——- ——-
Partition 1 Primary 70 MB 2048 KB

# then select the correct partition
DISKPART> select partition 1

Partition 1 is now the selected partition.

# and after that delete it
DISKPART> delete partition

DiskPart successfully deleted the selected partition.

# now you can exit from diskpart and see that the partition is deleted


That was the easyest way I could quickly figure how to get rid of those partitions, hopefully this helps someone.


Screen usage on linux and unix systems

Working on linux and unix systems you every now and then need to leave something running overnight or so. Screen is the tool for this.

Basic usage of screen is easy but there is though few tricks you might need after initial start.

If you use screen after you have done eg. sudo su – commonappsuser you might end up nasty Cannot open your terminal ‘/dev/pts/nn’ – please check type of errors. What you would do here is to run script /dev/null and after that you can use eg. screen -rD to detach that previous session.

If you got after screen -rD There are several suitable screens on: message, you can use just that Deteached string after the -rD to connect to right session.

While you are in screen you might need following basic ctrl key combinations to go around.

C-a C-c     (screen)      Create a new window with a shell and switch to that window.
C-a C-a     (other)       Toggle to the window displayed previously.
C-a C-n     (next)        Switch to the next window.
C-a C-p     (prev)        Switch to the previous window (opposite of C-a n).
C-a "       (windowlist -b) Present a list of all windows for selection.
C-a A       (title)       Allow the user to enter a name for the current window.
C-a C-d     (detach)      Detach screen from this terminal. (exit)
C-a S       (split)       Split the current region into two new ones.
C-a tab     (focus)       Switch the input focus to the next region.

There are a lot more commands, just read those + basic stuff from man screen.