Restic !!BETTER!! Download Snapshot

0 views
Skip to first unread message

Jade Jinkins

unread,
Jan 18, 2024, 8:51:16 AM1/18/24
to caprisoboo

Thank you so much. I found that the best bet for me was to use the mount command.
Then I basically entered the mount, did a tree > /home/resticFileStructure.txt and then I had that file to peruse and find what I needed. I very much appreciate your help.

restic list snapshots is a rather low-level command that just outputs the full ids of the existing snapshots. If you want a user friendly output then restic snapshots is the right place. The output of the snapshots command has changed with the introduction of the group-by function in restic 0.9.5.

restic download snapshot


Downloadhttps://t.co/NcneKMwLs4



I have been trying to go through all the documentation (it seems to be scattered and really incomplete), but I cannot seem to find a way to see how much storage my snapshots are taking. I can do this in borg (which I have been testing for a few days), and was hoping to utilize restic instead of a borg+rclone combo. Even the built in help for some of the commands is cryptic and incomprehensible.

I agree that the documentation and especially the error messages can be improved (a lot). Part of the problem is that you stumbled upon the list command, which is actually used to list things in the repository on a very low level, it is basically not meant for end-users to use. The snapshots command is used to display information about snapshots in the repo.

I am testing restic, borg, rclone, and any other deduplication backup/archive software I can right now. I have been using Crashplan for the last 6+ years and now they are cancelling all their home plans, so I have to find a replacement. I like the idea of something like restic or borg+rclone, with a Backblaze B2 storage, but I need to be cognizant of how much space I am taking up before I transfer it over my horrible internet connection, and I also need to know how much my backups will cost me monthly. I have several test repos that I am playing around with and I do not want to muck with ENV variables until I decide what option I am going to go with.

From there, you can see the usage states:
restic [command]
then there is a list of commands and a list of flags, with no indication of when or where to use those flags or in what order (if it matters) in how those flags can be used.

The backupPC logs are very neat with the Xfer logs, error logs, and statistics. On the restic case the xfer log might not be useful since there is already the ls command but the stats command is quite slow on big repos.

Is there currently any way to get the same kind of details for the list of snapshots as with the new backup output? I tried the new stats command but this only lists the total space used by all snapshots (if I used it correctly).

The forget command allows removing snapshots. When a snapshot ID like6e001a58 for the first snapshot made on 1 January 2016 is specified as theargument of the command, that snapshot is deleted from the repository:

The snapshot in a restic repository is really just a pointer to the data thatwas present when the snapshot was made. Removing a snapshot does not remove thedata from the repository, only when the command prune is run, unreferenced(and therefore unneeded) data is removed:

The basic idea is that you run forget by specifying the right parameters tellrestic which snapshots you want to keep. Restic then goes through the list ofsnapshots and removes those that do not match the policy.

When --keep-hourly is set, e.g. to the value 4, then restic will find thefour most recent hours in which a snapshot was created. For each of thosehours, it marks the last snapshot as to be kept, and flags the others forremoval. It will then remove all the snapshots for these hours from the list.

When --keep-daily is set, e.g. to the value 7, then restic will apply a similarapproach to --keep-hourly: Go through the list, find the last seven days inwhich at least one snapshot was made. For each day, keep the last snapshot madeon that day, flag the others for removal, and delete all snapshots from thelist.

This article described an easy way to remove a single snapshot and alsoexplained how to apply an expire policy for snapshots. This allows regularlyremoving snapshots from the repository to limit its growth.

What is it you want to look at? If you want to see what files that were/are backed up in a snapshot, you can use restic ls, see restic help ls for more information You can also use restic find to search for files in snapshots.

If so, the command would be like this sudo restic -r /run/media/liveuser/d52b3913-2ed2-4142-9309-3fdf641141f0/DataCabinet/ ls 0e88542b /var/www. This will list the contents of that snapshot, but only the parts of it which is the /var/www directory and whatever is inside and under it. If you want to list everything in the snapshot, remove the /var/www part from the command.

Looks like it should work, although you do have the order of the arguments wrong. If you read restic help restore you will see that the syntax is restic restore [flags] snapshotID, and since the -r is a global flag it should come before the restore command, and the snapshot ID should be the last part.

Does this make sense? Can you in the path that I presume will be /mnt/JESSE3d299e46/snapshots/3d299e46 see the paths that you backed up? If not, please run ls -la /mnt/JESSE3d299e46/snapshots/3d299e46 and show us the output

Not sure what you mean by this. You can just use a terminal or a file browser to navigate into those directories (under /mnt/JESSE3d299e46/snapshots/ when you have the repository mounted), to find, look at, open and/or restore the files. What could possibly be stopping you from doing this?

I have no idea why you are trying that command. I have been showing you how to use the commands earlier in this thread, and I have also shown you how to use the built-in restic help command to see the exact syntax that is available for the commands you are trying to use.

Again, you are for some reason running a command that is completely incorrect. What makes you think that the snapshots command takes an option/argument/parameter that is named mount? Have you even looked at the help from restic help snapshots, where you would see that there is no such option for the snapshots command?

All backup space is finite, so restic allows removing old snapshots. This canbe done either manually (by specifying a snapshot ID to remove) or by using apolicy that describes which snapshots to forget. For all remove operations, twocommands need to be called in sequence: forget to remove snapshots, andprune to remove the remaining data that was referenced only by the removedsnapshots. The latter can be automated with the --prune option of forget,which runs prune automatically if any snapshots were actually removed.

Removing snapshots manually is tedious and error-prone, therefore restic allowsspecifying a policy (one or more --keep-* options) for which snapshots tokeep. You can for example define how many hourly, daily, weekly, monthly andyearly snapshots to keep, and any other snapshots will be removed.

--keep-within duration keep all snapshots having a timestamp withinthe specified duration of the latest snapshot, where duration is anumber of years, months, days, and hours. E.g. 2y5m7d3h will keep allsnapshots made in the two years, five months, seven days and three hoursbefore the latest (most recent) snapshot.

--keep-within-hourly duration keep all hourly snapshots made within thespecified duration of the latest snapshot. The duration is specified inthe same way as for --keep-within and the method for determining hourlysnapshots is the same as for --keep-hourly.

When forget is run with a policy, restic first loads the list of all snapshotsand groups them by their host name and paths. The grouping options can be set with--group-by, e.g. using --group-by paths,tags to instead group snapshots bypaths and tags. The policy is then applied to each group of snapshots individually.This is a safety feature to prevent accidental removal of unrelated backup sets. Todisable grouping and apply the policy to all snapshots regardless of their host,paths and tags, use --group-by '' (that is, an empty value to --group-by).Note that one would normally set the --group-by option for the backupcommand to the same value.

Additionally, you can restrict the policy to only process snapshots which have aparticular hostname with the --host parameter, or tags with the --tagoption. When multiple tags are specified, only the snapshots which have all thetags are considered. For example, the following command removes all but thelatest snapshot of all snapshots that have the tag foo:

The processed snapshots are evaluated against all --keep-* options but asnapshot only need to match a single option to be kept (the results are ORed).This means that the most recent snapshot on a Sunday would match both hourly,daily and weekly --keep-* options, and possibly more depending on calendar.

For example, suppose you make one backup every day for 100 years. Then forget--keep-daily 7 --keep-weekly 5 --keep-monthly 12 --keep-yearly 75 would keepthe most recent 7 daily snapshots and 4 last-day-of-the-week ones (since the 7dailies already include 1 weekly). Additionally, 12 or 11 last-day-of-the-monthsnapshots will be kept (depending on whether one of them ends up being the sameas a daily or weekly). And finally 75 or 74 last-day-of-the-year snapshots arekept, depending on whether one of them ends up being the same as an already keptsnapshot. All other snapshots are removed.

You might want to maintain the same policy as in the example above, but haveirregular backups. For example, the 7 snapshots specified with --keep-daily 7might be spread over a longer period. If what you want is to keep dailysnapshots for the last week, weekly for the last month, monthly for the lastyear and yearly for the last 75 years, you can instead specify forget--keep-within-daily 7d --keep-within-weekly 1m --keep-within-monthly 1y--keep-within-yearly 75y (note that 1w is not a recognized duration, soyou will have to specify 7d instead).

df19127ead
Reply all
Reply to author
Forward
0 new messages