How to restore view of system at a specific timestamp?


#1

https://rclone.org/b2/ explains how to list file versions and restore a specific version of a file, one at a time.

I am trying to protect myself from the possibility where the latest version of my filesystem has become corrupt by a virus. Is there a mechanism that will allow me to restore the view of the filesystem at a particular date/time?

Specifically, I expect to be able to to COPY files from the remote to the local filename, providing a single date/time. I expect B2 to find the latest version of a file on or before this date/time and COPY it to the local filesystem without the date/time suffix.

Meaning:

  • I would invoke: rclone copy --latest-before=2018-03-08-205431-000 remote:* local:*
  • rclone would find files test.txt-v2018-03-08-205524-000, test2.txt-v2017-03-08-205524-000 as the latest file before the date/time
  • rclone would restore target filenames “test.txt” and “test2.txt” (suffix removed)

I can open a file request on Github if necessary.

Thank you,
Gili


#2

It depends on how the backup was made.
Use the --backup-dir option when making the backup.

This tutorial mentions it:
rclone_jobber_tutorial.org#example-backup-jobs


#3

This is problematic for two reasons:

  1. If I restore a specific backup-directory I only get a subset of the total backup (only the files that would have been overwritten). On the flip side, I also don’t want to store unmodified files in this directory because then I end up with duplicates across multiple directories.
  2. This mechanism bypasses B2’s native lifecycle mechanism meaning that it won’t automatically deleted older versions of files after X days.

Ideally, I want to leverage B2’s native versioning mechanism and restore a snapshot of how the files looked on any particular day, regardless of whether they had been overwritten during the course of the backup or not.

Thanks,
Gili


#4

I don’t think rclone can do that.
It could be implemented by script or in rclone, but that would be a lot of work.


#5

Maybe you already know this about b2.
If I recall correctly, rclone crypt file-name and directory-name encryption don’t work with b2 lifecycle because:

  • b2 lifecycle appends date to end of file names
  • b2 doesn’t strip off the appended date before passing the file name back to rclone

So then rclone can’t decrypt the file names.
b2 lifecyle works fine with just the file contents encrypted.


#6

b2 lifecyle works fine with just the file contents encrypted.

Right, I just discovered this today. I plan to disable filename encryption but will keep content encryption enabled.

FYI, I filed this feature request: https://github.com/ncw/rclone/issues/2126