Pages

Monday 20 October 2014

Oops, I deleted all the files

Oops.

It started yesterday. Something screwed up, and a file with an impossible name got copied to the CF card of my PDA, with all the maps and cache information. As a result, Memory Map couldn't work. I discovered this after we'd driven for two hours to get to the start location. Fortunately, I have a backup PDA in the car, and we used that. If that hadn't worked, I'd have used my iPhone 4 (you can't use an iPhone 3 for caching, because the lag between moving, and the location being registered, is a few minutes, but that's fixed on the 4).

When I got home, I discovered about the impossibly-named file. I tried to delete it, but that wouldn't work. So I tried to reformat the card and recopy the files, but the software for reformatting wouldn't work. Fortunately, I had a copy of it on my main server, so I reinstalled it, and then I was able to reformat the card. But then I needed to recopy the maps. Fortunately, I have a copy of all the maps on my main server, so three hours (8 gb of maps) later, they were all copied. Then I tried to recopy the caches, and that's when I discovered that the impossibly-named file was also on my main server, along with nearly 5000 other files of cache info.

Rather than delete 5000 files, I deleted the whole subdirectory, and recreated it. But instead of calling it "caches" I called it "cache". A minor mistake, with big consequences.

Then I ran the script to recreate the caches on my main server. That starts off like this:

cd /home/r/host/geocaching/memorymap/caches
rm *


But the directory called "caches" didn't exist, so instead, it deleted all the data and software in the place I ran it from.

Big Oops.

Fortunately, I have a backup of that directory. Or, to be more exact, I have five backups. One is a backup of the whole main server, done every day, and the second is another backup just like it. The third is a backup done on the 1st to the 10th of each month, the fourth is a backup done on the 11th to the 20th of each month, the fifth is a backup done on the 21st to the last day of the month. The reason for this is as follows.

Suppose something dreadful happens to a file, and I don't find out about it for a couple of weeks. Then I can still go back to the backup made a couple of weeks ago.

So, as you can see, "fortunately" isn't really the right word. I know that I make mistakes, and I try to organise my computer systems in such a way that they don't turn into big mistakes.

1 comment:

  1. rm /home/r/host/geocaching/memorymap/caches/*

    HTH
    I even saved you a couple of bytes :)

    ReplyDelete