Backing Up and Recovering your Notes.

OK, you have some Tomboy notes. Its likely they are in some way, important to you. The more you use Tomboy, the more you need to ensure you have a backup strategy. Fact is, sooner or later you will need that backup, or, sadly, wish you had it !

Backup is about recovering from something bad, perhaps slippery fingers or a hardware failure. And remember, any backup strategy that is not tested in some way is worthless.

Accidental Delete

Now, Tomboy is already giving you some protection from an accidental delete. The deleted note is actually moved to a folder called, appropriately, 'Backup' where your notes are stored. See here. However, Tomboy does not provide a mechanism to restore that note. We have to do it manually. With care !

Recovery is all about copying the 'deleted' note from the Backup directory, up one level. However, to ensure that file names do not accidentally clash, Tomboy generated its own file name for that note and you won't recognise it. So the first problem is to find your note ! Hopefully, you can remember a lump of text from the file, perhaps "this was a really important note", if so, search for it, copy it back and then stop and restart Tomboy.

Linux

db@laptop:~$ grep "this was a really important note" .local/share/tomboy/Backup/*

.local/share/tomboy/Backup/5833271e-6c7e-4d66-8553-9f3458c4c926.note:this was a really important note but somehow I deleted it.

db@laptop:~$ cp -n .local/share/tomboy/Backup/5833271e-6c7e-4d66-8553-9f3458c4c926.note .local/share/tomboy/.

In this example, Tomboy has named our note "5833271e-6c7e-4d66-8553-9f3458c4c926.note". Thats how it is ! Now, right Click the tomboy icon, choose "quit" and the restart.

db@laptop:~$ nohup tomboy &

Now, your note should again appear in the "search all notes" list. Its not really a problem that you have left a copy in the Backup directory, Tomboy quietly overwrites it if you delete that note again. By the way, Tomboy leaves that backup copy there indefinitely. Worth knowing if you make and delete a lot of notes, or want to be sure a deleted note really goes away.

Windows

Coming soon...... Please post a message to the Tomboy list for some quick advice. Any contribution would be very welcome.

MacOS

Coming soon...... Please post a message to the Tomboy list for some quick advice. Any contribution would be very welcome.


Hardware Failure

In the event of a disk crash or lost or stolen laptop, you need to recover all your notes. If you are syncing your notes to another system, then perhaps you think that is all the protection you need. Everything is copied to another box. But do consider how often sync happens, if its just occasionally, can you risk the material not yet transferred ? Recovery is just a case of installing Tomboy on the new (or newly built) system, configuring it to sync from your usual place and all is good.

Another approach is to grab a copy of the note files and keep it on another system, perhaps a network or google drive. Manually copying is not a great idea, you might forget and you really need several copies to feel a safe.

Linux

This author uses a bash script driven by cron to make a daily, weekly and monthly backup in his Google Drive (managed by Insync). Copy the script somewhere appropriate ($HOME/bin), make it executable, alter the TBBackup variable to point to a directory that is hopefully replicated somewhere else. Add a cron entry (using the command "crontab -e" as shown). Watch that files appear there over time.

# Script to backup the tomboy notes. It makes daily, weekly
# and monthly backups. Leaves files called day, week and month
# that have date/times indicating when next operation is due.
# David Bannon - 27 October 2016

#     Suitable Crontab entry -
#     5  *  *  *  *  /full-path-to-this-file

TBBackup=~/Insync/tomboy-backup
TBMain=~/.local/share/tomboy

mkdir -p $TBBackup/Today

cd $TBBackup
touch now
if [ now -nt day ]; then
    rsync -avCz --delete  "$TBMain/." "$TBBackup/Today/."
    Day=`date +%A`
    tar czf "$Day.tgz" "Today/."
    touch -d '+1 day' day
    if [ now -nt week ]; then
        cp $Day.tgz week.tgz
        touch -d '+1 week' week
        if [ now -nt month ]; then
            cp $Day.tgz month.tgz
            touch -d '+1 month' month
        fi
    fi
fi 


Recovering Files

If you have lost your Notes, due to an accident or hardware failure, first thing to do is to stop any automatic backup process. Most Important !

When recovering notes to a new Tomboy install, the Notes directory will be empty and you can probably not do too much harm if things go wrong but if you have a a working system, one with existing notes, please be very careful.

If you have a copy of your notes directory, perhaps made by the above script or made before you reinstalled your OS, you can simply copy those files into the appropriate directory and stop and restart Tomboy. The above script leaves a plain copy of the most recent notes and they could be copied directly back to Tomboy. If you need to go back to earlier versions, then first extract the files. For example, if the backup files end up in $HOME/Insync/tomboy-backup and we are going back to last Sunday -

cd;  mkdir Recover;  cd Recover
tar xzf "$HOME/Insync/tomboy-backup/Sunday.tgz"
cp -n Today/* ../.local/share/tomboy/. 

Windows

Coming soon...... Please post a message to the Tomboy list for some quick advice. Any contribution would be very welcome.

MacOS

Coming soon...... Please post a message to the Tomboy list for some quick advice. Any contribution would be very welcome.

Apps/Tomboy/Backup (last edited 2017-01-19 07:10:06 by David Bannon)