Web Analytics Made Easy -
Skip to content

Tarsnap - deleting unwanted archive-files

Revised 11 October 2019
I backup my system with Tarsnap every night via crontab, using the following command to make files with date stamps.

tarsnap --exclude [any-files-not-to-backup] -c -f \ arcadiabackup-`date +%y%m%d` /data-to-backup

After some days this produces archive-files of the following character as seen with tarsnap --list-archives.


(In practice, the files will not always be in the correct date order as they are in this example.)

The problem
After several months I ended up with over 100 archive files and this resulted in my paying for more space than I needed*.

*Actually, Graham Percival, the author of Tarsnap, has recently said that retaining old archives costs much less than you would expect. See http://mail.tarsnap.com/tarsnap-users/msg01535.html.

You can delete files with a command such as:

tarsnap -d -f arcadiabackup-131201

When you have a lot of files to delete this will take a long time if you delete each one separately, and tarsnap doesn't allow the use of wildcards. But you can have more than one -f and this offers a quicker route.

I use a semi-automatic method which I now describe. [Note added 15 March 2019: There are scripts for doing this and other things at https://www.tarsnap.com/helper-scripts.html. However, I still use the method described here.]

My solution

(Note: my editor is vim. If you use a different editor, such as emacs, you'll have to adapt the steps for that.)

1. Make a list of all the archive-files and save it as, e.g., archivelist.

tarsnap --list-archives > archivelist

2. Make an executable script called, e.g. tarsnap-delete. It should contain the following lines initially:

tarsnap -d \

3. Import archivelist (made in Step 1) into tarsnap-delete.

It will now look something like this.

tarsnap -d \

(Note: no spaces between any of the lines.)

4. Now delete all the entries that you DON'T want to remove from the tarsnap archjve. E.g. in this case you might delete the newest two entries (arcadiabackup-131103 and arcadiabackup-131104).

5. You now want to insert -f before each remaining archive entry and append \ to each entry. In vim you can do it by making a macro. For example, put the cursor on the first line of the archivelist entries and type qa to start recording. Then issue the following command sequence:


and finish recording with q. (NB. the "0" is a zero.)

Test this. Put the cursor on the first line of the archive list (arcadia-backup-131101)
and issue @a.

This line should now read:

-f arcadiabackup-131101 \

and the cursor should be on the next line.

If it works, you can repeat the macro as many times as necessary with, for example, 20@a. (Don't worry about 'over-running'.)

6. You can now save and exit vim, after which executing the file tarsnap-delete will delete all the archive files you selected.

NB. The steps described here are simpler than what I had in this post earlier and I think give rather faster deletion of files in the archive.

Writing a book on LyX

I've written six books on LyX previously but the last one was a few years ago. I've just done another and thought it would be worth making a few notes about the experience. I found that I'd forgotten how to do some things while others now work better than previously. Here are the main points. (I was using the Book class but I expect most of this would apply to other classes too.)

1. Settings
These are my current settings,for the Preamble with comments. I'm grateful to people on the LyX mailing list and other lists for many of these settings.

% Include index

% Next line provides a latex command "\blankpage"
\newcommand{\blankpage}{\newpage \thispagestyle{empty} \mbox{} \newpage }

% Next line allows margin notes (see below for details of this)

% Reduce hyphenation

% next line for strike-through (if you want this) - use latex command "\st{word}"

% To improve end alignment of lines (see the next two links for details)
% http://www.latex-community.org/forum/viewtopic.php?f=19&t=21170&p=70341
% http://marc.info/?l=lyx-users&m=129071085416743
\tolerance 1414
\hbadness 1414
\emergencystretch 1.5em
\hfuzz 0.3pt
\vfuzz \hfuzz

2. Margin notes
I wanted little pictures and notes in the margins. I tried using the LyX command /Insert/Marginal Note but it didn't work well. Sometimes the notes appeared on the wrong side of the page and there were difficulties using images. I solved this by using the marginnote package and the following Latex entries in the text:

3. Notes

Index errors
When making the index I occasionally found that it wasn't appearing in the pdf. It took me some time to find out why. It happened because I'd accidentally made a blank index entry, by selecting /Insert/Index entry without actually making any entry. It can take quite a long time to track these bogus entries down, by cutting sections of the text and testing.. It's best to keep remaking the pdf while you are inserting index entries to make errors easier to spot.

Resolution of images in gimp
In the past I've had difficulty getting the images in my books to apear at a sufficiently high resolution. They kept ending up at 72px whatever I did. I'm not sure if this was my fault for missing the obvious or if gimp has improved, but anyway, it's easy now in version 0.2.0. Simply click on Image/Scale Image and you can set the size and resolution to whatever you want.

ArchLinux - quick upgrades available

I'm still using ArchLinux as my standard Linux version (see earlier post). It still seems to be quite stable and new upgrades appear very quickly. Vim-7.4 was announced on 10 August and it;s available on Arch today!

Backing up with Tarsnap

I have to say that I'm mostly unhappy about putting important personal stuff on the "cloud". At the same time, the thought that everything might be lost if a disaster occurred here is not nice either. So recently I looked into several places for storing files but they all had difficulties of one kind another. Many didn't work for linux, and of those that did, either there were problems using them or the security was suspect, or both. One that seemed possible had a scheme for distributed storage on people's computers. Admittedly the files would be broken up and encrupted, but still I didn't like the idea. I wouldn't put my own stuff out there and I wouldn't want other people's files on my system.

Then I looked at Tarsnap (Online Backup for the Truly Paranoid), which is different. Security is at its heart and it doesn't even run on Windows (except with Cygwin)! It also has a very reasonable pricing system - you only pay for what you use. So if you are similarly thinking about off-site storage and you use Linux, OpenBSD, or FreeBSD, have a look at tarsnap.

From the tarsnap home page

Tarsnap is a secure online backup service for BSD, Linux, OS X, Minix, Solaris, Cygwin, and probably many other UNIX-like operating systems. The Tarsnap client code provides a flexible and powerful command-line interface which can be used directly or via shell scripts. ... With five minutes to download and install Tarsnap and $5 for an initial deposit, you can get started with Tarsnap today and stop worrying about whether your data is safe.