Raspberry PI File Server: Backup Ham Radio Data

Prepare for Disaster

It happened once before when I was KK4FGM. I had a logbook on a computer that died, and I lost my entire logbook. It was never uploaded to LOTW, QRZ, eQSL, or anywhere, so I lost all credit for any awards or recollection! Since getting back into HF in December 2015, I have made 100% sure that I have duplicate copies of my logs and other important data on a separate device.

Expectations of Design

  • Being a lover of Linux because of the ease of implementation and cost and functionality, I chose to use devices that run Linux.
  • I have several Raspberry PI devices so I chose to use them. They are inexpensive, small, and consume little power. (I have 3 Raspberry PI model B and 1 Raspberry PI 3.)
  • Should be online at all times, low maintenance, somewhat reliable.
  • The data should be stored on a removable device that does not house the operating system. I chose to use a 32Gb USB drive.
  • A script on my ham radio computer should gather the data that I want to back up, write it to a temp location, then SCP that data to the file server to store on the USB drive.
  • Finally, I want the script to do the whole file transfer sequence without the need for passwords, so I need to install a shared SSH key on both devices.
  • I didn’t do it on this device, but having a static IP on the LAN is advisable, but I didn’t want to mess with it right now.
  • This description assumes you have some knowledge of how to move around in Linux. If you are a newbie, there will be some extra Googling involved to figure out some of the implementation.

Implementing the System

Step 1: I won’t go into the steps to get an operating system on the Raspberry PI because Installing Operating System Images does such a great job at it.
I have a Raspberry PI 3 as my ham radio computer running Raspbian Jesse. I use the same OS on my Raspberry PI model B.

Step 2: Make sure that SSH works on the PI file server. You need an Internet connection. I use a USB WIFI card, but LAN also works. Make sure that you can SSH into your server from another device. This is important!!!

Step 3: Insert a USB drive. Mount it. (Easier said than done…mine didn’t work out of the gate.) I will explain. I inserted my drive, but it did not mount. I think this is normal. Here’s how to do it:

  • Before inserting USB run this command:

    ls /dev/

  • Take note of what appears in that list. Now insert the USB drive and wait a second. Run that command again.

    ls /dev/

  • Look through both lists and find the new entry. My entry that appeared for the USB drive was: sda sda1. sda1 is the partition location that needs to be mounted.
  • First, make a directory in /media/. You’ll need root privileges to do this. Call the directory whatever you want, but remember it. I called mine cruzer, but BACKUP is memorable. Run this command:

    sudo mkdir /media/BACKUP

  • You’ll need to edit a file to add this so it mounts the file system. The file you need to edit is located at /etc/fstab, and you need root privileges to edit this file.  I use a program called VIM to edit files. It’s not as easy as using NANO or GEDIT.

    sudo vim /etc/fstab

  • This is the line that I added for my drive. Your setup may look different, and you might need pointers from Edit FSTAB. There are other ways to handle it, but this is what I know to do. Add a line similar to this to fstab. Edit it to suit your needs.

    /dev/sda1       /media/BACKUP   vfat    defaults,uid=1000,gid=1000,auto   0       0

  • Save fstab and exit. Run this command to mount all drives:

    sudo mount -a

  • You should be able to access your USB drive. Try it out. Try to write something to it. It should work. Newbies will struggle some with this in a command line interface. The graphical user interface makes this so much easier.
  • The last step is to allow SSH to log in automatically. This is best described by SSH with Keys. You could skip this step, but I don’t want to be bothered with a password when running my script. If this is too burdensome for the newbie, it could be skipped without too much trouble.

The Script

The last thing to do is to choose what you want to back up. It could be anything; It doesn’t have to be related to ham radio at all. Mine mostly is ham radio related since that is all I do on this computer.  Write down each location that you want to backup. I had locations in FLDIGI and FLRIG directory, minicom directory, and my Documents directory. At some point I might also back up the whole Documents directory. I keep a few other logs and SKCC award files in there that I don’t want to type up again.

Writing BASH scripts can be a daunting task, and this is something that a newbie will certainly have the most trouble with! Take my script and use it to figure out how it works. Look at BASH Programming Introduction for tricks on BASH scripting.

Click here to download the script...This script has no copyright...It's yours...no attribution needed. Enjoy
This script has no copyright…It’s yours…no attribution needed. Enjoy

This script does a couple of things. It  copies the files that I want to a temporary directory. Then it takes those files and uses SCP to send them to the file server. Some things you need to know: the file’s location that you want to backup, the IP address of your server, and the location of your USB drive on the server. This shows my setup, and you can change what you need to make yours work. BASH programming is beyond the scope of this particular blog. There are many books and websites totally devoted to the task. It’s a programming language all its own, and knowing how to program can help you tailor the script.

Proof That It Works

Inverted Vee 40m Dipole and Mast

My Purpose

Antennas in the back yardIt has been a long time since I have experimented with antennas and yard ornaments (tall, antenna holding things like towers and masts), but recently I have been annoyed by the performance of my Hustler 5BTV vertical. I have vertically polarized noise that tends to aggravate me, so I wanted to try an inverted vee dipole to see if conditions improve.

Lately, I have been working CW, and I have had some fading signals and noise, so I figured that the dipole might help some with this. The issue is that I needed somewhere to mount this thing! Continue reading Inverted Vee 40m Dipole and Mast

Solo Hike at Providence Canyon State Park

The back country trail is a beautiful hike. I enjoyed looking at the scenic route, and this spot kept my attention for a snack and rest.
The back country trail is a beautiful hike. I enjoyed looking at the scenic route, and this spot kept my attention for a snack and rest.

The day has come and gone for my first overnight backpacking trip, and it was a 100 percent success. Success did not come without some challenges, though. This was a great trip for me to put my gear to the test before heading out on a two night, three day hiking adventure with some friends on the weekend before Thanksgiving. There were only two weaknesses in my gear that arose during the trip: water and foot gear. There was a third oversight in gear that caused a problem with my foot gear, but it’s almost unrelated; I misplaced my pocket knife. Continue reading Solo Hike at Providence Canyon State Park

Preparing For My First Overnight Hike

Before the Beginning

My first time in a hammock, and I can't wait to sleep in it!
My first time in a hammock, and I can’t wait to sleep in it!

After being invited to go hiking in November, the itch to go hiking before the big trip has taken over. I love camping, and I am extremely excited to get to go hiking with a bunch of guys. I have been looking for a chance to go on an overnight hike before the big one, and the chance has arrived. The paper planning stage of gathering and purchasing gear for hiking is about to bear the fruit of a hike. Continue reading Preparing For My First Overnight Hike

Camping Without Being A Pack Rat

My son and I enjoy coffee around the camp fire.
My son and I enjoy coffee around the camp fire.

For most of my childhood I can remember going on camping trips with my dad, and I remember it being so simple camping as a young man. The stories I can tell of the cold, rainy mornings huddled over coffee or being tormented after dark by my uncles are treasured. The memory of having my eyesight choked out from smoke while blowing on a fresh fire is inescapable. One thing that I can barely recall is how much crap we took with us. I’m almost certain that my dad was a minimalist camper. We probably had the smallest tent, slept on the ground in a sleeping bag, and had just what we needed to cook and eat. I remember it being a no frills trip that was enjoyable. Continue reading Camping Without Being A Pack Rat

Backpacking With Friends

My son opened my new Teton hiking backpack!
My son opened my new Teton hiking backpack!

I was recently invited to go on a men’s hiking trip that is scheduled for Mid November 2015, and I naturally couldn’t say no to the adventure. My boss and friend, Eric, invited me and said that I could borrow his wife’s hiking kit to make sure that I’d like the adventure before investing in my own equipment. I was good to go until I started researching things, and I couldn’t stop myself from diving in head first. Continue reading Backpacking With Friends

DIY 50 Ohm Oil Cooled Dummy Load – A Smooth Move

I couldn’t help with the laxative one liner. I had a lot of fun working on this dummy load project. It’s been in my hands for about two years. Frank, K9TIE, sent me the assembled can a few years ago, but I never went to the store to purchase the mineral oil (a laxative). I decided that I would build it since I needed a higher-power capable dummy load. Continue reading DIY 50 Ohm Oil Cooled Dummy Load – A Smooth Move

10 Meter Mobile

HTX-100 on the Jeep's dashI realized on October 12, 2013 that it had been eleven months since I had last made an HF contact of my own. I made some during Field Day 2013, but those weren’t really mine. There were several reasons why I couldn’t get on the air. I had lots of receive noise, little time, and an uncomfortable ham shack. I believe that I have solved these problems. Continue reading 10 Meter Mobile