I was a little late starting this week and didn’t have enough time to do what I had planned, naughty M_the_C. But it did bring my attention to an often overlooked part of gaming, maintaining all those saved games that build up over time.
Backing up Saved Games
Some people are perfectly happy deleting all their saved games once they’ve completed a game, but I have a tendency to hoard them. So what I’ve come up with is a very basic way of keeping a back-up of saves from all the games on your system. It’s not perfect, what we could really do with is a dedicated program that knows the location of saves for all games and keeps an eye on changes.
I tried several different programs but none of them seemed to suit (see this list). They were great back-up programs but weren’t specific enough, what I wanted was something that could be pointed to a list of individual locations where the saves reside. Preferably it should also support backing up to a network location, although I don’t do that at the moment. Some of the programs could only backup a folder (games create save files in the most annoying places sometimes so the backing up files is required), and others could only back-up from one location at a time. Then I found hdup, strange name I know but with a little help it can do everything I want of it.
Installation
Step one, install it.
Fortunately it can be found in the Arch repositories, some of the others I tested had to be installed from the AUR, I won’t go into it now but suffice as to say it takes a little more work. I haven’t checked in Ubuntu but according to the Ubuntu Packages Search it should be there. In Arch just:
pacman -Sy hdup
Configuration
Step two, configuration. More experienced Linux users will no doubt have their own preference for how to do this, to keep things easy press Alt-F2 and type one of the following (depending on your system):
kdesu kate /etc/hdup/hdup.conf
or
gksudo gedit /etc/hdup/hdup.conf
For the uninitiated this could look quite scary, but don’t worry there are only two bits we need to setup and then we can skip right down to the bottom. Find the section that starts:
[global] # where to put the tar archives archive dir = /vol/backup/
The bottom line needs to be changed to point to the location you’d like to store the back-ups. Where you put them is up to you, if you were using hdup to back-up other things you might want it in a general location, however since I am just using it for saved games I decided to save it in my home directory:
/home/mthec/.saved-games/
By adding a . to the start the folder will remain hidden most of the time, preventing the users home folder from looking cluttered. Be sure to add a slash to the end. The second part that needs setting is:
# chown the archives to this user user = operator
To avoid permission troubles this needs to setting to your user name, replace operator with your own.
Setting Locations
Step three, with everything setup it’s time to start adding locations to be backed up. These are grouped into ‘hosts’, the name between the [] brackets, now you could just create a host called [SavedGames] but each host can only have twenty directories and most gamers will have many more games than this. Another reason to use separate hosts is because all listed folders are saved into the same file, whereas hosts get their own. There are two examples provided in hdup.conf of how to format a host (you can safely delete one if you want), it might look a little complicated but you actually only need a two of the lines. Here is what you need:
[hostname] dir = /path
Since each host is going to be specific to a game you don’t need to worry about exclude, none of the other commands are needed either. The only thing you may want to keep are the comment lines, any line starting with # will be ignored by the program and you may want to include a few notes or possibly leave the ones already there to help jog your memory.
Here’s a quick example, the first game I put in was Bus Driver:
Host names cannot include spaces. The Bus Driver saves are stored in the home folder, there is actually a folder called /Bus Driver/save but the configuration file is saved in the level above so I just put the whole thing. You can then copy the block and reuse it for your next game.
Step four, time for a quick test. Just before that though I should explain how the back-up system works, there are three types of back-up Monthly, Weekly and Daily. Monthly is a complete back-up, the others just back-up any changes. The command to start a back-up is:
hdup -P monthly hostname
The -P is required to suppress an error, change monthly to whichever type of back-up you wish to do and replace hostname with the host you want to back-up. You should get a read-out like this:
Now if we look in /.saved-games we’ll find a folder name BusDriver, followed by a dated folder and in that will be a standard .tar.bz2 file. This makes it extremely easy to restore individual files, you just use a normal archive program. You can change the compression factor and type in hdup.conf if you wish. Now unfortunately you can only perform one host back-up at a time, but I’ve come up with several solutions which when put together should make a relatively painless back-up schedule.
Automation
Firstly, you can set it to back-up every time you play the game. Provided you use an icon this is extremely easy to do, and works invisibly. Right click on the icon and select properties, on the Application tab attach the following to the end of the command:
&& hdup -P weekly hostname
The && means the command will only run once the game has closed, this means you’ll keep a completely up-to-date back-up of your saves without having to do any extra work. Now why did I put weekly? Just because it’s called weekly, doesn’t mean it can only be done weekly. It’s merely a label for a more regular back-up than monthly. You could set it as daily but to do a daily back-up you need a weekly anyway, if you were playing a game often (maybe a new one) you could always do a manual weekly and set the icon to do a daily. You will need to do a monthly back-up first, you could do this manually or…
Secondly, one bulk back-up. As I mentioned you can only run one host back-up at a time and if you have a list of 20 or more games it could get very time-consuming and boring. So I’ve dusted off my Python hat and written a little script. No doubt a proper programmer would point out many flaws in what I’ve written, but it does the job. Most, if not all, Linux installations come with Python pre-installed, it’s what a large portion of open-source software runs on. So all you should have to do is copy the following and paste it into a text editor, save it with .py at the end and you can easily run it from console or GUI.
DISCLAIMER DISCLAIMER your computer may explode and I take no responsibility, this is a simple script and I’ve commented the complicated bits so you should be able to see it’s not harmful but anyway DISCLAIMER DISCLAIMER.
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
# Monthly Backup of saved games.
import os
import re
hdup = 'hdup -P monthly '
# Open hdup.conf and search it for sequences starting with a [.
conf = open('/etc/hdup/hdup.conf').read()
name = re.compile('\[(\w+)')
list = name.findall(conf)
# For every title, run hdup. This also includes 2 [global].
for a in list:
command = hdup + a
os.system(command)
print 'Complete'
exit
I stored mine in the /.saved-games folder so that I’d know where it was but it should run from anywhere. If you make it executable you should be able to click on it and select run in a terminal. Otherwise open up the command line, change to the directory it is stored in and type:
python name.py
The third option is to setup a cron job. Unless you have an extremely stripped down system there should be a cron program working in the background, this a scheduler used by the system for a variety of tasks, you can add your own crons to perform whatever task you like. However I have never grasped how these work, I’ve looked into them and could not find a way to setup a job without setting a specific time. Since I spend a lot of time Windows, I don’t use Linux on a regular basis, this means I couldn’t guarantee a time when it would be on to perform the back-up. Have a look into what cron program your system uses, you could look at the documentation and you might be able work out something for your situation. If anyone knows how I could do what I want, please feel free to post a comment.
As I said, different games save to different locations and they can vary dramtically, being spread all over your hard disk, most will either be in the games folder or in a separate folder in your home folder (games played using Wine save here if they’re meant to go in your documents folder in Windows) but tracking them down can sometimes be difficult. (I’m looking at you S.T.A.L.K.E.R…) There is no way I could list all the different locations, so if you cannot find the location for a particular game, just use a search engine.
Closing
Finally, you may wish to back-up to a remote location. I don’t have anything to do this with so just follow this little guide for backing up over SSH.
I hope this has been of some use to someone, until I start gaming in Linux on a regular basis I probably won’t be using it, but it’s good to know there is an easier way than backing up the folder manually. I just hope that one day someone develops a program that can automate all of this, something with flashy box-art would be nice.
Many thanks to the Arch Wiki. (Once again.)



Just wanted to drop a line to say that I’ve been really grooving on this series of posts! Several years back I finally gave up maintaining a Wintendo installation and made the decision to do all my computer gaming under Linux. While there have been the heartbreaks (notably the Sims 2, which has never and likely will never work), I’ve been able to find more than enough to play using just Linux, Wine/Cedega, and native ports.
I did discover that giving up my Windows partition made the decision much easier. Without anything with which to compare my Wine games, I found I could stop worrying about missing features. As a bit of an OCD personality, this was a really rather helpful discovery.
Admittedly in the last couple of years, I did cheat: I discovered that an XBox 360 made a great companion to a Linux gaming box. It got me through the dry spell between when Unreal Tournament 3 was released sans Linux binary and when Cedega could finally run it (with only a few problems).
I’m getting off topic, so let me circle back around to say that I’m really enjoying this series and I’m looking forward to reading more!
Thank you, that’s really great to know.
Most of the Linux gamers you see on various forums are generally the type who only spend a little amount of time, playing a select group of games, but you seem to be aware of the bigger scene even if you don’t take part in it (it’s a good point you make about trying to avoid making comparisons).
Whether you can make the switch does seem to depend on what kind of gamer you are, if you were just starting out in the world of PC gaming you could be a perfectly happy gamer, if you just stuck to native and Platinum rated Wine games. For someone like me it’s a little more difficult, I have a reasonable collection of games and it would be a shame if I had to leave a lot of them behind. I would also have to extricate myself from the gaming scene to do what you have already done, reading posts about the latest fantastic game could get quite depressing, but the very fact that it’s possible gives me hope that one day I might have the choice.
This is very true. There have been times when le dernier cri has tested my resolve; if it hadn’t been for the 360, Fallout 3 would have probably broken me (a game by my favourite company based on one of my favourite sandbox properties? Aiiie).
Fortunately, I haven’t had to leave too much of my PC games collection behind (my wine-prefix directory is rather huge;->). But I do have to pick my new games fairly carefully to make sure that they do run under wine.
And in the end, there’s absolutely nothing wrong with having a Wintendo installation. I gave mine up because I realised that I was investing too much mental capital in keeping it secure and dealing with the little surprises of the Windows OS that bothered me. But at the end of the day, Windows -is- the best gaming OS out there and I’d be hard pressed to give up more than a tiny fraction of the games that I have available for it.
I mean, I’d be lost without my Civilization 4!