Third party cookies may be stored when visiting this site. Please see the cookie information.

Home Babies & Children Gallery Information Free Software Reviews Blog

Stewart's Blog

Monkeys, megabytes, medical and more ...

(Children, computing, first aid and other ramblings ...)

Neopixel GUI for the Raspberry Pi

May 1st, 2015

I’ve started work on a graphical application to control Neopixels using the Raspberry Pi. This is one of my first projects using Python and Tkinter.

It’s primarily designed for a disco DJ environment where a DJ may want to change the LED sequence based on the music being played. It uses nice big buttons (ideal for touch screens) to choose from a selection of pre-programmed sequences.

Neopixel GUI application for the Raspberry Pi

I’m still working on it, particularly the lack of documentation, but it can be used now.

Download neopixel-gui from github

The software has been tested using the MyPiFi Neopixel Controller board which is currently available on ebay if you missed the kickstarter.

Raspberry Pi St George’s day with Unicorn Hat

April 23rd, 2015

I’ve recently bought a Pimoroni Unicorn Hat for my daughter to use on her Raspberry Pi. It’s a add-on for the Raspberry Pi which provides 64 LEDs each of which can be individually set to any colour.

As it’s St George’s day I’ve created a St George’s cross.

St Georges day Unicorn Hat on the Raspberry Pi

The photo is shown through a diffuser as the LEDs are very bright for a photo.

Programming is easy using the supplied Python libraries.

First install the python libraries following the instructions here: Pimoroni Unicorn Hat.

You can download the St George’s cross below:

St George’s flag Unicorn Hat file

Unzip the file using
tar -xvzf stgeorgesflag.tgz
and then run using sudo

Day out cycling on the Staffordshire and Worcestershire railway near Tardebigge

April 6th, 2015

Photos from the canal at Tardebigge

Posted by Days Out Diary on Monday, 6 April 2015

HDMI Pi – Raspberry Pi screen – upgrade to Raspberry Pi 2 / B+

April 6th, 2015

I bought a HDMI Pi, Raspberry Pi screen through the kickstarter project. When the Kickstarter was run then there were only the model A and model B Raspberry Pi computers and the screen was designed for the model B. Although the B+ was released before the screens actually shipped for logistics reasons (and to reduce further delays) they shipped all the kickstarter HDMI Pi screens designed for the Model B.

Since the Raspberry Pi B+ was released and now the Raspberry Pi 2 the team behind the HDMIPI have created an upgrade kit, but unfortunately that only fits a newer version of the HDMIPI and not the ones from the original Kickstarter. It is however not too difficult to change the HDMIPI to fit the new B+ / Raspberry Pi2 layer.

Upgrading the HDMIPi to a Raspberry Pi 2

First I bought the new layer from Cyntech – HDMI B+ and Pi2 back plate. I also bought a HDMI stand at the same time (more about that later).

First remove the back of the screen, and the next layer to allow the old Raspberry Pi to be removed.
Position the new Raspberry Pi on to the HDMI connector. If you have an original HDMI Pi then you will probably find that the mounting holes are in the wrong position for the B+ / Raspberry Pi 2, so mark the positions using a pen (eg. Write-4-all fine).

HDMI Pi upgrade to RPi2 / B+ - position the Raspberry Pi 2

Remove the HDMI Pi interface board. Carefully drill four, 3mm holes into the positions marked. I am fortunate to have a bench drill which makes it much easier to drill, if using a hand drill you will need to be more careful to drill straight at the exact point.

HDMI Pi upgrade to B+ - Drill the mounting holes

You may notice that two of the holes drilled are directly in-line with the layer below. This will mean that it is not possible to put a screw head into that position. So using a round file create a indentation into the layer below as shown. You will need to wipe the layer down before refitting it, which is especially important if you have ever used the file on metal previously.

HDMI Pi upgrade to Pi2 / B+ - file the screw hole positions

Now mount the new Raspberry Pi using the new screw holes. The screws provided are metal, but instead I used nylon screws which will tolerate a small amount of misalignment between the holes for the Raspberry Pi and the new holes. I also thought that now the board was mounted with 4 instead of the two screws this is more than enough support. I used an oversized nylon nut as a spacer between the Raspberry Pi and the layer (similar to how the HDMIPI interface board is mounted).

HDMI Pi upgrade to Raspberry Pi B+ mount the Raspberry Pi 2

The miniUSB cable used to power the Raspberry Pi also needs to be replaced. The new micro USB adapter cable provided is a very tight fit and involved bending it into an S-shape. I was a bit worried about the amount of pressure being put onto the Raspberry Pi socket, but now it is in place and mounted I think it will be OK and be less wear and tear than regularly plugging / unplugging the cable.

The next thing is the tricky bit, although this is the same whether you have bought your HDMIPi designed for the B+ rather than having to modify it. There is a bit of plastic that goes across the USB sockets / Ethernet port. Although it may be possible to leave this in place if using only small dongles on my previous version I found it useful to remove that to make it easier to connect / disconnect peripherals. On the old version of the HDMI PI it was fairly easy to remove the plastic that went past the USB / Ethernet socket by breaking it off by hand. I tried this on the new plate and rather than breaking off the plate cleanly it started to crack the narrow bit of plastic next to it.

If you want to remove that plate across the ports then I recommend using a small hacksaw rather than trying to break it off by hand

HDMI Pi upgrade to RPi2 / B+ - remove the USB panel - CAREFULLY!

Before screwing the back onto the HDMIPi I did need to file a small amount of the plastic off due to the Raspberry Pi being mounted slightly closer to the HDMI interface board. Then I screwed the back on and it was complete.

HDMI Pi stand

The HDMI Pi stand does fit except for the mounting point where I removed the USB / Ethernet cover. The stand goes between the two USB sockets. This works for the small adapters that I used here, but may be a problem if connecting devices with larger USB plugs.

HDMIPi Pi2 / B+ official stand

An alternative is a wire type stand designed for tablets such as the one shown below. I did think that the official stand would be more sturdy, but I prefer that this one isn’t against the USB ports.

HDMIPi Pi2 / B+ alternative stand


The HDMI Pi is still the only low cost screen that can mount the Raspberry Pi inside. The upgrade for the first edition HDMI Pi screens involves some drilling and filing, but should be within the scope of most people.

Day out at the Big Bang Fair at the NEC – including #Error404

March 16th, 2015

The Big Bang fair is a free STEM (Science, Technology, Engineering and Maths) event aimed at children aged from 7 to 19. It’s an annual event and I first attended the Big Bang Science Fair last year – Big Bang Fair 2014. I took my 8 year old daughter (now 9 year old) along and she really enjoyed the event.

After last years experience we signed up again as soon as registration was open, but this time I took my son along now aged 7 and my daughter brought along two school friends as well. My wife also joined us. My own children are very interested in technology and science, but this is an event that makes the subjects fun for everyone. Even my wife had to admit that she enjoyed the day out and she is not normally interested by science and technology.

The event is held at the NEC. There was a change in the halls used from last year with the layout being arranged a little differently (and longer walk from the train station), but otherwise it followed a similar format.

We started in the power and energy area, with lots of activities relating to energy generation and supply. The first activity we joined in with was generating electricity using pedal power. A way of illustrating how much energy is needed for common household electrical items.

Cycling to generate electricity at the Big Bang Fair

One of the things I wanted to take my children along to was the Astro Pi stand featuring Dave and Clive from the Raspberry Pi foundation. They have teamed up with the European Space Agency and astronaut Tim Peake to take some Raspberry Pi computers up to the International Space Station (ISS) and run some children’s code. We talked with Dave who showed what the Astro Pi Hat looked like and gave a run down of it’s features. The children are now thinking up ideas for what programs could be useful for the ISS.

Raspberry Pi - Astro Pi at the Big Bang Fair

As well as lots of hands-on things to do there was lots of information on careers in STEM subjects, useful for older children, but also a great way to get the younger children thinking about a future career in STEM.

career information from the Big Bang Science Fair

Our main highlight of the Big Bang Fair was a show on the main stage. Last year we saw Kaboom! an explosive history lesson about explosives. This year we watched #Error404 – a introduction to computer programming by Fran Scott. The show was amazing! It included many examples of the Raspberry Pi in action and the inner workings of computers using humour, audience participation and of course Big Bangs!

#Error 404 - about the Raspberry Pi at the Big Bang Fair

The show was really good fun which kept the children entertained as well as teaching them about computing.

#Error 404 - explosion on stage using a Raspberry Pi at the Big Bang Fair

It was an amazing show!

It would take too long to list all the things we saw and activities we did but it included – a full size K’Nex model of Bloodhound SSC (designed to be the worlds fastest car), generating electricity with a Cummins generator, controlling Vex robots, crash testing a model train and assembling a model of a Rolls-Royce jet engine.

model Rolls-Royce jet engine assembled by a 7 year old

One of the last things we saw was the world’s largest Raspberry Pi cluster (Bramble) which was on show with GCHQ. They also had some fun interactive games.

Raspberry Pi cluster from GCHQ at the Big Bang Fair

Suffice to say we had a great time at the event. The only thing was that there was far too much to do with only so much time to do it in and so much that our legs could take (especially as the kids had been on two different bikes generating electricity to boil a kettle and light a light-bulb). It was a case of picking out of a few activities and trying to fit in as much as time allowed.

Count us in for next year!

Raspberry Pi robot Android app

February 26th, 2015

I created a web front end for my Raspberry Pi based robot, which works well on a desktop PC, but not quite the way I wanted on a mobile phone.

My idea was to have graphical buttons for the different directions and holding down the button will make it move in that direction and releasing it will stop the robot. Unfortunately it doesn’t work this way through a mobile phone browser. The reason it doesn’t work how I wanted to is because mobile phones treat a button held down on a web-browser in a similar way to a right mouse click on a desktop PC. As a result instead of moving the robot it would give a pop-up menu.

I did have a workaround by changing the behaviour to need a press to start and a press to stop, but it’s not quite what I wanted. I’ve been wanting to have a go at writing a mobile phone app for a while and it just so happens that it’s something I’ve been doing as part of my MSc, so I took this opportunity to create a basic app to control the robot.

Android app for controlling Raspberry Pi robot

This is the first app I’ve created that isn’t related to my academic studies and it’s fairly simple at the moment, but I think it’s great what can be produced fairly simply for Android without having to buy any commercial software to develop with.

It’s still in it’s early stages at the moment, for example there is no way to change the IP address of the robot without recompiling, but I am going to develop it further as time allows.

It’s too early to release on Google Play at the moment but if you’d like to have a go then you can download from github and then open it in Android Studio.

Raspberry Pi – Heart beat – 8×8 LED display with I2C BackPack from AdaFruit

February 5th, 2015

This is based on the AdaFruit 8×8 Bicolor LED display with I2C BackPack. It’s connected to a Raspberry Pi 2, although it’s only very simple and could be connected to any model Raspberry Pi.

After soldering the parts together (checking that the display is the right way round – with the writing near the round marker) then connect to +5v (or if using other I2C may need to use 3V3) Gnd and ports 3 and 5 for the I2C connection.

Enable I2C through the raspi-config interface

Install smbus python package

sudo apt-get install smbus

Get the AdaFruit source code:
git clone

I think put together the following code (which is only a quick hack):


import time
import datetime
from Adafruit_8x8 import ColorEightByEight

grid = ColorEightByEight(address=0x70)

# This is a bicolour LED - setting the pixel to 0 is off, 2 is red, 3 is yellow.
red = 2

heart1=[0b00000000, 0b01100110, 0b10011001, 0b10000001, 0b01000010, 0b00100100, 0b00011000, 0b00000000]
heart2=[0b00000000, 0b01100110, 0b11111111, 0b11111111, 0b01111110, 0b00111100, 0b00011000, 0b00000000]


  for y in range(0, 8):
    position = 128
    for x in range(0, 8):
      value = position & heart1[y]
      if (value > 0):
        value = red
      grid.setPixel(x, y, value )
      position = position >> 1


  for y in range(0, 8):
    position = 128
    for x in range(0, 8):
      value = position & heart2[y]
      if (value > 0):
        value = red
      grid.setPixel(x, y, value )
      position = position >> 1


Raspberry Pi - Heart using Adafruit 8x8 LED matrix with LED Backpack

Raspberry Pi 2 – New 1GB quad-core $35 computer

February 4th, 2015

The Raspberry Pi is a $35 computer designed to provide a platform for children to learn computer programming. The Raspberry Pi was launched in 2012 and became and immediate success, with the only problem being how to satisfy demand when initial orders exceeded everyone’s wildest dreams. Initially many were bought by adult makers rather than the children they were aimed at. Since then the Raspberry Pi has taken off in schools, clubs and with children at home. With nearly 4 million sold it’s on it’s way to become the UK biggest selling computer ever.

The Raspberry Pi has many things that make it ideal for teaching programming to children. It’s inexpensive, easy to interface with (through a GPIO connector) and includes a Debian based operating system (Raspbian) with a selection of tools so that children can start programming straight away. The one thing that has let it down is that it is was a little slow. It was still usable and for $35 is better than I ever thought you’d get for that price, but you did need to be quite patient with it.

Raspberry Pi 2 - 1GB quad-core computer

In the three years since the first Raspberry Pi it’s been through a few minor changes, first some small changes to make it work better with USB devices, then they switched production to the UK and doubled the memory to 512Mb. They created an even cheaper version (model A) and then increased the number of USB ports and the number of GPIO pins (model B+). Until now it was still based around the same single core ARM6 processor. They’ve now given the Raspberry Pi it’s biggest boost ever by launching the Raspberry Pi 2 with a new quad-core ARMv7 processor and increasing the memory further to 1GB. The previous changes were all very welcome, but this upgrade is a huge leap and makes the Raspberry Pi capable of much more.

Upgraded Raspberry Pi 2

At first look it’s hard to see any changes between the Raspberry Pi B+ and the Raspberry Pi 2. The first change is that you can actually see the processor. Previously it was hidden under the memory which was soldered directly on top of the processor. The memory chip is now on the underside of the board and provides 1GB of RAM. The rest of the Raspberry Pi is unchanged, which is the good part. If they had swapped lots of other things on the board or added any of the other features people are asking for then it would have either added more to the cost or risked breaking compatibility with the older Raspberry Pi.

There are people complaining that they didn’t add various features. Most seam to be complaining about the lack of gigabit ethernet or that they want SATA capability, but these are unlikely to be of any benefit in and educational setting which is after all the aim of the Raspberry Pi.


There are few changes to the Raspbian image which is the standard Linux distribution for the Raspberry Pi. I believe there is a new kernel to support the chipset, but otherwise very few changes. This may mean that there is potential for more improvements in speed on the Raspberry Pi 2 if some of the libraries are compiled for the ARM7 processor, but that would need to be done in a way that maintains compatibility with the older versions.

Speed increase

The Raspberry Pi 2 is noticeably faster. The claims are for a typical six times increase in performance which is easy to believe. Applications such as Scratch which were slow but usable are now fast and responsive. The processor indicator is also a good indicator which on the previous version of the Raspberry Pi would often be showing 100% is now showing nearer 25 to 40% even with significant applications running.

Additional software

There is nothing new installed by default, but there is now much more software available that would either not run or be too slow to be usable before. The Raspberry Pi comes with it’s own web browser based on Ephiphany which is specially tuned to get the most out of the processor on the original Raspberry Pi, but I wanted to try a more modern browser. So one of the first things I installed was Ice Weasel which is Firefox renamed by Debian (IceWeasel / IceCat compared with Firefox). Iceweasel was too slow to be usable on the earlier version of the Raspberry Pi, but zips along nicely on the Raspberry Pi 2.

IceWeasel is installed using:
sudo apt-get install iceweasel

It was a similar thing with LibreOffice which is an open source office suite comparable with MS Office. There are other lightweight office applications, but being able to run LibreOffice would be a big improvement. I installed the full LibreOffice suite
sudo apt-get install libreoffice
and then tried the Impress presentation application. It’s a little bit slower compared to running on a full PC, but it’s now fully usable.

Raspberry Pi 2 running LibreOffice Impress - presentation

This means that rather than just being a platform for learning programming the Raspberry Pi 2 can now be used as a personal computer for homework etc.

What doesn’t work?

The main thing missing in terms of software capability on the Raspberry Pi 2 and another PC is Adobe Flash. This is because Adobe has dropped support for Flash and as it’s a proprietary application it’s not possible to get the source code to compile for the Raspberry Pi. With Adobe dropping support for Flash it’s a dying technology, but unfortunately it’s still used by some educational websites such as Educational City and Bug Club which my children have to use for homework.

The new version of Scratch (version 2) also uses Flash, so that won’t run on the Raspberry Pi. Fortunately version 1.4 still works fine and has continued to see some improvements supported by the Raspberry Pi foundation.

I expect in a few years time flash will be used less and less, but for now it does mean that children may need to have access to a “normal” PC as well to be able to complete all their homework.

Ubuntu Snappy Core

It was not possible to run Ubuntu on the Raspberry Pi before as it is not available for the ARM V6 processor. Now that the Raspberry Pi 2 has an ARM 7 processor then it is now possible to run a version of Ubuntu. The normal desktop version of Ubuntu uses Unity which is slow enough on a low spec PC, so is unlikely to be usable on a Raspberry Pi, although it may be possible to get a version that uses a lightweight desktop to work. It should therefore be possible to install Lubuntu which uses the LXDE desktop environment similar to Raspbian.

One version of Ubuntu that is available is Ubuntu Snappy Core. Ubuntu Snappy Core is a development of Ubuntu designed for improved reliability required for Cloud services and in the new Ubuntu phone. There is an Internet Of Things (IOT) version of Ubuntu Snappy Core currently available on the Raspberry Pi website. There appears to be a few issues with the image at the moment as I am unable to install additional software due to a certificate key problem, but it sounds promising for the future.

Windows 10 for devices / IOT on the Raspberry Pi

Another big announcement is that Microsoft Windows 10 will be available for the Raspberry Pi 2. Now I’m not a big Windows fan (in fact I rarely use it outside of work) but if people want to run Windows then that’s their choice. It’s worth noting that this is not going to be the full desktop version of Windows 10, but is instead a light version specifically for running on devices as part of IOT. As far as the main operating system is concerned it is likely to remain as Raspbian.

Windows 10 will be provided free of charge, but only for non-commercial use. I expect that that anyone developing a commercial application that needs Windows 10 would need to purchase a license from Microsoft.

The Windows devices software currently provides wiring which is a programming language similar to that used on the Arduino. This is developed in Windows Visual Studio on a PC and then pushed to the device.

With no desktop environment on the Raspberry P I expect programming for Windows 10 is not going to be as easy for children as using Raspbian, but may be popular with existing developers that are used to developing with Microsoft Visual Studio.

Where does this leave the old version?

One of the good things about the Raspberry Pi 2 is that it’s maintained physical and software compatibility with the older versions. So it’s provided the performance improvements for those with the new Raspberry Pi, but it’s not alienated anyone running the older ones.

The original Raspberry Pi is still suitable for teaching programming and for physical computing, the new version just does this faster and adds a couple of new options. The old Raspberry Pi still works fine as a media centre and as a server and all the other things that people have been using it for. So if you’ve got an older model there is no need to get rid of it just yet, but obviously the new model is nice to have.

The model A+ is the current, smaller, cheaper version that uses less power and therefore may be a better fit for some circumstances. I expect the A+ will be upgraded to the new processor eventually, although I’m not sure if that will mean an upgrade to the memory to 1GB as the current A+ has only 256MB. It sounds like this it is unlikely to be until late 2015 before the A+ gets the upgrade though, so if you want a low power Raspberry Pi (to run on batteries) or are on a tight budget then you may still want to consider the A+ instead.


Overall the reaction from the public seams to have been overwhelmingly positive, but there has been some criticism and some of the comments have unfortunately been quite rude or hurtful. I could go off on a tangent and describe how this sadly appears to be the way of the modern digital age where more and more people seam to think that it’s fine to throw insults when sending comments via the internet, but rather than take the bait from the trolls here’s just a few of the comments and why I think they are unjustified.

Why not add the xyz feature?
It seams that you can never please everyone and there are several people complaining that the feature they want adding has been overlooked once more. Whilst I would love to have a 200GHz hecta-core processor with 4PB of memory and a 100GB fibre network interface it would not be possible to do so at the same low price. The important thing is that the price is kept low and that they continue to meet the educational aims of the foundation. The Raspberry Pi has already proved a huge success with the maker community and whilst there are always going to be people that won’t more it’s a great achievement to get so much for such a low price.

Not available for $35 – and why it priced in dollars anyway?

The Raspberry Pi is priced in US dollars as that is how the components are sourced and it means that the price can remain steady regardless of currency fluctuations. The majority of Raspberry Pis are made in the UK (Wales in fact) and are available through suppliers in many different countries using local currency. The price excludes local tax and additional shipping charge (where applied). I bought mine for about £30 including free delivery which is excellent value for money considering what you get.

Can’t get a Pi quick enough

The Raspberry Pi has been and continues to be a victim of it’s own popularity. They are currently making 20,000 Raspberry Pis per day so although most suppliers sold out very quickly when the new version was announced there shouldn’t be too long to wait. Those of us that tried to order on the first day that the first Raspberry Pi went on sale had to wait for several months so hopefully a few days wait shouldn’t be too bad.

Anti-Microsoft comments

There have been quite a bit of criticism of the announcement that Windows 10 will be available from the Raspberry Pi. I am a fan of Linux, I like the fact it’s free and open source, I like the fact it’s developed by the community and like the choice it gives me. I do not see the need to start criticising others for choosing something different. The main operating system for the Raspberry Pi is still going to be based on Linux and if others want to install Windows (and want to pay the license fee if they develop a commercial device) then that is their choice.

But I just bought a B+ last week

The one group of critics that I do feel a little bit of sympathy for are those that have just bought an older version to find that there’s now a new version come out that’s better for the same price. Unfortunately that’s just a fact of life and I’ve been in the same position myself. Technology moves on and it’s frustrating to find that something you bought one week drops in price, or (as in this case) that a better version is now available at the same price.

There wasn’t any announcement about the new version until it was available, but that is the same as most of the industry as once a new one is announced the sales of the existing product will stop. I don’t think there is a large enough product margin to significantly discount the price of the old one so a decision would have been made about when was the best time announce availability of the new one.

One thing to remember is that the Raspberry Pi you bought last week is still just as good today as it was last week and was still excellent value for money then. It’s still a great device for learning programming on, or for use around the home. In fact I still have several of the original 256MB Model B Raspberry Pis which we use to turn our TVs into smart TVs using Kodi (formally XBMC) and at only $35 that’s a bargain.


The Raspberry Pi has just got better. I am sure that there is no other computer that has the flexibility and processing power of the new Raspberry Pi 2 and charges just $35.

If you have an older Raspberry Pi then you can continue to use that as you did before, although the speed improvement on the new model is impressive.

This is all good news as far as I’m concerned and I’ll be looking forward to the even faster Raspberry Pi 3 in a few years time [here’s hoping], but this provides an amazing computer at an unbelievably low price.

I’ve got some ideas of my own, but mostly I’m look forward to seeing what school children manage to create with the new faster processor on the Raspberry Pi 2.

Adding a home disk to virtualbox virtual machine – Ubuntu VM

January 26th, 2015


Recently I ran out of space when using a Virtualbox virtual machine. Normally I use a dynamic disk that allows resizing (typically setting it to be much larger than I expect to use), but in this case I am using a virtual disk provided for me. It’s based on VMDK and Virtualbox does not have support for resizing a VMDK disk.

A lot of the space was used in the home directory (in my case this was different versions of Android software development kit) I added a second virtual drive and migrated the home partition over to the new drive, similar to how I’ve done it with real physical disks on servers before.

I have updated this after some more research into how VirtualBox handles drive allocations.

Warning !

First backup / clone your vm if not already done so.
WARNING – if run incorrectly you could lose all your data. the drive letters mentioned below may not match your virtual machine in which you will need to change the drive reference in the commands or you will lose data. Do NOT copy and paste the commands I have used unless you are 100% sure that you have the same setup as mine.

If you are using Linux as the host computer for the virtual machine then make sure you enter the commands on the appropriate system. Running the cfdisk / mkfs commands outside of the virtual machine could damage your host computer.

Adding the virtual disk drive

Create a second disk drive through the virtual machine manager

Choose a dynamically allocated disk and choose a large size – it will only use the size required, but can then expand so hopefully you won’t need to go through this again. I created one approximately 30GB in size.

I believe the name of the disk drive determines the order initial order in which it is listed and hence the drive letter allocated. It does not matter as we will be using a unique non-changing reference for each drive, but this will determine the exact commands that need to be run. Choosing a later filename (alphabetical) may avoid having to install grub onto the new disk (the last step).

You can also change the drive slot allocation by click on the drive in question and looking at the attributes shown to the right. A lower SATA port number will result in a lower drive allocation (eg. SATA 0 is normally /dev/sda – SATA 1 is normally /dev/sdb).

Virtual machine adding disk VirtualBox virtual machine manager

Start the virtual machine – boot using the existing drive

Depending upon how the disk has been attached it may complain about not being a bootable drive. You can either go back to the settings and change the drive to a higher slot location (eg. SATA 1 instead of SATA 0) or reboot and press F12 to boot from the second hard disk. We can fix this later.

Partition and format the new drive

Assuming that /etc/fstab uses the UUID (blkid command) of the disk drive then it should not matter if the disk allocation has changed for the drive.

From a terminal run df to determine the drive used for your root hard disk

Virtual machine adding disk - df show existing file systems

In this case it’s at /dev/sdb1 and so we need to make sure we don’t do anything to drive sdb as that’s our main operating system and current home directory. This may be different on your computer – MAKE SURE YOU CHECK!

ls /dev/sd*
and look what other drives exist. The physical drives are the ones without a digit on the end, which on my system are sda and sdb (sdb is the one that’s in use and so sda must be our new disk drive).

Partition the drive using the following command making sure that you use the correct drive.
cfdisk /dev/sda

Partition second hard disk for virtualbox vm image

Check that there are no partitions already defined and that the size in the top right matches the size of the drive you created. If not STOP!

Use NEW to create a new partition – accept the defaults of primary and use the entire disk size.

Choose WRITE and then QUIT.

You will now have a new partition with the device name previously but with a 1 on the end. In my case /dev/sda1

You can now format it as a Linux (ext4) partition using

sudo mkfs.ext4 /dev/sda1

MAKE SURE YOU ARE RUNNING THIS AGAINST THE CORRECT PARTITION. This will destroy all data on the partition and will NOT ask for confirmation before formatting the drive. Run a df again first to make sure and don’t use a drive if it’s listed.

Copy the data from the home directory

After formatting the drive it can be mounted to a temporary mount point

sudo mkdir /mnt/home
sudo mount /dev/sda1 /mnt/home

Check that it’s mounted correctly
ls /mnt/home
you should just see the one file called lost+found

Assuming you are not using an encrypted home partition then run the following:

sudo rsync -aXS /home/. /mnt/home/.

You may get a warning about not being able to copy .gvfs – you can ignore this warning.
You may also get a warning that some files/attrs were not transferred.

If you want to check that the copy has worked correctly then run
sudo diff -r /home /mnt/home

Note you will see the following differences which are all OK
lost+found (only in new copy)
.gvfs (only in old copy – not required)
Plus any files on the home directory that may have changed since the rsync (eg. .lesshst on my computer)
A list of about a dozen differences is normal, if you see some of your documents in the list of differences then the rsync may not have completed properly.

Update fstab and remount the drive

Now add the new drive to /etc/fstab. You need to add the drive using the UUID which is found using

blkid /dev/sda1

The entry should then be added to /etc/fstab in the format
UUID= /home ext4 none 0 0

as shown below

Adding second virtual hard disk for virtualbox vm image /etc/fstab

Now rename the current folder and create a mount point for the drive

cd /
sudo mv /home /home.old
sudo mkdir /home

Now run
sudo mount -a

You should find that the drive is mounted in the new location.

Whilst a reboot is not required then I think it’s a good idea to do one at this point to make sure everything is working, before removing the old home directory.

Grub setup

The virtual machine will attempt to boot from the first disk. If the new disk is earlier in the drive list than the main disk then it will try and boot that instead.

You should be able to change this by changing the drive slot allocation in the VirtualBox setings, but you can on a temporary basis hitting F12 each time you boot the VM.

If you have created a disk that is appearing earlier in the system (and have to use F12 to boot the system) then you can install Grub onto the new disk image so that it can boot from either drive (it will still look for the operating system on the original disk).

To install grub to the new drive

sudo grub-install /dev/sda
sudo update-grub

Rebooting the virtual machine should now boot straight into the virtual machine.


This is one way of increasing the storage on a virtual machine by adding a second virtual disk drive. There are other ways of achieving this (eg. cloning the disk into a different disk drive), this one has the advantage of creating a different virtual home drive which could be useful if you want to access the drive in another virtual machine image.

An alternative is to clone the existing drive into a larger drive. You can then create another partition on the drive – or if you want to be able to increase the existing partition, it is possible using gparted as long as the drive is not mounted. This may mean having to attach your disk drive to another virtual machine.

Energenie infrared socket and Raspberry Pi infrared

January 22nd, 2015

I have already posted about the Energenie wireless remote control sockets. I’ve now had chance to look through one of their other products – which is an infrared remote control socket. This is a power saving socket allowing a TV and associated equipment to be fully powered off from the mains socket using the normal TV remote. I have seen the sockets before and wondered whether they were actually that easy to use. In particular I wasn’t sure how it would be possible to use the same remote control to control both the TV and the power socket. The way it does work is that there is a 10 second delay between the socket being powered on and being able to power it off again (giving time to turn on the TV without inadvertently turning the power back off) and a delay of 10 seconds after the power off is pressed before it cuts power (allowing the TV to shutdown properly). This works great with my bedroom TV setup.

In my bedroom I have a TV and a Raspberry Pi running OSMC with Kodi (formally Raspbmc with XBMC). As standard it is not possible to fully power these off using the remote control, so before I used the Energenie infrared socket these were left powered on after use with the TV often being left in standby when not required. I have now connected these to the Energenie Infrared socket using an extension lead. To power on the TV I use two presses of the on button on the TV remote which powers on the socket and then the TV. At this point power is applied to the Raspberry Pi so that powers on as well. To then shutdown I first choose shutdown from the Kodi menu so that the Raspberry Pi shuts down cleanly then press the power button which turns off the TV and then 10 seconds later the power is turned off at the socket.

Remote control using the Energenie Infrared remote control board

As well as making a socket, Energenie have also released a Raspberry Pi add-on that provides a way to receive and send infrared signals. The circuit is fairly simple and details are provided so you could make one yourself, but the Energenie board provides this in a pre-built board (no soldering required) which can be plugged in to the top of the Raspberry Pi.

Setup isn’t quite as straight forward as the wireless ones as you need to lookup your infrared remote codes, or enter learn mode to teach LIRC about the remote control. It’s fairly easy for most remote controls, although it doesn’t work with some media centre remote controls (including these). I believe this is because a kernel module is required which is not included in the standard Raspbian install, I expect this is required to enable the “mouse” support from the remote control. The IR transmitter also needs to be in line-of-site with the sensor for the power socket (fortunately there is a long lead provided to the sensor).

It does however open up a whole world of other opportunities and I will be writing about at least one other use in future.

Buying the infrared socket and infrared Raspberry Pi controller board

The infrared socket has been available for a while and is available from a number of suppliers. At the time of writing the infrared controller board is a new item and is only available from a limited number of suppliers. Below are some of the sources I found.

The Energenie infrared remote socket is available from or Energenie4U. You may also find it at some electrical or diy stores.

The Energenie IR controller board is available from Before buying do check whether it’s a pi-mote (wireless) or a infrared board for the Raspberry Pi to ensure you purchase the appropriate board.


I am impressed with the Infrared Remote Controlled socket. It provides an easy way power off a TV and accompanying Raspberry Pi, without leaving it on standby and without needing to get out of bed to do so. The Raspberry Pi infrared board also allows this to be controlled using a computer or could be used for control of other infrared devices.

If you are just wanting to control a power supply using the Raspberry Pi then the wireless sockets are easier to use and don’t required line-of-sight, but if you want to be able to use it with a standard TV remote control then this works well.

This review is based on an evaluation unit provided by Energenie.

Twitter Status - follow stewartwatkiss

UK days out, children and holiday information is also available on the Days Out Diary web site
Linux, LPI and the Quiz / Test Program posts are also available on the Penguin Tutor website
First Aid Information, first aid games and first aid practice test / quiz entries are also available on the First Aid Quiz Web site