Creating a new snapshot by just adding or updating files to an existing one?


#1

Hi,

I wanted to ask if it is possible to create a new snapshot that just adds/updates files from a base/parent snapshot (i.e. non-existent files are preserved)? Think of rsync without --delete. Is such a thing possible? If not, would it be a desirable feature?

Thanks very much.
-chressie


#2

In theory this is possible (at least the data structures in the repo do not forbid this),but there’s no way to do that yet without (heavily) modifying restic. I wonder though: What is your use case? What are you trying to achieve?


#3

I wanted to use restic as dump for my pictures for example. I don’t have enough space on my local disk, but I have enough on an external disk. I could keep the latest pictures locally and regularly push them into restic. If I need space, I can delete them locally, but they are still available in my repo… Hmm, the more I think about it this use case might not align with restic’s goals though.


#4

Indeed, it sounds like restic is not the right tool for this. I wonder if you are aware that git-annex does what you want to do: https://git-annex.branchable.com/

It allows managing files with git in a way that you don’t need to store the files locally, and it tracks that enough copies of the files exist (i.e. more than one).


#5

Yes, I have used git-annex before I heard of restic ;). I got bothered by 1) the tons of symlinks that git-annex keeps in the repo, along with 2) consciously deciding which files to put into the annex and which not, and 3) encryption is not the default. I’ll keep looking. Thanks for the answer so far!


#6

Hi,

I was testing Restic for the same reason: backup valuable photos and videos and free up space for more. Although I’ve found it suit my workflow and help me in other backup needs very well. For those reasons, I was very happy with it. Well, until I read “it sounds like restic is not the right tool for this”. :sweat_smile:

Moments ago, I was looking for a way to mark a backup as non-deletable, protected or something similar. That’s how I ended up in this post and just found out the same very owner says Restic is not for what I wanted. :stuck_out_tongue_winking_eye:

I think there is still a way to use it for photo archive: tags. Tags could give semantic meaning to snapshots, at least for me. Something like: “photos”, “protected” “2017”. What do you think? Another tool is still a better idea?

Thanks,


#7

“It may not be the right tool” means that restic was developed to be a backup program, which saves changing data in a data structure that is regularly rolled over. The starting post in this thread is about changing the contents of snapshots after they have been written, and I must say I’m reluctant to add that. So for a kind of “archive” system you may want that, for a backup system maybe not so much.

I’m happy that restic suits your needs though! :slight_smile:


#8

I’d also point out that you are supposed to have multiple copies of your data. Backing up a photo and then deleting it means you don’t have multiple copies of that photo! What you should be doing is finding some cheaper “offline” storage to archive the photos to (freeing up space on your computer), and then backing up the offline storage (before you delete the original copy! – always have at least 2 copies, preferably 3).


#9

@chressie, I have a similar use case: Copying the photos/videos of my Android phone (small disk) to my PC (larger disk) and than backing all that up (NAS).

Here is how I did it:

  1. I installed syncthing-android on the phone and syncthing on the PC. Both share the camera directory of the phone. On the PC the directory is $HOME/phone_sync When the phone gallery is cleared to make space, the photos and videos will be erased from the PC as well. Syncthing takes care of that. I clear the gallery about once a month manually or Google Photos app offers me to take care of it and removes anything that is older than 30 days.

  2. On the PC, I have a regular job (e.g. a cronjob, systemd-timer, etc.) every 60 minutes. That job executes rsync -rtP $HOME/phone_sync $HOME/Pictures/smartphone. Since rsync will not delete anything unless you also specify --delete the photos that are erased from the phone and hence erased from $HOME/phone_sync are STILL KEPT in $HOME/Pictures/smartphone. As you can see, photos and videos may exist twice under $HOME for a period of up to 30 days maximum. That’s fine for me.

  3. I use restic to backup $HOME to the NAS regularly.The deduplication of restic will ensure that each photo or video takes space in the NAS only once.

So, in summary, I use syncthing for transferring between devices, rsync for archiving, and restic for backups.


#10

Hi,

Just wondering, why is it about changing the content of a snapshot after it’s been written? I’m not an expert, just a new user, but couldn’t it be an option A) when writing the snapshots or B) when reading the snapshots?
For example:
A) keeping deleted files, present in previous snapshots, when writing the new snapshot.
B) reading a set of snapshots, showing files incrementally. It includes the latest modified files and deletions don’t count.

Thanks @rotor and @fawick for your helpful previous replies too.


#11

From the perspective of the code that’s indeed possible. Without meaning to be disrespectful, we’re trying to prevent “feature creep”, because each and every feature, once added, will find it’s users and needs to be maintained indefinitely. Each feature makes the code base larger and hinders future development. That’s a high burden for our maintainers. Thanks for understanding!