How to specify the snapshot to restore

I have a storage in which there are these snapshots (check command output):

   snap | rev |                          | files |
[snap1] |   1 | @ 2018-07-15 09:51 -hash |    51 |
[snap1] |   2 | @ 2018-07-15 10:09       |    50 |
[snap1] |   3 | @ 2018-07-17 08:40       |    57 |
[snap1] |   4 | @ 2018-07-17 20:33       |    50 |
[snap1] |   5 | @ 2018-07-18 20:23       |    50 |
[snap1] |   6 | @ 2018-07-18 21:53       |    50 |
[snap1] |   7 | @ 2018-07-19 20:12       |    50 |
[snap1] |   8 | @ 2018-07-19 21:32       |    50 |
[snap1] |   9 | @ 2018-07-20 22:50       |    50 |
[snap1] |  10 | @ 2018-07-21 20:14       |    50 |
[snap1] |  11 | @ 2018-07-23 13:35       |    51 |
[snap1] |  12 | @ 2018-07-23 13:48       |    51 |
[snap1] |  13 | @ 2018-07-26 20:09       |    51 |
[snap1] |  14 | @ 2018-07-27 21:48       |    51 |
[snap1] | all |                          |       |

   snap | rev |                          | files |
[snap2] |   1 | @ 2018-08-04 14:45 -hash |   149 |
[snap2] |   2 | @ 2018-08-05 10:37       |   138 |
[snap2] |   3 | @ 2018-08-06 22:56       |   137 |
[snap2] |   4 | @ 2018-08-06 23:06       |   137 |
[snap2] |   5 | @ 2018-08-06 23:07       |   138 |
[snap2] |   6 | @ 2018-08-08 20:46       |   141 |
[snap2] |   7 | @ 2018-08-08 20:57       |   141 |
[snap2] |   8 | @ 2018-08-08 21:00       |   141 |
[snap2] |   9 | @ 2018-08-10 20:00       |   154 |
[snap2] |  10 | @ 2018-08-10 23:08       |   154 |
[snap2] |  11 | @ 2018-08-11 15:08       |   159 |
[snap2] |  12 | @ 2018-08-11 20:00       |   159 |
[snap2] |  13 | @ 2018-08-12 20:00       |   160 |
[snap2] |  14 | @ 2018-08-14 20:00       |   162 |
[snap2] |  15 | @ 2018-08-14 23:12       |   163 |
[snap2] |  16 | @ 2018-08-15 20:00       |   163 |
[snap2] |  17 | @ 2018-08-16 13:01       |   164 |
[snap2] | all |                          |       |

This is the same set of files, I just changed the naming pattern for the snapshots on the date 2018-08-04 and continued to do the backups.

Today I had to restore a single file (recover a previous version) and the restore worked perfectly. I restored the file from backup revision 16.

And I kept thinking: what if I needed the file in the revision (eg) 12? There are two revisions with this number, one from 2018-07-23 and one from 2018-08-11.

The restore command does not have the -id <snapshot id> option…

EDIT:

I did a little test with revision 12 and it restored the 2018-08-11 version of the file, ie from [snap2]. What if I needed the 2018-07-23 version?

1 Like

So your repository is now initialized with the name snap2. To restore from snap1 you need to create an empty repository named snap1 pointing to the same storage and then restore the revision from there, as described here.

Or do I completely missed what are you asking?

1 Like

Just like @saspus said.


(totally offtopic rambling incoming:
on a different note it seems that i liked @towerbr’s post, even though i don’t remember doing it and after a few minutes likes can’t be taken back.

? opens the keyboard shortcut menu, where l is like. interesting. after so long, except for j and k i never even bothered to learn other shortcuts for discourse.)

(Continuing offtopic.

1. WOW. I did not know discourse had shortcuts. I like it even more now.
2. Having j/k do moving up and down and then having l (or h) do anything but some other type of motion (since left right is not applicable) is a very cruel trolling of all the vim aficionados here
)_

1 Like

No, no, I didn’t “re-initialized” the repository. Note that “snap2” is the name of the snapshot, not the repository.

On the mentioned date I just edited the preferences file and modified the second line:

"id": "snap2",

On the mentioned date I just edited the preferences file and modified the second line:

"id": "snap2",

Yep, you’ve effectively re-initialized a new repository by doing so :slight_smile:

Edit. Or you can think of it that way — you specify revision number and snapshot id to restore from in different places: revision goes to command line and snapshot id goes to preference file.

“Initializing new repository” does just that - writes repository id and path to storage to the prefs file.

But this "id": is related to the snapshot, not the repository.

This can be a way of looking at things … :wink: