# Local backup failure, file exists

**URL:** https://meta.discourse.org/t/local-backup-failure-file-exists/194997
**Category:** Support
**Created:** [June 25, 2021, 11:12am UTC](https://meta.discourse.org/t/local-backup-failure-file-exists/194997 "2021-06-25T11:12:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![nachotester](https://avatars.discourse-cdn.com/v4/letter/n/ee59a6/32.png) [@nachotester](https://meta.discourse.org/u/nachotester)
#### Post date: [June 25, 2021, 11:12am UTC](https://meta.discourse.org/t/local-backup-failure-file-exists/194997/1 "2021-06-25T11:12:00Z")

</div>

I have a docker-based Discourse instance building from a template provided by DigitalOcean. When I enabled automated backup for the first time, a dump file was generated in `/var/discourse/shared/standalone/backups/default/...` as expected.

I decided to delete the `backups` dir and created a `backups` symlink pointing it to a volume. Since then the backup job has been failing (I also entered the container and initiated manual backup, same error message).  
Here’s the stack trace:

```plaintext
File exists @ dir_s_mkdir - /var/www/discourse/public/backups
/usr/local/lib/ruby/2.7.0/fileutils.rb:250:in `mkdir'
/usr/local/lib/ruby/2.7.0/fileutils.rb:250:in `fu_mkdir'
/usr/local/lib/ruby/2.7.0/fileutils.rb:228:in `block (2 levels) in mkdir_p'
/usr/local/lib/ruby/2.7.0/fileutils.rb:226:in `reverse_each'
/usr/local/lib/ruby/2.7.0/fileutils.rb:226:in `block in mkdir_p'
/usr/local/lib/ruby/2.7.0/fileutils.rb:211:in `each'
/usr/local/lib/ruby/2.7.0/fileutils.rb:211:in `mkdir_p'
/var/www/discourse/lib/backup_restore/local_backup_store.rb:10:in `base_directory'
...

```

\*\*Edit  
I entered the container and did some debugging. As it turns out, there’s a symlink pointing ` /var/www/discourse/public/backups` → `/shared/backups` on the host, which is also a symlink in my case. There’s a file permission issue preventing the ruby process from writing to backups dir on the host.

Any tips?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 25, 2021, 1:31pm UTC](https://meta.discourse.org/t/local-backup-failure-file-exists/194997/2 "2021-06-25T13:31:05Z")

</div>

The file structure in the container is different from that outside. The best thing to do is create a new volume that maps the backup directory to wherever you want it to go rather than use a symlink.
