Saturday, June 27, 2015

Mac Backups With Rsync to Encrypted Flash Media

Backup Woes

The main advantage of using a Mac is that it defaults to idiot mode and the main annoyance with a Mac is that it defaults to idiot mode, but underneath it all there is BSD...

The Mac Time Machine backup utility is one such idiot application which is probably fine for a large number of people,  but which doesn't fit my usage scenario.  Coupled with the Disk Utility which makes it hard to format a Flash Memory Device properly, it is even worse.

I want to make backups to USB and SD memory devices, since they are small, solid state and convenient.  However, to make a proper backup, the device should be formatted with HFS+ and it must be Encrypted.  The Disk Utility defaults to the prehistoric FAT in order to support file exchange with legacy Windows machines and FAT doesn't support proper file ownership and permissions.

Also, it is rather self defeating if your HDD is encrypted, while your backups are in plain text on a FAT disk.

Format a Removable Disk with HFS+

  • Run Disk Utility
  • Select ‘1 Partition’ from the Volume Scheme menu.
  • Enter a name eg MACBACKUP1
  • Select Mac OS X Case Sensitive Extended (Journaled) from the Format menu.
  • Click the ‘Options’ button and select ‘GUID Partition Table’ 

 Enable File Ownership Data

  • Right click the flash drive and select ‘Get Info’.
  • Click the lock icon in the bottom right corner.
  • Remove the check mark from ‘Ignore ownership on this volume.

Encrypt the Flash Disk

  • Right click the disk icon and select Encrypt.
  • Generate and save your password in KeepassX.

Backup with Rsync

Now finally, the media is ready to be used for a secure backup.  Time Machine works if the media is formatted this way, but it defaults to backing up everything and a Flash Disk is usually too small to backup everything.  Also, there is no point in backing up the whole system, since one can download a new system from Apple.  I only need to backup my Documents folder - everything else is expendable.

Make a file called /Volumes/MACBACKUP1/sync
Make a directory called /Volumes/MACBACKUP1/bak

Edit the sync script with vi:

#! /bin/bash
rsync -avz --progress --delete --max-delete=10 --max-size=20M ~/Documents /Volumes/MACBACKUP1/bak

Make it executable with chmod +x sync

By selecting a max-size of 20 Megabytes, I exclude things like large archives and ISO images.  Deletions are limited to ten files, in order to prevent a possible disastrous delete of the whole backup set, following a local delete disaster.  The result is a 51 GB backup set, which fits on a 64 GB memory schtick - nice.

Now, you can insert the backup device and click the sync script to backup whatever should be backed up to that device and thereby backup Documents to a USB schtick and backup Pictures to a SD card for example, while having it all secure and encrypted, in case the flash thingy gets lost or stolen or copied by the NSA/CSIS/GCHQ/FSB...

La voila!


Friday, June 26, 2015

An Angel Dancing On a Pin Head

Magic Eye Indicators

As a little child, I found the green angel wings indicator on my parent's Philips radiogram fascinating.  I sat and watched and wondered how it worked each time we played a record.

So, let's add a little dancing angel to my 20 Watt audio guitar amplifier:

Why the blazes does it take three obscure keys (Cmd, Shift, 4) to do a screen grab on a Mac?  
Whoever thought that up needs to get three lashes with a wet noodle.

You can get your own dancing angel from Tubes Store in Chelyabinsk:

Basically, it is a miniature cathode ray tube with a curved zinc sulphide fluorescent screen.  The electron beam is deflected by an electrostatic target in front of the screen, powered by a built-in triode amplifier, so everything you need (minus the PSU) comes in one convenient glass package.  Some indicators are viewed end on making a cat's eye circle, others from the side, like this one.  If you already have a thermionic valve amplifier, then hooking a volume indicator up is easy.

As always with any electronic device, the biggest problem is finding the pin-out.  It has the usual triode valve elements: Heater, Cathode, Anode and Gate, but with an additional Screen, behind a Target (deflector).  So you can use the triode part as an amplifier to power the target, which controls the size of the shadow and width of the wings, thus making quivering angel wings on the screen.

The 6E1P / EM80 is super simple, since the Target and Anode are connected together internally, so you don't have to:
  • Pin 1: Gate
  • Pin 2: Cathode
  • Pins 4, 5: Heater
  • Pin 7: Anode
  • Pin 9: Screen 
Viewed from the bottom pin side, the pins are numbered clock wise, starting at the gap on the right.
These devices used to be manufactured in Martin in Slovakia and in Moskow in Russia and were licensed copies of the Philips tubes from the Netherlands.  Contrary to Old Skool American propaganda about the 'iron curtain', there was a lot of co-operation and trade between Western Europe, Central Europe and the Soviets - same as today.  My father in law was a Slovakian truck driver and crossed the fortified border to Austria regularly.  There really wasn't much difference between the villages on either side of the border and everyone watched the same TV channels, but blue jeans were in short supply.  Any Slovakian teenager with a pair of jeans was 'waaay cool' and my wife can still remember how she showed off when she got her first pair.

Unfortunately, I could not see any clear indication of exactly where my angel tubes came from, but the Russian lettering shows it was one of these two factories, since Philips would not print their tubes in Cyrillic.

Here is an amusing old Rusky circuit:

As with all tubes, the voltages are not very critical.  A tube can run on anything from 100V for a miniature, to 250V DC for a big fella.   Somewhere in the middle at about 150V is perfectly fine.  Similarly, the heater is rated at 6.3V AC and anything between 6 and 7 V RMS is OK.  So don't worry much about the power supplies - if it works, it works...

The thing to bear in mid with tubes, is that the gate operates at a voltage negative with respect to the cathode.  The envelope detector diodes are oriented such as they are, to create a negative control voltage.  If you put them the other way around, then the circuit won't work. You can also put a trimmer and bypass capacitor on the cathode, so you can adjust the DC bias and get the wings to close.

To make you little angel dance, simply put an AM envelope detector on the Gate, heat the Cathode, Bias the Anode, keep your fingers away from the high voltage parts and Bob's your uncle!

BTW, it may be a good idea to put a rubber mat on the floor in your workshop.

Zzzappp! Owww!!! 

More information here:

Have fun,