How (Not) To Kill Your Pi’s SD Card

This, this I learned the hard way.

I have a number of Raspberry Pi devices around the house performing various functions, from retro game emulation to radio monitoring, but the one that sees the most use is the one running Domoticz – the home automation software. Like most of my Pi builds it runs on top of Raspbian Jessie Lite a Unix-like OS based on Debian and optimised for the Pi.

The logging for Domoticz and some of the associated home automation services can be pretty heavy. And SD cards really don’t like it when you write – and overwrite – lots of data. My first two builds of Domoticz were on 8GB SD Cards. Both survived about 90 days before suffering IO errors. Turns out that the volume of logs being written had beaten the wear-leveling on the card and it was struggling to write anything.

So, how do you run a Unix-like system on a Pi as a headless, long-term server, without periodically killing and replacing the card? Continue reading

Traffic Graphing

imageThe image on the left is just one of the graphs generated automatically for tracking the data usage on my home network.

That particular graph shows the usage of my ADSL connection over time; green is downloaded data, while the blue line shows my uploads. It is generated by Tobi Oetiker’s outstanding MRTG – The Multi Router Traffic Grapher. MRTG is a free Perl script that connects to any device capable of talking SNMP and pulls interesting data from it.

I currently log DSL, Wireless and LAN use (Bytes per second), along with line noise and Noise Margin of the DSL connection. I could also log what the switch in my network is doing, and even what my various servers are up to. As you can see from the graphs you get a nice indication of traffic patterns over time – it’s very easy to spot peaks when BitTorrent kicks in and out, or when someone in a different time zone is playing on my Counter Strike server!

It gives me an “at a glance” overview of what most of my networked devices are doing – which was enough to make me notice the other day that despite having all my wireless devices switched off, something was still polling the Access Point. Turns out I’d left one of the laptops disassociated – but on – and it was sending a little chatter to the AP every few hours.

Installing Leopard from a Disk Image

Apple OS X LeopardMy first generation MacBook Pro steadfastly refuses to read the dual-layer DVD that Leopard comes on. All my Windows machines can read it (or at least the BootCamp partition) and my G5 can read the disk too, but the MacBook Pro won’t boot off it. However, I do have plenty of external drives kicking about so thought I ought to be able to boot off one of those. And yes, I’m only really doing this to get continued Boot Camp support for the Windows XP install I use more than anything else on the MBP. Here’s what I did:

  • Use Disk Utility (on the G5) to create a DMG file.
  • Connect the MacBook Pro and G5 to my gigabit network, and boot the MacBook Pro into Tiger.
  • Connect the USB drive (a self powered 100Gb 2.5″ drive in this case) to the MacBook Pro (I used the right USB port – not sure if it matters which).
  • I erased the (NTFS) partition on the external disk, and created a GUID Apple partition.
  • Select the Restore tab on Disk Utility and drag the DMG file to the source field.
  • Drag the USB partition (the one I just created) to the destination field.
  • Click Restore.
  • After it’s finished, you should be able to open System Preferences and find the USB disk in the Startup Disk pane.
  • Select it and press restart – the MacBook Pro reboots and boots off the external disk.
  • From here on it’s as if you were using the DVD!

The install was pretty swift – without the extra printer drivers, fonts or X11 it took about 10 minutes to install. Since installing Leopard has killed rEFIt the next step is to reinstall Windows and add the Boot Camp 2.0 drivers.

Oh, and the Leopard intro movie is quite pretty, but has really silly music.