# :white_check_mark: First backup and restore with Mayan EDMS
Before I think about using a tool at home, I always need to have a working restore plan if everything goes south.
## Preparation
1. Regular postgres database dumps to mayans media folder.\
*(read further, why the media folder has a special function in my case)*
2. The media folder location links to a NFS mount coming directly from my NAS.\
This way the documents, settings, cache and database (see 1.) are part of the “usual” backup plan. Which is itself being a RAID 1 system and also backed up once a week onto an external USB harddisk.
With these two points everything, which is needed for a complete (fresh) restore, is in one place.
## Restore (test)
First the “crash” simulation:
* Drop postgres database mayan\
`sudo -u postgres dropdb [DBNAME]`
* Move or delete (*if you’re brave* :yum:) mayan root.\
*(which is also a virtual environment)*
Restore steps:
* Install new mayan edms virtual environment as stated in the docs at the previous path
* Create empty database for mayan and import latest database dump
* create a symlink to the mayan media folder NFS share at the expected position *(stated in the config)*
* restart supervisor
Updated [mayan sequence](https://winklerfamilie.eu/git/efelon/shell_sequencer/src/branch/master/seqs/mayan-edms.sh) with step 20 and 22 to backup the database to mayan and a small help how to restore.
## Result
![image.png](file-guid:ff33b8ea-ce7c-4884-a1be-fdfc4977c002 "image.png")