Is it possible to retrieve a file in a previous snapshot?
Specifically, config.php in /usr/share/squirrelmail/config then override the current config.php file in /usr/share/squirrelmail/config
Replacing $SNAPSHOT with the appropriate snapshot ID. Note that this restores the file in-place, which can be dangerous. If you want to ensure that the file is what you expected first, you can restore to a temporary location first, then move the file.
Another common method if it is just about a single file is to use restic mount (on supported platforms like linux): This âmountsâ all contents of your repository to a given path.
This can then be navigated by your favorite file browser (allows all read only file operations, e.g. reading the content or diffing with other files) and restoring works by just copying the correctly identified file to its original location.
If you restore big amounts of data, the restic restore command should be preferred, however.
I tried using this in the past but found it to be horrendously slow on large repositories to the point where it was completely unusable. Maybe it works better on small repositories.
Well, yes, I assumed you would be specifying this as well. I have scripts that set RESTIC_REPOSITORY so I donât need -r. If you need to specify the location then just add that parameter.
Recently, Improvements on speed in general and mount in particular have been done and some more are on the way. You might want to try out the latest beta (which should be already faster especially for large files within your repo) or this optimization:
Fatal: unable to open repo at /etc/yum.repos.d/_copr_copart-restic.repo: ReadDir: open /etc/yum.repos.d/_copr_copart-restic.repo/keys: not a directory
Okay, just select the dir not the actual repo.
sudo restic restore --target=/tmp/restore --include=/usr/share/squirrelmail/config/config.php b55535fc --repo â/etc/yum.repos.dâ
Fatal: unable to open config file: Stat: stat /etc/yum.repos.d*/config*: no such file or directory
hmmâŚI see the file but the computer is telling me there is no file.
Is there a repository at the following location?
/etc/yum.repos.d
I see the /config getting added in there. Possible issue.
This has nothing to do with the restic repository, which is the location what you backed up your files to.
Here is the documentation that talks about creating a repository. When you set up your backups, what did you use as repository then? Or have you not started using restic yet?
Please read the manual I linked to above if you havenât already
repository e72f1d68 opened successfully, password is correct
found 2 old cache directories in /root/.cache/restic, run restic cache --cleanup to remove them
restoring <Snapshot b55535fc of [/home/orca] at 2020-07-20 11:29:09.163974804 -0700 PDT by root@orcacomputers.orcainbox> to /tmp/restore
Restore directory is empty =(
The file should be in there no?
/tmp/restore
[orca@orcacomputers restore]$ ll
total 0
Or have you not started using restic yet?
Been doing backups to my external hard drive for a while now.
I have no idea what is in your backups. Try restic ls b55535fc | less to show the contents of the backup. Run man less if you arenât sure how to use the less pager (it will let you scroll through the output, which is useful if there are hundreds of files in the backup).
restoring <Snapshot b55535fc of [/home/orca] at 2020-07-20 11:29:09.163974804 -0700 PDT by root@orcacomputers.orcainbox> to /tmp/restore
Says it went through but no file in directory.
So, must see in the snapshot to confirm I have the file directory correct. File was incorrect, I needed config_default.php, not config.php, but the same issue happened. File didnât go to /tmp/restore.
The less pager comes up but it only shows the snaps, itâs not accessing the contents of b55535fc snapshot.
restic ls -l -r /run/media/orca/DataCabinet b55535fc | grep âsquirrelmail/configâ
Fatal: unable to open repo at /run/media/orca/DataCabinet: ReadDir: open /run/media/orca/DataCabinet/keys: permission denied
sudo restic ls -l -r /run/media/orca/DataCabinet b55535fc | grep âsquirrelmail/configâ
[sudo] password for orca:
enter password for repository:
[orca@orcacomputers ~]$
So it looks like there is no such file in the backup. If you run it without the grep pipeline, does it dump a list of files? Do you recognize any of them?
restic ls -l -r /run/media/orca/DataCabinet/ b55535fc
outputs lots of lines which I recognize so thatâs good.
sudo restic ls -l -r /run/media/orca/DataCabinet/ b55535fc | egrep âconfig.phpâ
Outputs files, but not the file I am looking for, Media Wiki and phpBB only.
The actual file I messed up is /usr/share/squirrelmail/config/config_default.php so that is what I should be searching for.
restic ls -l -r /run/media/orca/DataCabinet/ b55535fc | egrep âconfig_default.phpâ
returns NIL which I donât understand, like you said âthe file is not thereâ but it has to be I back up my entire filesystem with:
restic -r /run/media/orca/DataCabinet backup ~
The snapshots are about 40GB so this tells me the entire system is backed up so the file must be there unless my backup command is wrong.
Is there a way I can see the file directory of the snapshots?
This is a file in the directory with path /usr/share/squirrelmail/config/. This is completely outside of your home directory (~), assuming your home directory isnât somewhere in that path, which it most likely isnât.
This backs up only your home directory, not e.g. /usr/share/squirrelmail/config/. Usually your home directory is something like /home/<username>, mine is /home/rawtaz.
This means that you have never backed up the file you are looking for. Please verify this by showing us the output of echo $HOME. If the beginning of the path that this command outputs doesnât match /usr/share/squirrelmail/config/ then you simply never backed this file up in the first place, and that is why it is not in your backup and that is why it can obviously not be restored from the backup.
Honestly, and I say this not to be rude but to make you understand - you totally need to educate yourself on the basics of using your operating system. You seem very lost in what even the most basic commands do or how to structure them, what the files in your filesystems are, what the different paths in your filesystem are, and which paths cover what (for example, / will cover ~ so if you back up / you donât need to also back up ~)
So yes, the answer to your question is that you can just add / at the end of your backup command, but if you want to back up everything you can just replace the ~ with / instead since thatâs the more proper representation of âeverythingâ.
Note that youâll probably want to exclude certain directories, thereâs a lot of files that arenât relevant to back up at all, e.g. some runtime and system files. There should be a bunch of topics about backing up (and I think also restoring) full Linux filesystems or similar, feel free to search a bit to perhaps find them. Thereâs a lot of people backing up their entire system.
The blessing in disguise isnât so much due to an actual disguise, you should know that if you back up ~ this will not include /. Thereâs nothing disguised here at all
Apologies if you feel offended, but Iâm just bringing up the elephant in the room. Hopefully for the best - if you continue like this itâs just a matter of time before you run into some really big problem or data loss or vulnerability due to not knowing how your system(s) work. Noone wants that to happen!