I had overwritten one very important file, it was the ’org2blog dashboard’ which held the database of all my org2blog postings so it was quite important. But, I’d overwritten it with another posting saved as ‘org2blog.org’! The creation date of that file was 28 December 2013, so I needed to restore from an old backup.
First, you need to know what ‘generation’ of obnam’s backups you needed to be using. For this you should enter in your terminal -
obnam --config=/home/$USER/cron/conf/obnam.conf generations ~/cron/backup.txt
Then you sit and wait for it to complete, and you wait, and you wait! As that backup is now at 518gigabytes, its a lot to chew through, so you’ve got plenty of time for a toilet break and a cup of tea!
When it does eventually complete you’ll have a text file with stuff like this in it -
201800 2013-12-26 16:00:26 .. 2013-12-26 16:28:46 (198823 files,98974627917 bytes) 202314 2013-12-26 20:00:23 .. 2013-12-26 20:35:15 (199110 files,99038400408 bytes) 203373 2013-12-27 00:30:59 .. 2013-12-27 02:01:31 (199168 files,99048351486 bytes) 203855 2013-12-27 04:00:20 .. 2013-12-27 04:27:59 (199175 files,99048843808 bytes) 204138 2013-12-27 08:00:46 .. 2013-12-27 08:30:05 (199299 files,99049391542 bytes) 204652 2013-12-27 12:00:33 .. 2013-12-27 12:34:19 (199443 files,99044478564 bytes) 205178 2013-12-27 16:00:38 .. 2013-12-27 16:35:59 (199617 files,99112242614 bytes) 206222 2013-12-27 20:13:32 .. 2013-12-27 22:33:11 (199215 files,99853263170 bytes) 207261 2013-12-28 00:31:23 .. 2013-12-28 02:08:52 (199254 files,99794705299 bytes) 207746 2013-12-28 04:00:34 .. 2013-12-28 04:29:51 (199283 files,99794864937 bytes) 208067 2013-12-28 08:00:34 .. 2013-12-28 08:39:29 (199300 files,99797188371 bytes) 208581 2013-12-28 12:00:29 .. 2013-12-28 12:32:06 (199329 files,99804939690 bytes)
Each one of those is a timed and dated obnam backup, showing from the left - the generation number, date & time it starts, date & time it finishes, how many files in total it found, and its total size.
The important thing here for us is the generation number, and I’ve chosen ‘204652’.
From here you have several options, you can find out exactly what files are in that backup by doing -
obnam --config=/home/$USER/cron/conf/obnam.conf --generation=204652 ls ~/cron/backup-ls-14.txt
but be warned, this will take a long time to do, and you may well decide that doing it is a waste of time, as you could mount the backup, and then have a look at the contents for yourself. To do this you need to enter -
sudo obnam --config=/home/$USER/cron/conf/obnam.conf --generation=204652 mount --to /mnt/test
But again be warned, this will take a l-o-n-g time before you can start your favourite file manager so that you can view the mounted backup. What you’ve done with that command is to mount the backup as root (as that’s the only way that it can be done on my computer, you might find it different on yours though), and then just start your file manager as root to view it with, and then just run -
sudo nautilus /mnt/test
Then you can just look through the mounted backup for the specific file that you need. In my case it is “.org2blog.org”, so I’m able to copy it across to my hard drive. But, you cannot move or delete any file from the backup as it is mounted ‘read-only’, and for the same reason you can’t add to it either!
“Well, duh!” as my daughter would say! :)
To detach the mounted backup you have to use -
sudo fusermount -u /mnt/test/