Hack and /: RV Offsite Backup Update

Having an offsite backup in your RV is great, and after a year of use, I've discovered some ways to make it even better. By Kyle Rankin

Last year I wrote a feature-length article on the data backup system I set up for my RV (see Kyle's "DIY RV Offsite Backup and Media Server" from the June 2018 issue of LJ). If you haven't read that article yet, I recommend checking it out first so you can get details on the system. In summary, I set up a Raspberry Pi media center PC connected to a 12V television in the RV. I connected an 8TB hard drive to that system and synchronized all of my files and media so it acted as a kind of off-site backup. Finally, I set up a script that would attempt to sync over all of those files from my NAS whenever it detected that the RV was on the local network. So here, I provide an update on how that system is working and a few tweaks I've made to it since.

What Works

Overall, the media center has worked well. It's been great to have all of my media with me when I'm on a road trip, and my son appreciates having access to his favorite cartoons. Because the interface is identical to the media center we have at home, there's no learning curve—everything just works. Since the Raspberry Pi is powered off the TV in the RV, you just need to turn on the TV and everything fires up.

It's also been great knowing that I have a good backup of all of my files nearby. Should anything happen to my house or my main NAS, I know that I can just get backups from the RV. Having peace of mind about your important files is valuable, and it's nice knowing in the worst case when my NAS broke, I could just disconnect my USB drive from the RV, connect it to a local system, and be back up and running.

The WiFi booster I set up on the RV also has worked pretty well to increase the range of the Raspberry Pi (and the laptops inside the RV) when on the road. When we get to a campsite that happens to offer WiFi, I just reset the booster and set up a new access point that amplifies the campsite signal for inside the RV. On one trip, I even took it out of the RV and inside a hotel room to boost the weak signal.

Room for Improvement

For the most part, I leave my RV plugged in when I'm at home, but because the Raspberry Pi is powered off the TV, I don't necessarily leave it on all the time. Every week or so, I tend to turn it on for a day or two to make sure that files are in sync, but I realize it would be a lot better if I just left the Raspberry Pi on independent from the TV. Even though OSMC boots up quickly on the Raspberry Pi, it would be pretty nice for it to be ready to go the moment I turned on the TV. Since the Raspberry Pi doesn't draw much power when idle, I don't really need to worry about it draining my house batteries if I leave it on at home—especially since the RV is typically plugged in at home.

The WiFi booster works, but by default, it just adds "_8C" to the remote access point's SSID. It also, by default, reuses the remote access point's password. This means you risk other people nearby using your access point, thinking it's one of the official repeaters. I've taken to changing the default SSID it picks to something custom to me, but unfortunately so far, I haven't found a way in the interface to give my boosted AP a different password, which means that even if I pick a consistent SSID for my WiFi booster, I still have to reconfigure laptops and the Raspberry Pi to use a different password.

I've started to wonder whether it might make more sense to connect a higher-powered USB WiFi card with an external antenna to the Raspberry Pi and turn it into the repeater instead. Then I could use the OSMC interface to connect to remote access points and route connections over the access point I set up on the Raspberry Pi.

Another issue I've run into when on long road trips is that while I'm the road, my RV is no longer in sync with my home NAS. That means if any new media shows up on my home NAS, I won't have it on the road. For example, if I followed a lot of podcasts and stored them on my NAS, it would be nice if new ones would also show up on my RV when I'm on the road.

Syncing from the Road

I was planning to take an epic multi-week road trip across America, and I realized a simple way I could make sure I had new media with me on the road—a VPN. These days, many people think of VPNs just in the context of security and privacy as a way to protect their systems from snooping by their ISP or from a local coffee shop they are connected to. VPNs though are just a way for you to connect two trusted networks securely over a potentially untrusted network. This is exactly what I needed for my RV.

By having a VPN connection between my Raspberry Pi and my home NAS, it could connect to my home network wherever it was out in the world, provided it had a WiFi connection. What's more, since OpenVPN can be configured to assign clients a consistent IP when they connect, once I set it up, all I had to do on the server side was modify a local hosts entry to point to the VPN IP instead of the RV's normal IP on the local network, and the sync script could stay the same.

I already had set up a simple local Puppet server on my home network and added a module to manage my VPN configuration, so it was relatively simple to add a new client for my RV and generate a set of keys and configuration files. On the RV side, I just copied over that client key and configuration, and I made sure that OpenVPN was installed on the RV's Raspberry Pi. Finally, I edited the /etc/default/openvpn file to make sure my client configuration was set up to start by default, and I also used systemctl to enable that OpenVPN client so it started at boot.

Once I set up the VPN, I confirmed that the sync script still worked over the new VPN IP while I was on my home network. The great thing about OpenVPN clients is that they are persistent—if a connection drops, it continually will try to reconnect. This meant that once the Raspberry Pi was connected to a WiFi access point, it was just a matter of time before the VPN connection was restored.

We finally took our epic summer road trip, and about a week into it, we realized there was some new media at home we'd like to have in the RV. We happened to be at a campsite that offered WiFi, so when we camped there that evening, before we went to bed, I reconnected the Raspberry Pi so it was powered off a 12V USB adapter instead of the TV. That way, I could leave it on overnight without the glow from the TV making it hard to sleep. I logged in to my NAS at home and confirmed I could ssh in to my RV from there and then went to bed. When I woke up, I checked the media center, and sure enough, new files had been copied over to the RV overnight while we slept!

Oops

This story wouldn't be complete though without a mistake. At some point in our previous travels, I had connected the Raspberry Pi to my cell phone's tethering plan, and it had remembered that access point. We happened to be at another campground that offered WiFi, so I decided to leave the Raspberry Pi on overnight again to get synced back up. Unfortunately, the WiFi at the campsite didn't work, and so we had been tethering our laptops off of my phone. When I went to bed that night, I forgot to disable tethering on my phone, and when I woke up that morning, I discovered the phone's battery was completely drained!

The moment I realized the battery was drained, I realized what had happened. I checked my data plan, and sure enough, I had a huge spike over the past evening. The Raspberry Pi had remembered that access point, had tethered over my cell phone, and it had synced a bunch of media over while we were sleeping! Fortunately, even though my plan is metered, it has a cap in place that converts into "unlimited mode" once you use a certain amount of data, but if that hadn't been in place, it would have been a disaster. Suffice it to say, I went into the Raspberry Pi configuration and removed that access point so it wouldn't happen again.

Conclusion

I've been very pleased with using my RV media center as an offsite backup, and with the addition of a VPN, it's been even better to have new media while I'm on the road. I just need to find a cost-effective way to keep the Raspberry Pi on and online without racking up a huge cell-phone bill, and then I'll truly have an always-up-to-date off-site backup. Since my last road trip, I've thought of a number of improvements to this setup, so stay tuned for future articles where I'll describe even more updates.

About the Author

Kyle Rankin is a Tech Editor and columnist at Linux Journal and the Chief Security Officer at Purism. He is the author of Linux Hardening in Hostile Networks, DevOps Troubleshooting, The Official Ubuntu Server Book, Knoppix Hacks, Knoppix Pocket Reference, Linux Multimedia Hacks and Ubuntu Hacks, and also a contributor to a number of other O'Reilly books. Rankin speaks frequently on security and open-source software including at BsidesLV, O'Reilly Security Conference, OSCON, SCALE, CactusCon, Linux World Expo and Penguicon. You can follow him at @kylerankin.

Kyle Rankin