Backing up a Pi (with USB HDD)

Pi Backup

Time for another text based pi article.. sorry!

Attach the USB disk to the pi.

Next download pi shrink

sudo chmod +x
sudo mv /usr/local/bin

Next check for the correct paths


Now run a dd copy to create the image

sudo dd if=/dev/mmcblk0 of=[mount point]/myimg.img bs=1M

Finally shrink the image

sudo -z myimg.img

You now have a size optimized image that you can restore using the “official” pi image writer software. You can stick this in a cron job to create a regular image backup of any pi.


If you are cloning to test or deploy into another Pi, you will need to delete the VNC config or you will get a “cloned” error in the VNC client and it could stop working. Luckily it’s simple to fix, on the cloned machine do the following:

sudo systemctl stop vncserver-x11-serviced
sudo rm -rf /root/.vnc
sudo systemctl start vncserver-x11-serviced

ZFS Expand with new disk

I realised that one of my 3Tb drives was very, very old. It wasn’t failing yet, but it would probably be best to proactively replaced it. The other drive in the mirror is a 4Tb drive, so I took the opportunity to buy another 4Tb drive and add it to the ZFS mirror… This was so simple it’s scary. Firstly I removed the old drive from the mirror.
#zpool detach <Pool Name> <Device to Remove>

i.e #zpool detach SATAPool sdd
Then I shutdown the machine removed the old drive and put the new one in. When the box rebooted I added the new disk to the mirror.
#zpool attach <Pool Name> <Existing Disk><New Disk>

i.e #zpool attach SATAPool sdc sdd
I let it resilver… but it didn’t auto expand. The main reason for this was I didn’t have autoexpand turned on.
#zpool set autoexpand=on <Pool Name>
This didn’t fix the issue, but it did show the space was available.  The next thing I did was to use the online -e on every disk in the mirror.
#zpool online -e <Pool Name> <Disk Name>

i.e. #zpool online -e SATAPool sdd
And then I had an extra Tb to play with!

Hyper-v to Proxmox

This one is going to be word and code heavy.

Firstly shutdown the hyper-v gen2 VM.

Copy the VHDX to the proxmox server, remember you will need twice the space of the VHDX available temporarily to completed the move.

Create the VM on Proxmox, you will need to create it using a OVMF (UEFI) BIOS. You will also need to create a 1Gb virtio hard disk (again this is temporarily)

Make a note of the VM ID (i.e. 103), you’ll need this to import the hard disk.

Once the VHDX is copied across you need to import the disk

 qm importdisk VMID SORCEDISK.vhdx DATASTORE --format qcow2

i.e. qm importdisk 103 /tmp/data.vhdx SATA –format qcow2

This will then import the disk to the VM.

Next you need to head over to the VM in proxmox and attach the disk in the gui, you will need to install it as SATA or IDE (not virtio yet)

Boot the machine up into windows, install the latest tools, the temporary 1Gb disk we installed earlier will mean the virtio drivers are installed.

Shut the VM down, remove and reattach your windows drive as virtio, remove and delete the temporary 1Gb drive and turn the machine back on. If your machine had a static IP you will need to readd it, you may get a warning about it being assigned to another NIC. You can ignore this, however, I would recommend removing it at some point!

You can now delete the VHDX file you copied to the proxmox server

Job done!

Guest Blog – Respect in Security

I was lucky enough to be invited to write a guest blog just after the launch of the respect in security pledge. Inclusivity and calling out bad behaviour should be key to all we do, especially in public sector. It was a no brainer for us to sign up.

So what is respect in security?

Founded by a group of cybersecurity professionals who have decided to take a stand against all forms of harassment within our industry, ‘Respect in Security’ offers organisations the opportunity to formally pledge their commitment to creating a workplace and professional community free from harassment and fear.

The mission to is give victims and potential victims the knowledge that the industry they have chosen does not support these behaviours, and to arm people entering cybersecurity with the knowledge that their peers and employers are there to support them should they ever be targeted.

Committed to making tangible change in our industry. Our objectives are for organisations to be more transparent and accountable in their reporting channels and to help drive positivity in the interactions we have with each other as professionals within our industry.  A group that is pushing for change, and is committed to working alongside organisations who truly wish to make their workplaces more welcoming and inclusive.

You can find out more about their pledge and sign up here

My guest blog, leading by example,  can be found here (and a big thank you to all those at Respect in Security who helped make the blog possible)

June Update

This one is going to be wordy… I’ve done a few upgrades and changes to the smart static since setting it up and using it for every day holidaying. Over the next few paragraphs I’ll go into some detail. 

The exec summary for those who don’t want to read to much. I’ve added more flic buttons, and more node red flows, I have replaced the switch and access point (details below), I’ve added an emergency pi zero, an external antenna and a new Kasa strip light. I’ve also finally replaced the porch.

Let’s get into the detail!


Flic buttons – these are amazing and work really well for triggering node red flows. I’m using them without the hub, I might change this in the future as the Bluetooth on the pi isn’t the best, but for now it works ok. I’ve added a second button in the bedroom for triggering a nightlight and easier access. Yes they are expensive, but for a smart physical button there is nothing that comes close.

Hardware additions and replacements

Wifi – I’ve put in a unifi access point which I had spare, expecting the GL-inet to do everything was unrealistic and the device isn’t that great so I’m replacing it one service at a time. I have an old thin client that I’m currently playing with for firewall / router duties, at the moment I’m experimenting with whether this should be a proxmox server or bare mental. In the meantime I’ve added a Poynting XPOL-1 antenna which appears to have stablised the connection at quite a good rate c 20Mbps on EE 4G.

Switching – I replaced the tp link switch with an easy smart one, so I can reboot the ports remotely. I’ve had one to many occasions when a pi hasn’t rebooted properly meaning I’ve had to drive out to reboot. The easy smart range have lots of limitations, but it will do for now, I will probably replace it when I retire a unifi one! 

Smart home – TP Link Kasa have released a light strip which we’ve installed at the front, the rainbow scene is a firm favourite, the one downside is these aren’t supported by home assistant yet.

I have also discovered a flaw in one of my automations, the one that shuts home assistant down it is triggered when the battery is lower than 50%, it works perfectly, but I forgot that when the power comes back on the battery will still be lower than 50% (bugger), so I’ve added a condition that checks the state of the UPS (online vs on battery).

Remote support – I’ve added a Pi zero with VNC to the van, so I can access the network if something goes wrong with the main pi (i.e. it doesn’t reboot), I can then power cycle the PoE switch ports to bring devices back up.

Actual Hardware – when we bought the caravan, one of the “porches” was broken. I managed to source some 1mm aluminium and have bent and painted it. It’s now on the van and works well and looks ok!

Pi Rack & Pi KVM

Pi Rack

I decided that I wanted to tidy up my lack rack and put my two Pi’s rack mounted and out of the way. 

The first pi is a backup “server” it runs rsync and has a 3Tb USB drive, it is a staging server between my backups and OneDrive sync. This was easy to do, I printed one module and one pi rack module, works great! I am thinking I might PoE my rack mount Pi’s but this would mean two HATs and a PoE switch for the study.

The second Pi is my Pi KVM, this Pi is slightly more complex as it has some external components, these are mounted in a case, this case was too big for the module, so I 3D printed cases for the individual cases for the rack module. This has tidied it up and it now fits snuggly in the module.

I have done a lot of 3D printing to support the Pi Rack and Pi KVM components, you can see them on the media carousel, links are below.

The printed components are; Modular Pi Rack, USB power splitter case and HDMI to CSI-2 case.

Yummy, yummy Pis – May 2021 Update

Yummy, yummy Pi's - May 2021 Update

I’ve decided this will become a running update of the Pi’s I am using and what I am doing with them. Updates will be posted to the top of the page.

Pi Board and spare Pi

May 2021 – Update

A lot has changed in home Pi world… ESX for ARM has been released and I’ve been testing this, it works and is stable. Hopefully OPNSense will come to the Pi natively and then there will be some interesting opportunities to run Pi firewalls, I have looked at OpenWRT on the Pi, but prefer the completeness of the xSense ecosystem. I’ve upgraded a couple of Pi’s due to performance issues. I have also migrated the Pi 400 to SSD and it’s a lot quicker. I have been keeping an eye on SD card performance and have settled on Samsung Evo Plus and SanDisk Ultras / Extreme.  There appears to be a shortage of 2Gb Pi’s at the moment, I need an additional one to replace the Pi in the kitchen which I am currently using for the CCTV Pi.

A full list below:

    • Pi 4 1Gb – CCTV Pi (upgraded from a Pi 3+ for more streams (including 3D printer and new Eufy Cams)
    • Pi 4 2Gb – OctoPi (3D printer control)
    • Pi 4 2Gb – Pi Sync
    • Pi 4 2Gb – Pi KVM
    • Pi 4 2Gb – Caravan HA
    • Pi 4 2Gb – Caravan Pi
    • Pi 4 4Gb – Bedroom Kodi
    • Pi 400 – Study Pi

Spare Pi (s)

    • 2x Pi 2
    • 2x Pi 3+
    • Pi 4 8Gb (currently testing ARM ESXi)
    • Pi Pico
    • Zero WH
    • Zero
  • December 2020 – Update

In addition to the Pi’s below, I now have two more in use

    • Pi 2 – Backup Pi – Using rsync and rclone to manage all my backups locally and to sync to OneDrive for Business.
    • Pi 4 2Gb – Pi KVM – Find out more in this post 

I have also managed to purchase a Pi 2 v1.2 to go on the Pi versions board. This completes my collection of historical Pi Bs. When the next version of Pi’s come out the Pi 4’s will slowly be retired to the board!

I am also working on a project with Pi Zero WH’s to create a multizone audio system using Volumio, this project will make use of HifiBerry’s popular DAC Hats as well as some custom integration work. I currently have 3 Pi “audio zones” and am awaiting the hats to begin testing.

Spare Pi(s)

    • Pi 2, Pi 3+, Pi 4 8Gb
    • Pi Zero WH
    • Pi 2 1.2 ready for mounting

Retired Pi(s)

    • Pi 3+ – First home assistant server migrated to new proxmox host

Why no love for the Pi A or Compute module? Although I have a good collection of old Pi’s you may notice that I don’t have any Pi A or Pi Compute modules on the list. This is because I don’t use them! I’ve never had a use for the compute modules. I do have a Pi A in a wildlife camera, but this currently isn’t being used. I love the Pi B and Zero form factors which is why I use them the most, if I have a project that ever uses the other form factors, I may well collect the back catalogue of those too!

Original Post – November 5th

From the moment they were announced I knew that the way I did computing at home had changed. Ideal as test boxes, development, media players and now even mini ESX servers! I’ve used them for many things…

The Pi’s I currently have in use are:

    • Pi 4 1Gb – Kitchen LibreELEC 
    • Pi 4 2Gb – 2nd Device in Lego Room
    • Pi 4 4Gb – Bedroom LibreELEC
    • Pi 400 – 2nd Device in Study 
    • Pi 3+ – CCTV Viewer
    • Pi 3+ – Garage
    • Pi 3+ – Home Assistant 

I have used them for other projects in the past including getting started with Home Assistant, mini ESXi Server, custom automations, OSMC media player, Plex Server, learning things with Ali, Wildlife Cameras, the list goes on. I hope they are around for a long time to come!

In the gallery below you can see the latest Pi 400, my display of Pi’s from the original Pi to the Pi 3 B+ (with space for the Pi4 1, 2, 4Gb version… the 8Gb version will start a new board). Next are my Pi’s ready for use (Pi Zero WH, Pi 3 B+ and Pi 4 8Gb), I also have a Pi 2 in the cupboard should I need something older to play with and yes that is a ZX Spectrum +2 behind them. Finally my Pi Zero Board up to the latest Pi Zero WH. 

Living the dream

Eufy Camera

Success! We’ve managed to spend a couple of nights in the van, it all works well, Alexa for the music and the Roku / Plex combo. Other than a couple of issues, below, it’s worked flawlessly and has added benefit without being intrusive. I’ve added some more flic buttons and tweaked some plex scripts (and a UPS buzzer fix), but for actually using the system it has performed really well! 

Issues… so there have been a couple of teething problems. The main one being that Alexa frequently loses connection to Kasa, but the Kasa app works fine, a weird one that I haven’t managed to get to the bottom of. I have put in a few more flic buttons to work round it, but it’s still an ongoing issue at the moment. The bandwidth at the van seems to fluctuate a lot (see below), I am intending to replace the GL-Inet device in time, but I am going to wait for an ARM version of OPNSense and will put in another pi for the firewall / VPN attached to some form of 4G or Starlink router. Finally the wireless seems to drop sometimes, I think this might be due to the VPN connection, but I am going to add a TP Link access point to see if it makes any difference. It all works well enough for now though and we’ve spent a lovely couple of weekends there!

HA Dashboard
Caravan Speeds

I must be nuts…

The Internet - IT Crowd

Safe shutdowns... and startups

I have not idea how stable the power is at the static, but most of the time we will be turning it off when we leave (it might be on for most of the summer when we leave the fridge on). There might also be times we want to preheat the van in the colder months. 

I was working on another project to deliver “internet-in-a-box” for outside broadcasting. This lead me to the open source project NUT, a project designed for controlling UPS units, especially ones whose software sucks (or doesn’t exist for your operating system)

Basic UPS VI 650

Following on from the work I did for the project I decided I could run the van off a UPS which was controlled by the primary Pi and that the home assistant Pi would shutdown should the UPS battery get too low.

 It would also mean that should someone else use the static they would just be able to turn off the power and nut would take care of the safe shutting down of the devices.

UPS Back

I selected a cheap UPS (PowerWalker) that seemed to have reasonable compatibility with NUT and set about configuring it.

The basic NUT configuration was easy. I  setup the netmaster and the CGI site really quickly. Getting the NUT client to work on Home Assistant was easy too, I then setup an automation to shutdown the pi. 

Notifications however were another level of hard, there isn’t that much information out there and it looks like at some point in the past NUT changed formatting in the configs. However, with a bit of work it all came together.

As you can see from the image above I am hardly using any power, the UPS will keep the static active for about an hour after it loses power, while this is great, the main benefit is I don’t need to leave instructions for people to turn the internet or the Pi’s off when they leave!

Why, oh pi!

Originally I was going to setup a Pi Zero just to manage the UPS, this was the original spec for the “internet-in-a-box”. I had found a PoE Injector with Ethernet on a single Micro USB (Uctronics PoE), I was excited by this discovery, as it would mean I could power and add wired ethernet to the Pi Zero… I am still waiting for the devices, but a fatal flaw has stopped this working. The Pi Zero only has one USB port… The PWR port only carries power. So although I could power and network the Pi, I had nowhere to plug in the UPS. I will do some more digging at some point as £4.80 for a UPS controller would be amazing!

Pi Zero PoE
Pi Zero v1.3