Restore from command line specific file in folder

Hello

No, you just need to get the day you want from urbackup, there s no real difference between full and incremental. A full redownload and re-check everything, not only the new/different files.

Also as i said, it’s not recommended to get the data directly from the server datastore, it’s better to use a zip file (still has some limitation dues to zip format itself, like at one point it was 2GB max).
Best way to restore is via urbackup protocol.

Best would be to spend some time to see if the client is running or not , or if you have a network issue between the server and the client. Try to look at the logs in debug mode, etc …
Typically for autodiscover to work you need udp broadcast to work and hosts to be on the same subnet, else it’s considered an internet connection and you need to setup a password for it.

1 Like

Tnx for explanation! I can not use zip, my backups are too large =~ 600GB
Downloading zipfiles separatelly would be a pain

Well with much patience I already discovered that udp port was not enabled in firewall.

I will try now to restore. Tnx again orogor your last post was essential. Tnx also to PointPubMedia!

No restore button in web gui. Tried via command line,
urbackupclientctl restore-start -b 23 -d /unidadex -m / -t /mnt/unidadex

got the message
Error starting restore. No file backup access tokens found. Did you run a file backup yet?

My client is new. where are those tokens placed?

I think the token should be created if the client can connect.
Does the client appear online? what the client and server log says?

My client is being reconized as online system. But no restore button is showed, as seen below:

here are my logs(first is client, 2nd is server)


On the client you are sure to have set in /etc/default/urbackupclient (i don’t think another file location is used)
RESTORE=server-confirms
then restarted the client service, by default the line is on disabled. Usually if this is set and the client is online, the restore button appears.

Also, in the same file please set LOGLEVEL=debug

yes, RESTORE=“server-confirms” (it must be quoted)

I’ll set loglevel to debug

Client log:

Server:

Server log:

server log keeps issuing the following:

2020-07-13 18:38:07: New Backupclient: medsys3
2020-07-13 18:38:17: Connecting to ClientService of “medsys3” failed: Sending Identity to client “medsys3” failed. Retrying soon…
2020-07-13 18:38:17: Sending Identity to client “medsys3” failed. Retrying in 60s…
2020-07-13 18:40:27: Connecting to ClientService of “medsys3” failed: Sending Identity to client “medsys3” failed. Retrying soon…
2020-07-13 18:40:27: Sending Identity to client “medsys3” failed. Retrying in 60s…
2020-07-13 18:41:37: Connecting to ClientService of “medsys3” failed: Sending Identity to client “medsys3” failed. Retrying soon…
2020-07-13 18:41:37: Sending Identity to client “medsys3” failed. Retrying in 60s…
2020-07-13 18:42:47: Connecting to ClientService of “medsys3” failed: Sending Identity to client “medsys3” failed. Retrying soon…
2020-07-13 18:42:47: Sending Identity to client “medsys3” failed. Retrying in 60s…
2020-07-13 18:43:57: Connecting to ClientService of “medsys3” failed: Sending Identity to client “medsys3” failed. Retrying soon…
2020-07-13 18:43:57: Sending Identity to client “medsys3” failed. Retrying in 60s…

Maybe your client already connected to a different server and refuse this one, or there s a network issue.
if it s a pb with the key It should show online , but with a warning that there s a pb with the key. If you do show column->status on the server , and show all clients at the very bottom.

Gotta check that later i am going to bed, you can try on the server, add new client, somewhere, it says , “this server’s identity is: xxxx” , no need to actually add the client

copy that xxxx on a new line to /usr/local/var/urbackup/server_idents.txt on the client, then restart the client, no need to do if there s already a line that contains it.

Also , please check the firewall from server to client (there s a list of ports in the doc)

No, these are the only server and only client.

This was already done earlier today.

All ports on server were ok just the client I’ve forgot, but it was fixed.

But still not restoring, the log is responding " Connecting to ClientService of “medsys3” failed: Sending Identity to client “medsys3” failed. Retrying soon…"

Tnx for all help

Why it it a very bad idea?

As I understand it is an official documented function (9.1 Restoring image backups)

When performing file backups UrBackup creates a file system snapshot identical to the client’s file system at that point in time. As such, you can simply make those file system snapshots available to the clients via any file sharing protocol or application, such as Windows file sharing (or samba), FTP/SFTP, WebDAV

Why use scp is a very bad idea?

Because of hardlink/softlink used by urbackup for dedup in some configuration, you may not restore exactly the same thing.
Ie : restore a link with a file/folder instead of the file itself. Maybe it can work if you build your scp command line carefully. It can also work if you get a single file. If you use btrfs, you don’t get that issue.

So yes, it can work, but it’s also very easy to do a bad thing. While zip and using the gui don’t have that issue, so it’s better to recommend that.

Thank you!
I tested it with btrfs, probably therefore I had not problems.

I´ve restored mine using cp -LfRuv . It worked fine for me. After that I´ve upgraded Urbackup server to latest version, released this month. And magically everything got back working :man_shrugging:. Just wished to undestand what was the issue…

Now that it work, maybe don’t uninstall it so fast, play with it a bit and compare to other solutions.

If one day you have a bad upgrade, there s an automatic backup of the internal database every day so you can reinstall an older version and copy the older database over.

I found a big minus of recovery using scp.
When restoring via stsp, permissions owner and group are not restored!

That’s why I decided to figure out how to use urbackupclientctl.

Restore with urbackupclientctl at bare server in specific folder (step by step manual)

Preparatory actions

Disable scheduled backups for this client (options: interval for incremental/full file/image backups). It is necessary that when we install the client on the bare server, the backup does not start.

Stop urbackupclientbackend.service at the client (client at production server);
systemctl stop urbackupclientbackend.service

Download preconfigured client for Linux from web interface;
image
For restore files at the bare server you have to install the client. If you have new had (empty hdd) you can boot from linux live CD;

Install preconfigured client for Linux to the bare server

Upload preconfigured client for Linux to the bare server and install it;

sh UrBackup Client*.sh

if you install client from preconfigured disturb by default the option “INTERNET_ONLY=true”.
If this client is not internet client you should disable it:

sed -i "s/INTERNET_ONLY=true/INTERNET_ONLY=false/g" /etc/default/urbackupclient
systemctl restart urbackupclientbackend.service

Check this client online

Find backup at the CLI (urbackupclientctl)

List the folders to back up. Here we need to get the folder name - NAME column

urbackupclientctl list-backupdirs
PATH  NAME   FLAGS
----- ------ ----------------------------------------------
/     rootfs follow_symlinks,symlinks_optional,share_hashes
/boot boot   follow_symlinks,symlinks_optional,share_hashes

Display a list of backups for roots (folder name).
Here we need to find out the backupid of the required backup. The higher the backupid, the higher the backup is. For convenience, we are guided by the web interface.

urbackupclientctl browse -d rootfs
the last(newest) backup:
[{
"access": 1595290141,
"backupid": 158,
"backuptime": 1595302492,
"creat": 0,
"dir": true,
"mod": 1595288771,
"name": "rootfs"
}

previous backup (older):
,{
"access": 1595204059,
"backupid": 148,
"backuptime": 1595219417,
"creat": 0,
"dir": true,
"mod": 1595204059,
"name": "rootfs"
}
]

For example we want to restore rootfs/etc.
Check. Display the contents of the backup:

urbackupclientctl browse -d rootfs/etc -b 148
[{
"access": 1595202309,
"creat": 0,
"dir": true,
"mod": 1588804354,
"name": "ImageMagick-6"
}
,{
"access": 1595202309,
"creat": 0,
"dir": true,
"mod": 1552059292,
"name": "NetworkManager"
}
,{
"access": 1595202309,
"creat": 0,
"dir": true,
"mod": 1583507894,
"name": "X11"
}
and more...

We see that backup “-d rootfs/etc -b 148” is correct.

Restore process

Start restoring to /mnt

Important! The / mnt folder must be completely empty and have 777 permissions. Otherwise, UrBackup will write the error No permissions to create files in "/ mnt".

urbackupclientctl restore-start -d rootfs/etc -b 148  -m /etc  -t  /mnt -o
options:
-d Path of folder/file to restore inside the backup;
 -b backupid from which to restore files/folders;
-m Map from local output path of folders/files to a different local path (original path where files was at the client from backup was created);
-t Map to local output path of folders/files to a different local path (path where we want to save restored files instead original path);

-o Consider other file systems when removing files/directories not in backup. (Actually I do not fully understand what this option means, if anyone knows, please write);

Now files should be restored successfully!

Return the client settings back (at the production server)

After we have restored the files, the client on the bare server is no longer needed.
Remove the client on the bare server.

sudo uninstall_urbackupclient

Start urbackupclientbackend.service at the client (client at production server);
systemctl start urbackupclientbackend.service

Enable scheduled backups (options: interval for incremental/full file/image backups) at the web interface!

Finally we restored backup with urbackupclientctl at bare server!

1 Like