[Review] Western Digital WD Labs PiDrive 314GB

Today, I want to do my first review on this blog, concerning the Western Digital / WD Labs PiDrive 314GB. I received this nice little drive from the guys over at PiAndMore as a gift for my three presentations at the PiAndMore 9 (among other loot ;)). So, what is this PiDrive and what is so special about it? Well it is in fact a small 2.5 HDD with integrated Sata to USB 3.0 Controller (with the matching "two-piece" connector). It was specially designed by WD to work with the Raspberry Pi Series and gives the RPi 314 GB of space (hence the name PiDrive - however, there is an 1 TB Version available as well).

So what did I get?

pidrive1

The PiDrive itself, a USB Micro to USB A Connector cable, as well as a power brick. Unfortunately, the power brick turned out to be a UK Version, not a German one, so I needed to get an adapter for that. The Brick itself was a beefy (2A@5V) supply, probably meant to power the RPi and PiDrive at the same time.

pidrive2

I loved the "Pi" finish at the package.

pidrive3

The package itself included the PiDrive (wrapped in a antistatic bag, already removed here ;)) and an business card with some tips on "getting started"

pidrive4

The Drive itself - small, lightweight and quite nice to look at.

Ok, after unpacking, I did some "Google Research" as I normally do when it comes to Harddisks and SSDs. A bunch of people (mostly with 1 TB Versions) already explained they were having problems with the Firmware of the Drive and that there already were an update available. So to not get into problems myself, I turned to WDs Support Website (http://support.wdc.com/downloads.aspx?lang=en) and downloaded the "WD Universal Firmware Updater for Windows". I plugged the included USB Micro Cable into the PiDrive and connected it to my Laptop and saw that this Drive also got an *REALLY BRIGHT* white LED as Status Indicator. However, the LED was blinking on/off continuously and I decided that the Drive probably did not got enough juice from the one USB Port. So I combined an old 2.5 HDD cable (USB A to 2x USB A Y Cable) with an USB Micro OTG Cable, so that I got 2x USB A connectors on the one side (which plugged into my Laptop) and the USB Micro connector on the other side, which connected to the PiDrive. Now I got an steady white lit LED - and I could find the Drive in the Device Manager. After I fired up the Firmware Updater, I directly got the info about a new firmware [1.0.12] and got the drive flashed. Everything went fine :).

So, from that point on, I wanted to use the Drive with one of my Raspberry Pis. As I still got some old RPi Model B, v2.0, I tried to give it a try - but it did not work. The LED was just flashing again, and it seems like I would need an active USB Hub or my special cable to get it working [it did also not show up in dmesg or blkid]. Then I realized, that I already had seen a special connector cable from WD (this one: http://wdlabs.wd.com/products/raspberry-pi-accessories/#pidrive_cable) which had sadly not been sent to me. This cable does directly plug into the power brick and does power up the RPi as well as the PiDrive, so that the RPi did not need to supply about 1 A via the USB port to the PiDrive. Bummer.

Next thing I saw, was the max_usb_current=1 which had to be added to the /boot/config.txt on the RPi card. This - however, does only work from RPi+ Modells on onwards (so RPi A+/B+, RPi 2 B) and should not be needed on the RPi 3, as this is already "on by default". Why does this only works on that versions? They got an little Mosfet included there to GPIO 38 which does activate a kind of "high power mode" for the USB controller. So to see wheter your little modification did work, just try gpio -g read 38 and 1 will tell you, that it worked. An lsusb -v 2>/dev/null | grep -e 'MaxPower' -e 'Bus [0-9]' will also tell you, how much power every device on the RPi draws (Thanks to https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=105502&start=25).

So, after I saw that my RPi 3 got its max_usb_current enabled, I rebooted it with the PiDrive attached to the included USB cable. However, the Drive LED did also blink like on the RPi B v2.0, which was really strange. And it did also not show up in the blkid nor in dmesg. So I did unconnect the PiDrive and used an TeckNet 0.3m USB Micro USB cable - and voilá - it worked right out of the box! With sudo blkid I could see my connected drive and did find out that it already had been mounted to /media/USERNAME/WD_PiDrive_314GB.

So, I did not yet do any speed tests and stuff, but I am pretty happy with this little drive. I am really looking forward to play with it a little bit more. Is it worth the price? Probably. I really like WD drives, I make really good use of WD Blues in my Desktops, WD Greens in some Backup Systems and WD Reds in my NAS/Small Servers. I never had any problems with WD Drives and so I am looking forward to a "nice smooth ride" with this HDD (hopefully ;)) as well.

Thanks a lot for Western Digital to giving these PiDrives out :)!

More infos about i.e. the Berry Boot can be found here: http://wdlabs.wd.com/Support/#berryboot / http://www.berryterminal.com/doku.php/berryboot, as well as some nice step-by-step setup in there forums: https://community.wd.com/t/how-to-install-raspbian-on-pidrive-using-windows-pc-step-by-step/134723

[Ubuntu] Freeradius: Improve Uptime

As a network admin, you're going to have at least one Freeradius running, mostly for 802.1x authentication. At my place the problem arised, that the service was down too often - for different reasons.

1.) Logrotate
If you're using logrotate, you should check out /etc/logrotate.d/freeradius:

/var/log/freeradius/*.log {
weekly
rotate 52
compress
delaycompress
notifempty
missingok
postrotate
invoke-rc.d freeradius reload >/dev/null 2>&1 || true
endscript
}

Logrotate does restart freeradius after it swapped the logs with reload, which often results in a crash or race condition (freeradius does not shutdown fast enough, and the restarting process thinks it already got one running process - and both terminate). So to change that, you should stop the process, wait, and start again.

/var/log/freeradius/*.log {
weekly
rotate 52
compress
delaycompress
notifempty
missingok
postrotate
invoke-rc.d freeradius stop >/dev/null 2>&1 || true
sleep 5
invoke-rc.d freeradius start >/dev/null 2>&1 || true
endscript
}

2.) Monit
monit is an monitoring programm which checks wheter a service is still running.
Install via: sudo apt-get install monit
Configure:

vi /etc/monit/conf.d/freeradius

check process freeradius with pidfile "/var/run/freeradius/freeradius.pid"
start program "/etc/init.d/freeradius start"
stop program "/etc/init.d/freeradius stop"
if failed host 127.0.0.1 port 1812 type udp protocol radius secret RADIUSSECRET then alert
if failed host 127.0.0.1 port 1813 type udp protocol radius secret RADIUSSECRET then alert
if 5 restarts within 5 cycles then timeout

sudo service monit restart

You should change the RADIUSSECRET to the one of your freeradius.

[Ubuntu] Letsencrypt with Apache and Freeradius

This little tutorial describes how to use Letsencrypt with Apache, Freeradius and Auto-Renewal of the Certificates.

#Install Letsencrypt
sudo apt-get update
sudo apt-get install git
cd /opt
sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
cd /opt/letsencrypt

#Become root
sudo su

#"Order" certificates (replace SERVERDOMAIN.COM with the DNS of your Server!)
./letsencrypt-auto --apache -d SERVERDOMAIN.COM --rsa-key-size 4096
Enter Contact Mail: mail@SERVERDOMAIN.COM
Configuration Type: Secure #is best, as it does redirect insecure http to https)

#Read PATH variable
echo $PATH

#Cronjob for certificate renewal
#you should under all circumstances replace the string following PATH= with your own, as read with the command above.
#Seperate with ; from the rest of the command like shown in the example
crontab -e

#letsencrypt
30 2 * * 1 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games;/opt/letsencrypt/letsencrypt-auto renew >> /var/log/le-renew.log
35 2 * * 1 /etc/init.d/freeradius restart
35 2 * * 1 /etc/init.d/apache2 restart

#Configure Freeradius
cp -r /etc/freeradius/certs/ /etc/freeradius/certs_bkp
rm /etc/freeradius/certs/*.pem
cp /etc/freeradius/eap.conf /etc/freeradius/eap.conf_bkp

vi /etc/freeradius/eap.conf

#certdir = ${confdir}/certs
#cadir = ${confdir}/certs
certdir = /etc/letsencrypt/live/SERVERDOMAIN.COM
cadir = /etc/letsencrypt/live/SERVERDOMAIN.COM
#dh_file = ${certdir}/dh
dh_file = ${confdir}/certs/dh
#private_key_password = whatever
private_key_file = ${certdir}/privkey.pem
certificate_file = ${certdir}/cert.pem
CA_file = ${cadir}/fullchain.pem

#Configure access rights on /etc/letsencrypt
cd /etc/letsencrypt/
chgrp -R ssl-cert archive csr keys live options-ssl-apache.conf renewal # set group of cert/key dirs to ssl-cert
find . -type d -exec chmod g+xs {} \; # directories executable and setguid (set group ssl-cert for new files/dirs)
find . -type f -exec chmod g+r {} \; # files readable

#Restart Freeradius
service freeradius stop
service freeradius start

Additional infos: https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-14-04

[Docker] Keep Docker Container up-to-date with Watchtower

If you're using Docker, you know you will need to update these containers from time to time by hand. Mostly with an docker pull repo/DockerContainerName and an docker-compose up -d. If you want to automate this, you can now use Watchtower: https://github.com/CenturyLinkLabs/watchtower

Using it, is very easy. Just run following command to let all your containers automatically update via watchtower:

docker run -d \
--name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \
centurylink/watchtower

If you want choosen containers to be updated, include the names of the running containers as arguments, i.e.:


docker run -d \
--name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \
centurylink/watchtower gogs_gogs_1 drone_drone_1

This Info was brought to you by Christopher Perrin @ https://blog.screebo.net/ ;).

[Ubuntu] Networked UPS with apcupsd, APC 750 and Windows

Due to some serious power outages, I had to install an UPS at the Office of one client. It is an rather small setup: One low-power Ubuntu Server, one Laptop with one TFT Screen, one i3 Desktop with two TFT Screens, one network switch. All in all, about 400VA. I had an old APC Smart UPS 750 VA at hand and used it.
Idea was to connect the UPS via USB directly to the Server and hook Laptop and Desktop to that Server via Network. As soon as the Server found that the whole Powergrid went offline, all pcs should shutdown automatically: Enter apcupsd.

Power installation:
Connect the UPS input to the power grid, connect the UPS out to your PCs. NEVER CONNECT ANY LASER PRINTER TO THAT OUTPUT!
Power up the UPS.

Server installation:
Connect the UPS USB Port to the Server.
Install apcupsd:
sudo apt-get install apcupsd
Configure apcupsd:
sudo vi /etc/apcupsd/apcupsd.conf
In my case I configured that settings:

UPSNAME blaUPS # How you want to name your ups
UPSCABLE smart # in my case, it is a smart cable
UPSTYPE usb # on usb
POLLTIME 60 # poll ups every 60 seconds
ONBATTERYDELAY 10 # delay alarm for 10 seconds
BATTERYLEVEL 10 # on less than 10 percent battery level shutdown server
MINUTES 3 # on less than 3 minutes battery runtime shutdown server
NETSERVER on # activate network server
NISIP 0.0.0.0 # allow access from all nics
NISPORT 3551 # default port for network server

Allow port 3551, tcp through iptables!

Restart apcupsd:
sudo service apcupsd restart

Give status of current apcupsd session:
sudo service apcupsd status

Client installation on Windows:
Download latest version for Windows (i.e. winapcupsd-3.14.13.exe), you only need apcupsd Service and Tray Applet.
Leave everything on default on setup and configure apcupsd.conf

UPSNAME blaUPS # How you want to name your ups
UPSCABLE ether # network to server
UPSTYPE net # on network
DEVICE IP:3551 # for IP, enter the IP of the server
POLLTIME 15 # poll ups every 15 seconds
ONBATTERYDELAY 10 # delay alarm for 10 seconds
BATTERYLEVEL 20 # on less than 20 percent battery level shutdown client
MINUTES 3 # on less than 3 minutes battery runtime shutdown client
NETSERVER on # activate network server
NISIP 127.0.0.1 # allow access only from localhost

And thats it 🙂

[Art] real-time operator

real-time operator was an project of Melanie Windl, an artist from the University of Mainz, Germany on which I helped as technical advisor and programmer. The idea of the project was to live-record sounds from the staircase of the Tokyo Wondersite and replay them using different filters on multiple ballons (using exciters). The project was realised using three Raspberry Pi, Modell B+, some USB Soundcards and PureData. You can find more about the project here: https://atelier-windl.com/portfolio/real-time-operator-2/

Festival / Festival
real-time operator
09.01.-07.02.2016
Tokyo Wonder Site Hongo
2-4 16 Hongo, Bunkyo-ku, Tokyo 113-0033, Japan

real_02

A short video showing the project can be found here