Wednesday, 2 July 2014

Tuesday, 24 June 2014

LG G2 D802 (International) - Using 4G/LTE on the 3 (Three) network

I bought an LG G2 D802 (32Gb). This model is described as an International variant that works in any geography. So bought one from ebay given the price was so low. I even ordered a new sim card from 3 as I needed a micro sim. The phone arrived and was easily configured to work in the UK. All was good. It was only when I headed in to London the next day that I realised I was not getting a 4G (LTE) signal.

Turns out there are multiple variants of the D802 and I had the D80220A-AME-XX variant. Basically, it seems the hardware for the D802 device is all the same but the AME seems to be a Middle East variant of the ROM. When you try and do a software update from the phone or using LG's software on a PC, it'll only ever install the middle east variant. From what I understand, it's the IMEI that LG use to determine the software. No matter what I did I couldn't get a 4G connection unless I did this hack which doesn't survive a reboot.

http://forum.xda-developers.com/showthread.php?t=2494751

After some surfing on XDA-Developers it looked like I needed to flash the EUR (europe) ROM variant. I was in two minds about returning the device and buying from the UK. But the hassle of doing a return back to Hong Kong on ebay wasn't enticing. So I flashed the EUR variant. It's a bit of a hassle as you have to trick the LG software in to doing this. I followed the instructions here and am now running D80220b-EUR-XX. Immediately I'm able to connnect to 4G with no issues at all. In all other respects the phone behaves the same.


http://www.droidviews.com/how-to-restore-lg-g2-to-stock-firmware/

I used "LG G2 D802 V20D (Europe Open) KitKat Firmware"

After reading some more it seems my problem might be an issue with 3 (Three) in that the carriers have to explicitly allow phone models to connect to 4G and the  D80220A-AME-XX is not on their white-list. Other owners on other carriers don't seem to have the problem. And I assume many users don't even realise there are different software ROMs for the D802. Why LG even bothered to do multiple versions escapes me.

Anyhow - I hope ths helps those with a similar issue.


Friday, 18 April 2014

HP Proliant Microserver - The Ubuntu Solution


Using a HP Proliant Microserver as an Ubuntu file server with RAID5 … for free

 

I originally wrote a forum post in 2011 on my efforts to create a RAID capable file server for my media centre set up. I’ve now written this blog post so it can more easily be referenced. The HP Microserver is a wonderful little machine, and often being sold with £100 cashback. 
In short my requirements were
  • A small but large capacity file server.
  • Remote admin access as the server would sit “headless” behind the TV.
  • RAID5 capability to give some fault tolerance to the file system.
  • Wanted it to be accessible to my home network where most machines run Windows
  • I didn’t need the server to have graphics/video capability as I would be using another device to run XBMC.
  • Fast and reliable streaming of files from the server to my XBMC media player – actually Openelec.
The HP Microserver fits the bill perfectly. What I was surprised about though were the number of people posting on forums that felt the need to run Windows Server, install more memory, or use expensive RAID cards. Surely something like Ubuntu would do everything I needed without having to spend more money on software and hardware. Well the answer was a resounding “yes”. Read on to see what I did. 
Firstly I’m no Linux expert so much of what I did was researched with a tiny bit of trial and error. 

My bill of materials was
  • x1 HP Microserver N36L with 1GB memory and a 250GB hard drive pre-installed. 
  • x1 HD bracket so I could mount the 250GB HD in the 5.25inch top bay.
  • X1 IDE to SATA power cable to convert the power so I could plug in the 250GB drive in the top bay.
  • x4 Seagate 2TB HDs

Basic hardware set up


It’s a simple process to move the 250GB drive from one of the caddies to the top bay using the brackets and the power cable. This meant I could then install each of the 2TB drives in the caddies.

Installing Ubuntu and Webmin 


1) Firstly, remove the x4 2TB hard drives to avoid confusing things whilst installing Ubuntu. At the time of writing these instructions I used Ubuntu Server x64 10.04.02 LTS (Long term support). Once you’ve downloaded the iso file you can use something like “Universal USB Installer” to create a USB stick. I chose the LTS version because I wanted stability and once up and running I didn’t want to mess around have to upgrade versions. 

2) Use the USB stick to boot the Microserver and install Ubuntu on the machine. It’s all very easy to set up the installation. But make sure you select Samba and OpenSSH packages on this screen.


These two packages will let you access the server files shares from Windows and to “telnet” in to a command prompt from another machine. This will mean you can run the server headless (ie, without needing a keyboard or monitor).

When it comes to installing the grub bootloader, make sure you specify the HD disk device (/dev/sdb) and not the USB stick (/dev/sda) otherwise it won't boot when you remove the USB stick.

3) On the next boot this should get you to a text based login prompt. But if you’ve installed OpenSSH you should be able to access the server from another machine on the network. I use putty from a windows machine to manage the server from a command line. 

4) Next thing I did was install webmin so I could administer the server through web pages. For me - as a newbie - this is a bit easier than using the command line all the time. Use the Debian package for Ubuntu. This page explains the process

http://www.webmin.com/deb.html


Once webmin is installed you can then administer the server remotely from the following address

It will look like this. 




Have a look around. You can do most things from the web interface and there is little need to resort to the command line once the server is set up. Note how light weight Ubuntu server is. It will run comfortably in 1GB of ram.

Setting up the RAID array


You now need to set up your preferred file system software. After lots of googling it came down to using XFS or ZFS for me. I chose XFS in the end. There doesn't seem to be much in it. But it looked like ZFS had a higher memory footprint.

1) Firstly, install the RAID tools. This is the software that lets Ubuntu and most linux systems to run software based RAID. I wanted software RAID as it is widely supported on linux systems and I’m not locked in to some piece of hardware that could go end of life.


sudo apt-get install mdadm

2) Then install the SMART monitoring tools for HDs. Once installed you can “refresh modules" in webmin and you’ll see a new option under the “Hardware” menu that lets you review SMART status for each hard drive.

sudo apt-get install smartmontools

3) Install the file system tools. As I said above I chose to use XFS
sudo apt-get install xfsprogs

4) Then shutdown the server and plug in the x4 hard drives. Then restart and log back in.

5) At this point, do some backgroud reading on RAID arrays and the use of mdadm. I found this page particularly useful


http://blog.mbentley.net/2010/11/creating-a-raid-5-array-in-linux-with-mdadm/

6) Use webmin to create the array (/dev/md0) using the Linux RAID module (under the "Hardware" menu). You need to select "Redundant (RAID5)" from the drop down and then click the "Create RAID device of level:" button.


It takes a while to build the array. You can use this command to watch progress
sudo watch cat /proc/mdstat

7)  Then format that RAID array with the following command

sudo mkfs.xfs /dev/md0

Again, this takes a while and you can't mount the /dev/md0 until it's done.

8) Now you have a device called md0 which is the formatted RAID array. To make proper use of it, the devie needs to be mounted in to the file system. Use webmin again to mount the device as /media/md0. You can do this under "Disk and Network Filesystems".

9) Finally webmin again to use Samba to share the 5.5TB (!) array on the network. You can do this under "Samba Windows File Sharing".

Monitoring and Disk Failure


Before I filled the RAID array I tested what happens when a disk fails by simply pulling out one of the 4 drives while the server was running. The Linux RAID module in webmin displays in red when a disk has failed. You also get notified by Ubuntu during a boot if one of the disks has failed. But being RAID5 everything will still works as expected. When the disk was plugged in again (ie, replaced in the real world), then the disk is recovered automatically without having to type anything. The following command shows progress during recovery. Recovery of a 2TB disk does take a few hours though.

sudo watch cat /proc/mdstat

All very impressive. I was surprised that reinserting the same disk meant it was treated as a new disk (prompting it to be fully recovered), rather than the same one being replaced.

Summary


Essentially, that is it. I originally wrote this post in 2011 - it is now 2014 and the server has been running with no major issues. If you're using the file server with something like Openelec then you should create an NFS share for the array rather than just a Samba share as it's faster when sharing between linux machines.

In terms of performance if I plug a windows machine in to the (gigabit) LAN then I can transfer files at 90+MB/s to the md0 files share. The server barely breaks a sweat. You get some CPU usage when moving large files around as the CPU is calculating parity and striping files across the disk. But it's not CPU or memory bound at all given my usage with is basically streaming video and music around the house.

See below for other enhancements you can make.

Disabling each disks write cache


After reading lots of webpages on XFS, it seems that write barriers (used by XFS to periodically flush the write cache to minimise loss of data - should there be a power failure - don't work on RAID arrays. So the fall back is to disable each disks write cache. This should minimise and data loss problem if you have a power failure whilst writing files to the disk. To do this you need to

sudo nano /etc/hdparm.conf

and uncomment the write_cache = off line to read as follows

# -W Disable/enable the IDE drive's write-caching feature
write_cache = off

Then reboot and the write caches will be disabled. Further reading here

http://www.nntpnews.info/threads/4993008-benchmark-write-barrier-write-cache-on-XFS?s=938e34407f8dc230ac4c50da6a3adc9e


Email alerts


I wanted to run an IMAP server on the Proliant and have mdadm send (email) any alerts about the array. These email alerts would then be picked up by other client machines in the house (eg, using Outlook). To do this I needed to install postfix (the mail system) and dovecot (to support POP or IMAP mailboxes).
sudo aptitude install postfix
sudo apt-get install dovecot-imapd

Then run the following and use all the defaults to set the initial configuration. Further detail at https://help.ubuntu.com/community/Postfix

sudo dpkg-reconfigure postfix
sudo postconf -e 'home_mailbox = Maildir/'
Then go in to webmin and click the "Refresh Modules" link and Webmin will find that you've installed dovecot. Then under the "Servers" tab you'll find a link for dovecot, click on "Dovecot IMAP/POP3 Server" and then on the "Mail Files" icon. You need to change the "Mail File Location" setting to "Inbox and folders in ~/Maildir". Finally, you need to have mdadm send alert emails to the right address. So under the "Linux RAID" settings in webmin set alerts to go to "user@server". Where "user" is your normal login and server is the machine name. There is no .com or anything as this is a machine on you local network.

To have mdadm send a test message. Use the following

sudo mdadm --monitor --scan --test --oneshot

On you email client (I use Outlook), your IMAP settings need to be

username = user (as above)
email address = user@server
incoming mail server = "server" (as above)

You should then find the test message in your inbox.

Monday, 3 February 2014

Ambassadors

One of the best programmes on telly at the moment.

http://www.bbc.co.uk/programmes/p01jd3vx

Palm emulator for Android

https://play.google.com/store/apps/details?id=com.perpendox.phem