Backups the easy way
One of my biggest issues with the Pi has always been – backups. Using a PC to backup a 16GB SD is a pain and of course necessitates turning the Pi off to remove the SD. Well, now there’s a better way.
A slightly less painful way than backing up the whole SD with a PC is to use BerryBoot which can do a good job of running Raspbian and at power-up giving you the option to store a compressed version of the SD to USB memory.
It was with sadness then that I updated Raspbian today to the latest version.
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install piclone geany usb-modeswitch
sudo apt-get install python-pigpio python3-pigpio
Nice theory but in practice, on reboot, I ended up with an utterly dead board – something to do with the update and BerryBoot. I’ve reported this to the BerryBoot author.
But here’s the thing – the latest version of Raspbian Jessie now for the first time includes a live backup facility. Once you have this you’ll wonder why it was not always this way – especially if, like me you’re not a Linux fanatic.
It does not stop there however. Not only will this new utility copy from live to SD (I’ve yet to figure out how to run the SD copier from the command line but it runs from menu – accessories – SD card copier without issue) but also – and I’m quite excited about this – you don’t need the same size SD – which means expansion or reduction is now a snap – thank heavens for that.
So in order to test this new backup facility – I grabbed the latest Raspbian (not the NOOB version) and blew it onto a16GB SD with Win32DiskManager as usual. I started up the Pi3 and put another identical SD into a convertor and stuck the USB convertor into a spare USB slot. I ran the backup, powered down, swapped SDs over and rebooted – no problem at all. Fantastic.
For my second test – I ran my script on the Raspberry Pi 3 so it was fully up to date with all of my tools – Apache, PHP, Mosquito, Node-Red, SQLite etc. – on a 16GB card. I then made a backup the same way as above to an 8GB card… the transfer took place while writing this blog – all in around 15 minutes.
I powered off the Pi3, put in the 8GB card and powered up. IT WORKED!!!!
With that success behind me I decided to get brave. I took the new card and put it into a Raspberry Pi 2 – surely this could not possibly work? IT WORKED!!!!
For some this may be nothing – for others a life-saver – so now it is easy – without even powering down to make copies of a working system – even on different size cards and it would seem interchangeable between Pi2 and Pi3. Other Pi-like manufacturers take note!! Now I can be WAY more adventurous as it is so easy to make backups.
While I was on I thought I’d try the new pigpio GPIO interface.
Firstly I started up the pigpio daemon – at this point being new to me I have no idea how to make this run at power up – nor do I know if there is a reason you should NOT run this at power-up.
Bear in mind that everything was originally set up on a Pi3 – but by this time I was running the SD on a Pi2, not the Pi3. I like doing things interactively when I’m learning so I simply typed python <enter>
I was greeted with >>
I fastened a LED/resistor combo (I always keep a few ready with female connectors on them for testing) between connector pin 6 (ground) and 12 (GPIO18).
>> import pigpio
And it worked – the light came on and off when I used the same command with 0 as the last parameter. I’m dying to try the other more complex commands in a Python program. indeed today everything just seems to be working – the sun is shining, my gadgets are working – what more could one want. I have one duff Electrodragon (more on that later) but apart from that…