backup restore - markmac99/ukmon-pitools GitHub Wiki

Backing up and Restoring Config

Why do i need to back up?

SD cards don't last forever, and if there's a power cut the card can even be corrupted. So its advisable to take a backup of a few key files.

What files should I back up?

The following files should be backed up:

  • platepar_cmn2010.cal, mask.bmp and the hidden .config file from /home/pi/source/RMS
  • the entire contents of the hidden folder /home/pi/.ssh.
  • ukmon.ini from /home/pi/source/ukmon-pitools

To back these up, insert a USB memory stick into the Pi and it will appear as a new disk. Copy the files over and keep the stick somewhere safe. Alternatively you can use file transfer tools to back them up to your PC.

Cant I Just Copy the Card?

Not really, for three reasons:

  • Firstly, if the card is misbehaving, then a copy will contain the same damaged files and errors.
  • Secondly, the expanded filesystem is at least 128GB in size. Cloning it will take many hours and require 150-300GB diskspace.
  • Finally, and crucially, unfortunately SD card makers do not all agree what 1GB means. Some manufacturers use decimal megabytes (1GB = 1000 MB), others use binary Megs (1GB = 1024MB), or decimal Kb, or full decimal bytes (sometimes written GiB rather than GB) Weirdly, some cards are even just a few tens of bytes smaller than others, and quality control issues mean that sometimes, the same make of card may be a different size between batches because any bad blocks just get skipped. So its possible to have a 1GB card that is 999,999,999 bytes long.
  • All this means that you might be able to copy one card to another, but then again it might fail at the last second, or appear to succeed but actually fail.
  • I've even had one card which, when it reached the end of available space started overwriting from the beginning, deleting the data that was already there.

Backing up the SD card

The easiest way to do this is to download the latest image linked here, burn it to a new card, and then copy the config files off your backup USB stick.

Note that you won't be able to directly access the main partition on the card from Windows, because it uses the Linux filesystem extfs. So to copy the files you'll need to insert the card into either a Linux or Mac PC, or into a pi. The simplest approach is to temporarily shut your Pi down during the day, swap the cards, then restart. Wait till RMS and our toolset have updated, then copy over the config files and reboot to check its all worked.

My card died, how do i restore it?

  • Download the latest RMS image as explained here.
  • Install this as normal, and go through the complete installation process for RMS but DO NOT send the key file to Denis Vida.
  • Go through the ukmon-pitools installation procedure but do not send the keyfile to Mark McIntyre.
  • Restore the platepar mask and config file from your backup.
  • restore the ukmon.ini file from your backup.
  • restore the contents of /home/pi/.ssh.
  • Set permissions on the key files. To do this, open a terminal window and type
chmod 0600 /home/pi/.ssh/id_rsa /home/pi/.ssh/ukmon
chmod 0644 /home/pi/.ssh/id_rsa.pub /home/pi/.ssh/ukmon.pub
This will recover your key files and re-enable connections to GMN and UKMON.
⚠️ **GitHub.com Fallback** ⚠️