I restored a backup for fresh site using this command bench --site newsite restore sites/oldsite/private/backups/20250930_060027-oldsite-database.sql.gz --with-public-files '/home/frappeuser/frappe-bench/sites/oldsite/public.gz' --with-public-files '/home/frappeuser/frappe-bench/sites/oldsite/private.gz'
I confirmed that public.gz and private.gz contain files I need, it is created using tar czf public.gz ./public same with private folder.
When restored, files does not exist in new site. If I extract the public.gz to newsite/public, frappe cannot open the file, either file [hexstring] does not exist, or throwing error 404. How can I restore the files?
How EXACTLY were the backup files produced or manipulated in between?
Can you provide output of the (CLI) command file on your backup files?
Were they made using the bench backup command?
If not, try it and check the output against your backup files.
Also, the paths might somehow come into play. (e.g. @bahaou: “there” = where?)
The tar command was given in which directory?
Where were the archives put?
When you untar the archive, do the files land where needed?
@Peer he is not talking about the backup . the issue is after restoring the backup and opening any file from the browser it says 404. the file is not “there” , in the files/public and files/private folders (where files should exist) . he should double check again the folders . my solution is to just copy the files as they are from old site/files to new_site/files . no need to compress files and running extra commands . files will not compress anyway .
Well, indeed. BTW, I didn’t dispute your suggestions.
Something went wrong somewhere, so I just suggested how to diagnose or even only approach what went wrong.
Depending how and where the tar CLI command was given, it might have included relative paths in the archive which bench restore doesn’t expect, so the files might end up where they shouldn’t and the file DT controller won’t see them. And: Why not use bench backup? Maybe using tar is a sign for someone wanting to experiment all the details themselves in order to really understand these bits.
After all, backup-restore is essential for managing (moving, even safely developing) a site, and every knowledge bit which makes this more robust, might help at some point to get it right and/or recover from some failure condition or other unexpectedness.
@Peer bench restore with files can be helpful and clear restoring but there are some real cases where files are really huge like 50gb of files . compressing them will make bench backup run longer and the same for bench restore . in some cases the restore could crash . or even the file transfer between servers can crash and you have to start over .
In my case when I faced this issue I just backed the database (4 gb) and restored it using bench restore . then using rsync I can transfer the files , why this is better? because there is no compress and decompress which in reality will stay the same size , and the best part is if your connection crashed you can continue moving the rest of the file and do not start over . it took my computer 2 days to transfer 50gb of files and during that period , the connection to the server did crashed multiple times , but I do not need to restart again .
its just a tip that can be helpful someday . in fact its a good practice to be able to manage the files yourself . even the db you can restore it in mysql mamually . after all bench restore just copy files and run mysql commands in the back .
looks like it is a permission issue. frappe.log give me this. How should I proceed to fix permission? It is from the same bench, same unix user. Just different site.
My last attempt to restore is use bench backup --with-files and restore it.
==> logs/frappe.log <==
File "/home/frappeuser/frappe-bench/env/lib/python3.11/site-packages/pymysql/connections.py", line 775, in _read_packet
packet.raise_for_error()
File "/home/frappeuser/frappe-bench/env/lib/python3.11/site-packages/pymysql/protocol.py", line 219, in raise_for_error
err.raise_mysql_exception(self._data)
File "/home/frappeuser/frappe-bench/env/lib/python3.11/site-packages/pymysql/err.py", line 150, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1045, "Access denied for user '_6b543179b6a87f7c'@'localhost' (using password: YES)")
2025-10-01 08:58:46,346 ERROR frappe New Exception collected in error log
Site: newsite.id
Form Dict: {'is_private': 'NaN', 'folder': 'Home/Attachments', 'library_file_name': 'fba4429048', 'doctype': 'Sales Invoice', 'docname': 'SINV-1150-1', 'cmd': 'upload_file'}